Skip to content

Commit 3bf0b96

Browse files
Merge pull request #132 from NeedleInAJayStack/chore/code-coverage
2 parents 3f01aa5 + 6f77149 commit 3bf0b96

File tree

2 files changed

+41
-16
lines changed

2 files changed

+41
-16
lines changed

.github/workflows/build.yml

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111

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

2626
macos:
27-
name: Build and test on macos-latest
27+
name: Test on macOS
2828
runs-on: macos-latest
2929
steps:
30+
- uses: maxim-lobanov/setup-xcode@v1
31+
with:
32+
xcode-version: latest
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:
3041
- uses: swift-actions/setup-swift@v1
3142
- uses: actions/checkout@v3
3243
- name: Test
33-
run: swift 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)/GraphQLPackageTests.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
3458

35-
# 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/
36-
ubuntu-old:
37-
name: Build ${{ matrix.swift }} on ${{ matrix.os }}
38-
runs-on: ${{ matrix.os }}
59+
backcompat-ubuntu-22_04:
60+
name: Test Swift ${{ matrix.swift }} on Ubuntu 22.04
61+
runs-on: ubuntu-22.04
3962
strategy:
4063
matrix:
41-
os: [ubuntu-20.04]
42-
swift: ["5.5", "5.6"]
64+
swift: ["5.7", "5.8"]
4365
steps:
4466
- uses: swift-actions/setup-swift@v1
4567
with:
4668
swift-version: ${{ matrix.swift }}
4769
- uses: actions/checkout@v3
4870
- name: Test
49-
run: swift test
71+
run: swift test --parallel
5072

51-
ubuntu-latest:
52-
name: Build ${{ matrix.swift }} on ${{ matrix.os }}
53-
runs-on: ${{ matrix.os }}
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
5477
strategy:
5578
matrix:
56-
os: [ubuntu-latest]
57-
swift: ["5.7", "5.8", "5.9"]
79+
swift: ["5.5", "5.6"]
5880
steps:
5981
- uses: swift-actions/setup-swift@v1
6082
with:
6183
swift-version: ${{ matrix.swift }}
6284
- uses: actions/checkout@v3
6385
- name: Test
64-
run: swift test
86+
run: swift test --parallel

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@
33
### SwiftPM ###
44
.build/
55
.swiftpm/
6+
7+
### CI Artifacts ###
8+
/.test-coverage

0 commit comments

Comments
 (0)