diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml new file mode 100644 index 0000000..71b236d --- /dev/null +++ b/.github/workflows/Tests.yml @@ -0,0 +1,121 @@ +name: Tests + +on: [push, pull_request] + +jobs: + macOS-iOS-tvOS-watchOS: + name: macOS/iOS/tvOS/watchOS + runs-on: macOS-latest + steps: + - name: Checkout + uses: actions/checkout@v1 + - name: Swift Version + run: swift --version + - name: Make Logs Directory + run: mkdir logs + - name: Xcode Version + run: xcodebuild -version + - name: XC Pretty + run: sudo gem install xcpretty-travis-formatter + - name: Build (macOS/Debug) + run: set -o pipefail; xcodebuild clean build -workspace . -scheme DictionaryCoding -configuration Debug CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | tee logs/xcodebuild-macOS-build-debug.log | xcpretty + - name: Build (macOS/Release) + run: set -o pipefail; xcodebuild clean build -workspace . -scheme DictionaryCoding -configuration Release CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | tee logs/xcodebuild-macOS-build-release.log | xcpretty + - name: Test (macOS/Debug) + run: | + GOTPACKAGE=$(xcodebuild -workspace . -list | (grep DictionaryCoding-Package || true)) + echo "*$GOTPACKAGE*" + if [[ $GOTPACKAGE != "" ]] + then + SCHEME="DictionaryCoding-Package" + else + SCHEME="DictionaryCoding" + fi + set -o pipefail + xcodebuild test -workspace . -scheme $SCHEME -configuration Debug CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | tee logs/xcodebuild-macOS-test-debug.log | xcpretty + - name: Test (macOS/Release) + run: | + GOTPACKAGE=$(xcodebuild -workspace . -list | (grep DictionaryCoding-Package || true)) + echo "*$GOTPACKAGE*" + if [[ $GOTPACKAGE != "" ]] + then + SCHEME="DictionaryCoding-Package" + else + SCHEME="DictionaryCoding" + fi + set -o pipefail + xcodebuild test -workspace . -scheme $SCHEME -configuration Release CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ENABLE_TESTABILITY=YES | tee logs/xcodebuild-macOS-test-release.log | xcpretty + - name: Build (iOS/Debug) + run: set -o pipefail; xcodebuild clean build -workspace . -scheme DictionaryCoding -configuration Debug CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | tee logs/xcodebuild-iOS-build-debug.log | xcpretty + - name: Build (iOS/Release) + run: set -o pipefail; xcodebuild clean build -workspace . -scheme DictionaryCoding -configuration Release CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | tee logs/xcodebuild-iOS-build-release.log | xcpretty + - name: Test (iOS/Debug) + run: | + GOTPACKAGE=$(xcodebuild -workspace . -list | (grep DictionaryCoding-Package || true)) + echo "*$GOTPACKAGE*" + if [[ $GOTPACKAGE != "" ]] + then + SCHEME="DictionaryCoding-Package" + else + SCHEME="DictionaryCoding" + fi + set -o pipefail + xcodebuild test -workspace . -scheme $SCHEME -destination "name=iPhone 11" -configuration Debug CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | tee logs/xcodebuild-iOS-test-debug.log | xcpretty + - name: Test (iOS/Release) + run: | + GOTPACKAGE=$(xcodebuild -workspace . -list | (grep DictionaryCoding-Package || true)) + echo "*$GOTPACKAGE*" + if [[ $GOTPACKAGE != "" ]] + then + SCHEME="DictionaryCoding-Package" + else + SCHEME="DictionaryCoding" + fi + set -o pipefail + xcodebuild test -workspace . -scheme $SCHEME -destination "name=iPhone 11" -configuration Release CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ENABLE_TESTABILITY=YES | tee logs/xcodebuild-iOS-test-release.log | xcpretty + - name: Build (tvOS/Debug) + run: set -o pipefail; xcodebuild clean build -workspace . -scheme DictionaryCoding -configuration Debug CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | tee logs/xcodebuild-tvOS-build-debug.log | xcpretty + - name: Build (tvOS/Release) + run: set -o pipefail; xcodebuild clean build -workspace . -scheme DictionaryCoding -configuration Release CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | tee logs/xcodebuild-tvOS-build-release.log | xcpretty + - name: Test (tvOS/Debug) + run: | + GOTPACKAGE=$(xcodebuild -workspace . -list | (grep DictionaryCoding-Package || true)) + echo "*$GOTPACKAGE*" + if [[ $GOTPACKAGE != "" ]] + then + SCHEME="DictionaryCoding-Package" + else + SCHEME="DictionaryCoding" + fi + set -o pipefail + xcodebuild test -workspace . -scheme $SCHEME -destination "name=Apple TV" -configuration Debug CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | tee logs/xcodebuild-tvOS-test-debug.log | xcpretty + - name: Test (tvOS/Release) + run: | + GOTPACKAGE=$(xcodebuild -workspace . -list | (grep DictionaryCoding-Package || true)) + echo "*$GOTPACKAGE*" + if [[ $GOTPACKAGE != "" ]] + then + SCHEME="DictionaryCoding-Package" + else + SCHEME="DictionaryCoding" + fi + set -o pipefail + xcodebuild test -workspace . -scheme $SCHEME -destination "name=Apple TV" -configuration Release CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ENABLE_TESTABILITY=YES | tee logs/xcodebuild-tvOS-test-release.log | xcpretty + - name: Build (watchOS/Debug) + run: set -o pipefail; xcodebuild clean build -workspace . -scheme DictionaryCoding -configuration Debug CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | tee logs/xcodebuild-watchOS-build-debug.log | xcpretty + - name: Build (watchOS/Release) + run: set -o pipefail; xcodebuild clean build -workspace . -scheme DictionaryCoding -configuration Release CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | tee logs/xcodebuild-watchOS-build-release.log | xcpretty + - name: Upload Logs + uses: actions/upload-artifact@v1 + with: + name: logs + path: logs + - name: Slack Notification + uses: elegantchaos/slatify@master + if: always() + with: + type: ${{ job.status }} + job_name: 'macOS/iOS/tvOS/watchOS' + mention_if: 'failure' + url: ${{ secrets.SLACK_WEBHOOK }} + diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml deleted file mode 100644 index 7626f12..0000000 --- a/.github/workflows/swift.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Swift - -on: [push] - -jobs: - build: - - runs-on: macOS-latest - - steps: - - uses: actions/checkout@v1 - - name: List Apps - run: ls /Applications - - name: Swift Version - run: swift --version - - name: Select Xcode - run: sudo xcode-select -s /Applications/Xcode_11.2.1.app - - name: Run tests - run: swift test diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/DictionaryCoding.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/DictionaryCoding.xcscheme new file mode 100644 index 0000000..f076bb4 --- /dev/null +++ b/.swiftpm/xcode/xcshareddata/xcschemes/DictionaryCoding.xcscheme @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/README.md b/README.md index 30c8d30..ade7118 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,15 @@ +[![Test results][tests shield]][actions] [![Latest release][release shield]][releases] [![Swift 5.0][swift shield]][swift] ![Platforms: iOS, macOS, tvOS, watchOS, Linux][platforms shield] + +[swift]: https://swift.org + +[releases]: https://github.com/elegantchaos/DictionaryCoding/releases +[actions]: https://github.com/elegantchaos/DictionaryCoding/actions + +[release shield]: https://img.shields.io/github/v/release/elegantchaos/DictionaryCoding +[swift shield]: https://img.shields.io/badge/swift-5.0-F05138.svg "Swift 5.0" +[platforms shield]: https://img.shields.io/badge/platforms-iOS_macOS_tvOS_watchOS_Linux-lightgrey.svg?style=flat "iOS, macOS, tvOS, watchOS, Linux" +[tests shield]: https://github.com/elegantchaos/DictionaryCoding/workflows/Tests/badge.svg + # DictionaryCoding This is an implementation of Swift's Encoder/Decoder protocols which uses `NSDictionary` as its underlying container mechanism.