Skip to content

Commit 0747132

Browse files
committed
feat: improve CI
1 parent 3003279 commit 0747132

1 file changed

Lines changed: 42 additions & 47 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 42 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2,70 +2,60 @@ name: CI
22

33
on:
44
push:
5-
branches:
6-
- main
7-
- develop
8-
tags-ignore:
9-
- v*
5+
branches: [main, develop]
6+
tags-ignore: [v*]
107
pull_request:
11-
branches:
12-
- develop
8+
branches: [develop]
139

1410
jobs:
15-
lints:
11+
lint:
1612
name: Lints
1713
runs-on: ubuntu-latest
1814
steps:
1915
- name: Checkout repository
20-
uses: actions/checkout@v2
16+
uses: actions/checkout@v6
2117

22-
- name: Run cargo check
23-
uses: actions-rs/cargo@v1
18+
- name: Install Rust
19+
uses: actions-rust-lang/setup-rust-toolchain@v1
2420
with:
25-
command: check
21+
components: rustfmt, clippy
22+
rustflags: ""
2623

2724
- name: Run cargo fmt
28-
uses: actions-rs/cargo@v1
29-
with:
30-
command: fmt
31-
args: --all -- --check
25+
run: cargo fmt --all -- --check
26+
27+
- name: Run cargo check
28+
run: cargo check --all-targets --all-features
3229

3330
- name: Run cargo clippy
34-
uses: actions-rs/clippy-check@v1
35-
with:
36-
token: ${{ secrets.GITHUB_TOKEN }}
37-
args: --all-features
38-
name: Clippy Output
31+
run: cargo clippy --all-targets --all-features -- -D warnings
3932

4033
build:
4134
name: Build
42-
needs: [lints]
35+
needs: [lint]
4336
runs-on: ubuntu-latest
4437
steps:
4538
- name: Checkout repository
46-
uses: actions/checkout@v2
39+
uses: actions/checkout@v6
4740

48-
- name: Run cargo build
49-
uses: actions-rs/cargo@v1
41+
- name: Install Rust
42+
uses: actions-rust-lang/setup-rust-toolchain@v1
5043
with:
51-
command: build
52-
args: --all-features
44+
rustflags: ""
45+
46+
- name: Run cargo build
47+
run: cargo build --all-features
5348

5449
- name: Run cargo test
55-
uses: actions-rs/cargo@v1
56-
with:
57-
command: test
58-
args: --all-features
50+
run: cargo test --all-features
5951

6052
build-target:
6153
name: Build on ${{ matrix.os }} for ${{ matrix.target }} target
62-
needs: [lints]
54+
needs: [lint]
6355
runs-on: ${{ matrix.os }}
6456
strategy:
6557
fail-fast: true
6658
matrix:
67-
os: [macos-latest, windows-latest, ubuntu-latest]
68-
target: ['']
6959
include:
7060
- os: macos-latest
7161
target: x86_64-apple-darwin
@@ -95,27 +85,32 @@ jobs:
9585
target: armv7-linux-androideabi
9686
steps:
9787
- name: Checkout repository
98-
uses: actions/checkout@v2
88+
uses: actions/checkout@v6
9989

100-
- name: Run cargo build
101-
uses: actions-rs/cargo@v1
90+
- name: Install Rust
91+
uses: actions-rust-lang/setup-rust-toolchain@v1
10292
with:
103-
command: build
104-
args: --all-features
93+
target: ${{ matrix.target }}
94+
rustflags: ""
95+
96+
- name: Run cargo build
97+
run: cargo build --all-features --target ${{ matrix.target }}
10598

10699
- name: Run cargo test
107-
uses: actions-rs/cargo@v1
108-
with:
109-
command: test
110-
args: --all-features
100+
run: cargo test --all-features --target ${{ matrix.target }}
111101

112102
coverage:
113103
name: Code coverage
114104
needs: [build]
115105
runs-on: ubuntu-latest
116106
steps:
117107
- name: Checkout repository
118-
uses: actions/checkout@v2
108+
uses: actions/checkout@v6
109+
110+
- name: Install Rust
111+
uses: actions-rust-lang/setup-rust-toolchain@v1
112+
with:
113+
rustflags: ""
119114

120115
- name: Run cargo-tarpaulin
121116
uses: actions-rs/tarpaulin@v0.1
@@ -124,14 +119,14 @@ jobs:
124119
args: --all-features
125120

126121
- name: Upload to codecov.io
127-
uses: codecov/codecov-action@v3
122+
uses: codecov/codecov-action@v4
128123
with:
129-
token: ${{secrets.CODECOV_TOKEN}}
124+
token: ${{ secrets.CODECOV_TOKEN }}
130125
files: ./cobertura.xml
131126
fail_ci_if_error: true
132127

133128
- name: Archive code coverage results
134-
uses: actions/upload-artifact@v1
129+
uses: actions/upload-artifact@v4
135130
with:
136131
name: code-coverage-report
137132
path: cobertura.xml

0 commit comments

Comments
 (0)