Skip to content

Commit 441ca4b

Browse files
chore: Code coverage ignores .build and test files
1 parent 79f057f commit 441ca4b

File tree

1 file changed

+31
-32
lines changed

1 file changed

+31
-32
lines changed

.github/workflows/build.yml

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ 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
27+
name: Test on macOS
2828
runs-on: macOS-latest
2929
steps:
3030
- uses: maxim-lobanov/setup-xcode@v1
@@ -34,28 +34,33 @@ jobs:
3434
- name: Build and test
3535
run: swift test --parallel --enable-test-discovery
3636

37-
# Swift versions older than 5.7 don't have builds for ubuntu 22.04. https://www.swift.org/download/
38-
ubuntu-20_04:
39-
name: Build ${{ matrix.swift }} on ${{ matrix.os }}
40-
runs-on: ${{ matrix.os }}
41-
strategy:
42-
matrix:
43-
os: [ubuntu-20.04]
44-
swift: ["5.4", "5.5", "5.6"]
37+
linux:
38+
name: Test on Linux
39+
runs-on: ubuntu-latest
4540
steps:
4641
- uses: swift-actions/setup-swift@v1
47-
with:
48-
swift-version: ${{ matrix.swift }}
4942
- uses: actions/checkout@v3
5043
- name: Test
51-
run: swift test --parallel
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
5258

53-
ubuntu-22_04:
54-
name: Build ${{ matrix.swift }} on ${{ matrix.os }}
55-
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
5662
strategy:
5763
matrix:
58-
os: [ubuntu-22.04]
5964
swift: ["5.7"]
6065
steps:
6166
- uses: swift-actions/setup-swift@v1
@@ -65,23 +70,17 @@ jobs:
6570
- name: Test
6671
run: swift test --parallel
6772

68-
ubuntu-latest:
69-
name: Build latest on ubuntu
70-
runs-on: ubuntu-latest
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
77+
strategy:
78+
matrix:
79+
swift: ["5.4", "5.5", "5.6"]
7180
steps:
7281
- uses: swift-actions/setup-swift@v1
82+
with:
83+
swift-version: ${{ matrix.swift }}
7384
- uses: actions/checkout@v3
7485
- name: Test
75-
run: swift test --parallel --enable-code-coverage
76-
- name: Get test coverage html
77-
run: |
78-
llvm-cov show \
79-
$(swift build --show-bin-path)/GraphitiPackageTests.xctest \
80-
--instr-profile $(swift build --show-bin-path)/codecov/default.profdata \
81-
--format html \
82-
--output-dir=.test-coverage
83-
- name: Upload test coverage html
84-
uses: actions/upload-artifact@v3
85-
with:
86-
name: test-coverage-report
87-
path: .test-coverage
86+
run: swift test --parallel

0 commit comments

Comments
 (0)