Skip to content

Commit f472112

Browse files
Merge pull request #127 from NeedleInAJayStack/chore/code-coverage
Exports code coverage
2 parents 09b3c37 + 441ca4b commit f472112

File tree

2 files changed

+42
-25
lines changed

2 files changed

+42
-25
lines changed

.github/workflows/build.yml

Lines changed: 39 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,50 +23,64 @@ jobs:
2323
- name: Run format linting
2424
run: docker run --rm -v ${{ github.workspace }}:/repo ghcr.io/nicklockwood/swiftformat:latest /repo --lint
2525

26-
# Disabled until https://github.com/paulofaria/test-reporter is updated to Swift 5.4
2726
macos:
28-
name: Build and test on macOS
27+
name: Test on macOS
2928
runs-on: macOS-latest
3029
steps:
31-
- uses: actions/checkout@v2
32-
- name: Set code coverage path
33-
run: echo "codecov_path=$(swift test --show-codecov-path)" >> $GITHUB_ENV
34-
- name: Test and publish code coverage to Code Climate
35-
uses: paulofaria/codeclimate-action@master
36-
env:
37-
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
30+
- uses: maxim-lobanov/setup-xcode@v1
3831
with:
39-
downloadUrl: https://github.com/paulofaria/test-reporter/releases/download/0.9.0/test-reporter-0.9.0-darwin-amd64
40-
coverageCommand: swift test --enable-test-discovery --enable-code-coverage
41-
coverageLocations: ${{ env.codecov_path }}:lcov-json
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:
41+
- uses: swift-actions/setup-swift@v1
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)/GraphitiPackageTests.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
4258

43-
# 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/
44-
ubuntu-old:
45-
name: Build ${{ matrix.swift }} on ${{ matrix.os }}
46-
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
4762
strategy:
4863
matrix:
49-
os: [ubuntu-20.04]
50-
swift: ["5.4", "5.5", "5.6"]
64+
swift: ["5.7"]
5165
steps:
5266
- uses: swift-actions/setup-swift@v1
5367
with:
5468
swift-version: ${{ matrix.swift }}
5569
- uses: actions/checkout@v3
5670
- name: Test
57-
run: swift test
71+
run: swift test --parallel
5872

59-
ubuntu-latest:
60-
name: Build ${{ matrix.swift }} on ${{ matrix.os }}
61-
runs-on: ${{ matrix.os }}
73+
# Swift versions older than 5.7 don't have builds for ubuntu 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
6277
strategy:
6378
matrix:
64-
os: [ubuntu-latest]
65-
swift: ["5.7"]
79+
swift: ["5.4", "5.5", "5.6"]
6680
steps:
6781
- uses: swift-actions/setup-swift@v1
6882
with:
6983
swift-version: ${{ matrix.swift }}
7084
- uses: actions/checkout@v3
7185
- name: Test
72-
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)