Skip to content

Commit 08c1e38

Browse files
committed
chore(ci): break setup into composite action, and add cargo-mutants
1 parent c7dadf8 commit 08c1e38

2 files changed

Lines changed: 69 additions & 37 deletions

File tree

.github/actions/setup/action.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Setup
2+
description: Setup for CI.
3+
4+
inputs:
5+
llvm-path:
6+
description: Path to install LLVM to.
7+
required: true
8+
llvm-version:
9+
description: Version of LLVM to install.
10+
required: true
11+
12+
runs:
13+
using: composite
14+
steps:
15+
- name: Install LLVM Dependencies
16+
shell: bash
17+
run: |
18+
sudo apt update
19+
wget http://security.ubuntu.com/ubuntu/pool/universe/n/ncurses/libtinfo5_6.3-2ubuntu0.1_amd64.deb
20+
sudo apt install ./libtinfo5_6.3-2ubuntu0.1_amd64.deb
21+
22+
- name: Install LLVM and Clang
23+
uses: KyleMayes/install-llvm-action@v2
24+
with:
25+
version: "${{ inputs.llvm-version }}"
26+
directory: "${{ inputs.llvm-path }}"
27+
28+
- name: Install rust
29+
shell: bash
30+
run: |
31+
rustup toolchain install stable --profile minimal --no-self-update
32+
33+
- uses: Swatinem/rust-cache@v2

.github/workflows/ci.yaml

Lines changed: 36 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
env:
1010
CARGO_TERM_COLOR: "always"
1111
LLVM_PATH: "${{ github.workspace }}/llvm"
12+
LLVM_VERSION: "18.1"
1213

1314
jobs:
1415
test:
@@ -17,29 +18,15 @@ jobs:
1718
steps:
1819
- uses: actions/checkout@v5
1920

20-
- name: Install LLVM Dependencies
21-
run: |
22-
sudo apt update
23-
wget http://security.ubuntu.com/ubuntu/pool/universe/n/ncurses/libtinfo5_6.3-2ubuntu0.1_amd64.deb
24-
sudo apt install ./libtinfo5_6.3-2ubuntu0.1_amd64.deb
25-
26-
- name: Install LLVM and Clang
27-
uses: KyleMayes/install-llvm-action@v2
21+
- uses: ./.github/actions/setup
2822
with:
29-
version: "18.1"
30-
directory: "${{ env.LLVM_PATH }}"
31-
32-
- name: Install rust
33-
run: |
34-
rustup toolchain install stable --profile minimal --no-self-update
23+
llvm-version: ${{ env.LLVM_VERSION }}
24+
llvm-path: ${{ env.LLVM_PATH }}
3525

36-
- name: Install cargo-llvm-cov
37-
uses: taiki-e/install-action@cargo-llvm-cov
38-
39-
- name: Install cargo-nextest
40-
uses: taiki-e/install-action@nextest
41-
42-
- uses: Swatinem/rust-cache@v2
26+
- name: Install cargo-llvm-cov and cargo-nextest
27+
uses: taiki-e/install-action@v2
28+
with:
29+
tool: cargo-llvm-cov,nextest
4330

4431
- name: Test with code coverage
4532
run: |
@@ -69,23 +56,10 @@ jobs:
6956
steps:
7057
- uses: actions/checkout@v5
7158

72-
- name: Install LLVM Dependencies
73-
run: |
74-
sudo apt update
75-
wget http://security.ubuntu.com/ubuntu/pool/universe/n/ncurses/libtinfo5_6.3-2ubuntu0.1_amd64.deb
76-
sudo apt install ./libtinfo5_6.3-2ubuntu0.1_amd64.deb
77-
78-
- name: Install LLVM and Clang
79-
uses: KyleMayes/install-llvm-action@v2
59+
- uses: ./.github/actions/setup
8060
with:
81-
version: "18.1"
82-
directory: "${{ env.LLVM_PATH }}"
83-
84-
- name: Install rust
85-
run: |
86-
rustup toolchain install stable --profile minimal --no-self-update
87-
88-
- uses: Swatinem/rust-cache@v2
61+
llvm-version: ${{ env.LLVM_VERSION }}
62+
llvm-path: ${{ env.LLVM_PATH }}
8963

9064
- name: Run clippy
9165
run: |
@@ -98,8 +72,33 @@ jobs:
9872

9973
steps:
10074
- uses: actions/checkout@v5
75+
10176
- uses: streetsidesoftware/cspell-action@v8
10277
with:
10378
incremental_files_only: false
10479

80+
cargo-mutants:
81+
runs-on: ubuntu-latest
82+
83+
steps:
84+
- uses: actions/checkout@v5
85+
86+
- uses: ./.github/actions/setup
87+
with:
88+
llvm-version: ${{ env.LLVM_VERSION }}
89+
llvm-path: ${{ env.LLVM_PATH }}
90+
91+
- name: Install cargo-mutants
92+
uses: taiki-e/install-action@v2
93+
with:
94+
tool: cargo-mutants
95+
96+
- run: cargo mutants -vV --in-place
97+
98+
- uses: actions/upload-artifact@v4
99+
if: always()
100+
with:
101+
name: mutants-out
102+
path: mutants.out
103+
105104
# spell-checker:ignore libtinfo,Swatinem

0 commit comments

Comments
 (0)