From 614391532e880272aa87dc204476178c75a169ff Mon Sep 17 00:00:00 2001 From: Tristan Date: Wed, 13 May 2020 17:07:23 +0100 Subject: [PATCH] Added CI --- .github/workflows/ci-step-build.awk | 12 ++ .github/workflows/ci-step-test.awk | 16 +++ .github/workflows/ci.yml | 34 +++++ .github/workflows/docs.yml | 26 ++++ .../xcshareddata/IDETemplateMacros.plist | 23 ++-- .../xcschemes/Entwine-Package.xcscheme | 129 ------------------ .../xcshareddata/xcschemes/Entwine.xcscheme | 64 ++++++++- .../xcschemes/EntwineTest.xcscheme | 67 +++++++++ Makefile | 8 ++ README.md | 2 + 10 files changed, 240 insertions(+), 141 deletions(-) create mode 100755 .github/workflows/ci-step-build.awk create mode 100755 .github/workflows/ci-step-test.awk create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/docs.yml delete mode 100644 .swiftpm/xcode/xcshareddata/xcschemes/Entwine-Package.xcscheme create mode 100644 .swiftpm/xcode/xcshareddata/xcschemes/EntwineTest.xcscheme create mode 100644 Makefile diff --git a/.github/workflows/ci-step-build.awk b/.github/workflows/ci-step-build.awk new file mode 100755 index 0000000..e5f1ad1 --- /dev/null +++ b/.github/workflows/ci-step-build.awk @@ -0,0 +1,12 @@ +#!/usr/bin/awk -f +BEGIN { FS=":"; errCode=0; } +{ + if(match($0,/^.+:[0-9]+:[0-9]+: error: /)) { + message=substr($0,RSTART+RLENGTH); file=$1; gsub("^"prefix"/","",file); + printf("::error file=%s,line=%s,col=%s::%s\n", file, $2, $3, message); + errCode=1; + } else { + print; + } +} +END { exit errCode; } diff --git a/.github/workflows/ci-step-test.awk b/.github/workflows/ci-step-test.awk new file mode 100755 index 0000000..82bef8d --- /dev/null +++ b/.github/workflows/ci-step-test.awk @@ -0,0 +1,16 @@ +#!/usr/bin/awk -f +BEGIN { FS=":"; errCode=0; } +{ + if(match($0,/^.+:[0-9]+:[0-9]+: error: /)) { + message=substr($0,RSTART+RLENGTH); file=$1; gsub("^"prefix"/","",file); + printf("::error file=%s,line=%s,col=%s::%s\n", file, $2, $3, message); + errCode=1; + } else if(match($0,/^.+:[0-9]+: error: /)) { + message=substr($0,RSTART+RLENGTH); file=$1; gsub("^"prefix"/","",file); + printf("::error file=%s,line=%s::%s\n", file, $2, message); + errCode=1; + } else { + print; + } +} +END { exit errCode; } diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c1397fb --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,34 @@ +name: CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ '*' ] + +jobs: + test: + name: Test + runs-on: macos-latest + + steps: + - name: Set up Environment + run: | + workflowsPath=${{ github.workspace }}/.github/workflows + echo "::set-env name=workflows_path::$workflowsPath" + + - name: Checkout + uses: actions/checkout@v2 + + - name: Build + run: | + make build -C ${{ github.workspace }} 2>&1 \ + | ${{ env.workflows_path }}/ci-step-build.awk \ + -v prefix=${{ github.workspace }} + + - name: Run Tests + run: | + make test -C ${{ github.workspace }} 2>&1 \ + | ${{ env.workflows_path }}/ci-step-test.awk \ + -v prefix=${{ github.workspace }} + diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..15e7a86 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,26 @@ +name: Docs + +on: + push: + branches: [ master ] + +jobs: + publish-docs: + name: Publish Docs + runs-on: macos-latest + + steps: + - name: Set up Environment + run: | + git config --global user.email "action@github.com" + git config --global user.name "GitHub Action" + gem install bundler + gem install jazzy --no-document + + - name: Checkout + uses: actions/checkout@v2 + with: + ref: 'gh-pages' + + - name: Build Docs + run: make update-docs -C ${{ github.workspace }} diff --git a/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDETemplateMacros.plist b/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDETemplateMacros.plist index 3e25acb..2329bf8 100644 --- a/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDETemplateMacros.plist +++ b/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDETemplateMacros.plist @@ -4,16 +4,16 @@ FILEHEADER -// ___WORKSPACENAME___ -// https://github.com/tcldr/___WORKSPACENAME___ -// -// Copyright © ___YEAR___ Tristan Celder. All rights reserved. +// Entwine +// https://github.com/tcldr/Entwine +// +// Copyright © 2020 Tristan Celder. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in @@ -23,8 +23,9 @@ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. + diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/Entwine-Package.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/Entwine-Package.xcscheme deleted file mode 100644 index f9523c4..0000000 --- a/.swiftpm/xcode/xcshareddata/xcschemes/Entwine-Package.xcscheme +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/Entwine.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/Entwine.xcscheme index 6975ae6..96d9280 100644 --- a/.swiftpm/xcode/xcshareddata/xcschemes/Entwine.xcscheme +++ b/.swiftpm/xcode/xcshareddata/xcschemes/Entwine.xcscheme @@ -1,6 +1,6 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1659fa0 --- /dev/null +++ b/Makefile @@ -0,0 +1,8 @@ +build: + swift build -c release + +test: + swift test \ + --enable-test-discovery \ + --parallel + diff --git a/README.md b/README.md index 6bfd0af..4bb6d8f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # [Entwine](https://github.com/tcldr/Entwine) +![CI](https://github.com/tcldr/Entwine/workflows/CI/badge.svg) +[![@tcldr1](https://img.shields.io/static/v1?label=&message=@tcldr1&color=1DA1F2&logo=twitter&labelColor=24292e)](https;//twitter.com/tcldr1) Accessories for [Apple's Combine Framework](https://developer.apple.com/documentation/combine).