Skip to content

Commit

Permalink
Merge pull request #132 from NeedleInAJayStack/chore/code-coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
NeedleInAJayStack authored Nov 6, 2023
2 parents 3f01aa5 + 6f77149 commit 3bf0b96
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 16 deletions.
54 changes: 38 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
formatlint:
name: Lint for correct formatting
name: Format linting
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -24,41 +24,63 @@ jobs:
run: docker run --rm -v ${{ github.workspace }}:/repo ghcr.io/nicklockwood/swiftformat:latest /repo --lint

macos:
name: Build and test on macos-latest
name: Test on macOS
runs-on: macos-latest
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest
- uses: actions/checkout@v3
- name: Build and test
run: swift test --parallel --enable-test-discovery

linux:
name: Test on Linux
runs-on: ubuntu-latest
steps:
- uses: swift-actions/setup-swift@v1
- uses: actions/checkout@v3
- name: Test
run: swift test
run: swift test --parallel --enable-code-coverage
- name: Get test coverage html
run: |
llvm-cov show \
$(swift build --show-bin-path)/GraphQLPackageTests.xctest \
--instr-profile $(swift build --show-bin-path)/codecov/default.profdata \
--ignore-filename-regex="\.build|Tests" \
--format html \
--output-dir=.test-coverage
- name: Upload test coverage html
uses: actions/upload-artifact@v3
with:
name: test-coverage-report
path: .test-coverage

# ubuntu-latest is ubuntu-22.04 currently. Swift versions older than 5.7 don't have builds for 22.04. https://www.swift.org/download/
ubuntu-old:
name: Build ${{ matrix.swift }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
backcompat-ubuntu-22_04:
name: Test Swift ${{ matrix.swift }} on Ubuntu 22.04
runs-on: ubuntu-22.04
strategy:
matrix:
os: [ubuntu-20.04]
swift: ["5.5", "5.6"]
swift: ["5.7", "5.8"]
steps:
- uses: swift-actions/setup-swift@v1
with:
swift-version: ${{ matrix.swift }}
- uses: actions/checkout@v3
- name: Test
run: swift test
run: swift test --parallel

ubuntu-latest:
name: Build ${{ matrix.swift }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
# Swift versions older than 5.7 don't have builds for 22.04. https://www.swift.org/download/
backcompat-ubuntu-20_04:
name: Test Swift ${{ matrix.swift }} on Ubuntu 20.04
runs-on: ubuntu-20.04
strategy:
matrix:
os: [ubuntu-latest]
swift: ["5.7", "5.8", "5.9"]
swift: ["5.5", "5.6"]
steps:
- uses: swift-actions/setup-swift@v1
with:
swift-version: ${{ matrix.swift }}
- uses: actions/checkout@v3
- name: Test
run: swift test
run: swift test --parallel
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
### SwiftPM ###
.build/
.swiftpm/

### CI Artifacts ###
/.test-coverage

0 comments on commit 3bf0b96

Please sign in to comment.