|
| 1 | +name: Tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + paths-ignore: [ README.md ] |
| 7 | + pull_request: |
| 8 | + branches: [ main ] |
| 9 | + paths-ignore: [ README.md ] |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +jobs: |
| 13 | + formatlint: |
| 14 | + name: Format linting |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - name: Checkout |
| 18 | + uses: actions/checkout@v3 |
| 19 | + - name: Set up Docker Buildx |
| 20 | + uses: docker/setup-buildx-action@v2 |
| 21 | + - name: Pull formatting docker image |
| 22 | + run: docker pull ghcr.io/nicklockwood/swiftformat:latest |
| 23 | + - name: Run format linting |
| 24 | + run: docker run --rm -v ${{ github.workspace }}:/repo ghcr.io/nicklockwood/swiftformat:latest /repo --lint |
| 25 | + |
| 26 | + macos: |
| 27 | + name: Test on macOS |
| 28 | + runs-on: macos-latest |
| 29 | + steps: |
| 30 | + - uses: maxim-lobanov/setup-xcode@v1 |
| 31 | + with: |
| 32 | + xcode-version: latest-stable |
| 33 | + - uses: actions/checkout@v3 |
| 34 | + - name: Build and test |
| 35 | + run: swift test --parallel --enable-test-discovery |
| 36 | + |
| 37 | + linux: |
| 38 | + name: Test on Linux |
| 39 | + runs-on: ubuntu-latest |
| 40 | + steps: |
| 41 | + - uses: swift-actions/setup-swift@v2 |
| 42 | + - uses: actions/checkout@v3 |
| 43 | + - name: Test |
| 44 | + run: swift test --parallel --enable-code-coverage |
| 45 | + - name: Get test coverage html |
| 46 | + run: | |
| 47 | + llvm-cov show \ |
| 48 | + $(swift build --show-bin-path)/GraphQLRxSwiftPackageTests.xctest \ |
| 49 | + --instr-profile $(swift build --show-bin-path)/codecov/default.profdata \ |
| 50 | + --ignore-filename-regex="\.build|Tests" \ |
| 51 | + --format html \ |
| 52 | + --output-dir=.test-coverage |
| 53 | + - name: Upload test coverage html |
| 54 | + uses: actions/upload-artifact@v3 |
| 55 | + with: |
| 56 | + name: test-coverage-report |
| 57 | + path: .test-coverage |
| 58 | + |
| 59 | + backcompat-ubuntu-22_04: |
| 60 | + name: Test Swift ${{ matrix.swift }} on Ubuntu 22.04 |
| 61 | + runs-on: ubuntu-22.04 |
| 62 | + strategy: |
| 63 | + matrix: |
| 64 | + swift: ["5.7", "5.8", "5.9", "5.10", "6.0"] |
| 65 | + steps: |
| 66 | + - uses: swift-actions/setup-swift@v2 |
| 67 | + with: |
| 68 | + swift-version: ${{ matrix.swift }} |
| 69 | + - uses: actions/checkout@v3 |
| 70 | + - name: Test |
| 71 | + run: swift test --parallel |
| 72 | + |
| 73 | + # Swift versions older than 5.7 don't have builds for 22.04. https://www.swift.org/download/ |
| 74 | + backcompat-ubuntu-20_04: |
| 75 | + name: Test Swift ${{ matrix.swift }} on Ubuntu 20.04 |
| 76 | + runs-on: ubuntu-20.04 |
| 77 | + strategy: |
| 78 | + matrix: |
| 79 | + swift: ["5.4", "5.5", "5.6"] |
| 80 | + steps: |
| 81 | + - uses: swift-actions/setup-swift@v2 |
| 82 | + with: |
| 83 | + swift-version: ${{ matrix.swift }} |
| 84 | + - uses: actions/checkout@v3 |
| 85 | + - name: Test |
| 86 | + run: swift test --parallel |
0 commit comments