|
| 1 | +name: Build and Test |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - develop |
| 7 | + - release |
| 8 | + pull_request: |
| 9 | + branches: |
| 10 | + - develop |
| 11 | + - release |
| 12 | + workflow_dispatch: |
| 13 | + |
| 14 | +jobs: |
| 15 | + latest-beta-swift-version: |
| 16 | + name: Latest (Beta) Swift Version |
| 17 | + runs-on: macos-11 |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v2 |
| 20 | + - uses: maxim-lobanov/setup-xcode@v1.2.3 |
| 21 | + with: |
| 22 | + xcode-version: latest |
| 23 | + - uses: actions/cache@v2 |
| 24 | + with: |
| 25 | + path: .build |
| 26 | + key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }} |
| 27 | + - name: Check Xcode version |
| 28 | + run: xcodebuild -version |
| 29 | + - name: Check Swift version |
| 30 | + run: swift --version |
| 31 | + - name: Debug Build & Test |
| 32 | + run: swift test |
| 33 | + macos: |
| 34 | + name: macOS ${{ matrix.configuration }} |
| 35 | + runs-on: macos-11 |
| 36 | + strategy: |
| 37 | + fail-fast: false |
| 38 | + matrix: |
| 39 | + configuration: [debug, release, release_testing] |
| 40 | + steps: |
| 41 | + - uses: actions/checkout@v2 |
| 42 | + - uses: maxim-lobanov/setup-xcode@v1.2.3 |
| 43 | + with: |
| 44 | + xcode-version: latest-stable |
| 45 | + - uses: actions/cache@v2 |
| 46 | + with: |
| 47 | + path: .build |
| 48 | + key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }} |
| 49 | + - name: Check Xcode version |
| 50 | + run: xcodebuild -version |
| 51 | + - name: Check Swift version |
| 52 | + run: swift --version |
| 53 | + - name: Release Build |
| 54 | + if: matrix.configuration == 'release' |
| 55 | + run: swift build -c release |
| 56 | + - name: Release Build & Test |
| 57 | + if: matrix.configuration == 'release_testing' |
| 58 | + run: swift test -c release -Xswiftc -enable-testing -Xswiftc -DRELEASE_TESTING |
| 59 | + - name: Debug Build & Test |
| 60 | + if: matrix.configuration == 'debug' |
| 61 | + run: swift test -c debug --enable-code-coverage -Xswiftc -DCOVERAGE |
| 62 | + - name: Convert coverage report |
| 63 | + if: matrix.configuration == 'debug' |
| 64 | + run: xcrun llvm-cov export -format="lcov" .build/debug/ApodiniTemplatePackageTests.xctest/Contents/MacOS/ApodiniTemplatePackageTests -instr-profile .build/debug/codecov/default.profdata > coverage.lcov |
| 65 | + - name: Upload coverage to Codecov |
| 66 | + uses: codecov/codecov-action@v1 |
| 67 | + linux: |
| 68 | + name: Linux ${{ matrix.linux }} ${{ matrix.configuration }} |
| 69 | + container: |
| 70 | + image: swift:${{ matrix.linux }} |
| 71 | + runs-on: ubuntu-latest |
| 72 | + strategy: |
| 73 | + fail-fast: false |
| 74 | + matrix: |
| 75 | + linux: [bionic, xenial, focal, amazonlinux2, centos8] |
| 76 | + configuration: [debug, release] |
| 77 | + steps: |
| 78 | + - uses: actions/checkout@v2 |
| 79 | + - uses: actions/cache@v2 |
| 80 | + with: |
| 81 | + path: .build |
| 82 | + key: ${{ runner.os }}-${{matrix.linux}}-spm-${{ hashFiles('Package.resolved') }} |
| 83 | + - name: Check Swift version |
| 84 | + run: swift --version |
| 85 | + - name: Release Build |
| 86 | + if: matrix.configuration == 'release' |
| 87 | + run: swift build -c release |
| 88 | + - name: Debug Build & Test |
| 89 | + if: matrix.configuration == 'debug' |
| 90 | + run: swift test -c debug |
0 commit comments