Skip to content

Commit 1120143

Browse files
committed
Amalgamate CI workflow job for Ubuntu runner with others
1 parent fed6f91 commit 1120143

2 files changed

Lines changed: 29 additions & 31 deletions

File tree

.github/actions/codecov/action.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Code coverage
2+
description: Generate code coverage and upload to codecov
3+
inputs:
4+
token:
5+
description: Codecov token
6+
required: true
7+
8+
runs:
9+
using: composite
10+
steps:
11+
- name: Install cargo-llvm-cov
12+
shell: bash
13+
run: cargo install cargo-llvm-cov
14+
15+
- name: Generate code coverage
16+
shell: bash
17+
run: cargo llvm-cov --codecov --output-path codecov.json
18+
19+
- name: Upload to codecov.io
20+
uses: codecov/codecov-action@v5
21+
with:
22+
token: ${{ inputs.token }}
23+
fail_ci_if_error: true

.github/workflows/cargo-build-and-test.yml

Lines changed: 6 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,44 +9,14 @@ env:
99
CARGO_TERM_COLOR: always
1010

1111
jobs:
12-
coverage:
13-
name: Build and test with coverage
14-
runs-on: ubuntu-latest
15-
# Longer timeout because this job involves more steps
16-
timeout-minutes: 20
17-
env:
18-
# Make warnings fatal
19-
RUSTDOCFLAGS: -D warnings
20-
steps:
21-
- name: Checkout repository
22-
uses: actions/checkout@v4
23-
24-
- uses: actions-rust-lang/setup-rust-toolchain@v1
25-
with:
26-
toolchain: stable
27-
- run: cargo test --verbose
28-
29-
- name: Install cargo-llvm-cov
30-
run: cargo install cargo-llvm-cov
31-
32-
- name: Generate code coverage
33-
run: |
34-
cargo llvm-cov --codecov --output-path codecov.json
35-
36-
- name: Upload to codecov.io
37-
uses: codecov/codecov-action@v5
38-
with:
39-
token: ${{ secrets.CODECOV_TOKEN }}
40-
fail_ci_if_error: true
41-
4212
build_and_test:
4313
name: Build and test
4414
runs-on: ${{ matrix.os }}
4515
timeout-minutes: 15
4616
strategy:
4717
fail-fast: false
4818
matrix:
49-
os: [windows-latest, macos-latest]
19+
os: [ubuntu-latest, windows-latest, macos-latest]
5020
toolchain:
5121
- stable
5222
steps:
@@ -55,3 +25,8 @@ jobs:
5525
with:
5626
toolchain: ${{ matrix.toolchain }}
5727
- run: cargo test --verbose
28+
29+
- if: ${{ matrix.os == 'ubuntu-latest' }}
30+
uses: ./.github/actions/codecov
31+
with:
32+
token: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)