Skip to content

Commit e6fd438

Browse files
committed
fix(ci): Codecov & use dtolnay/rust-toolchain
1 parent ba330da commit e6fd438

File tree

1 file changed

+37
-73
lines changed

1 file changed

+37
-73
lines changed

.github/workflows/ci.yml

+37-73
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ on:
44
push:
55
branches:
66
- main
7+
tags:
8+
- "v*"
79
pull_request:
810
branches:
911
- main
1012
schedule:
11-
- cron: '00 01 * * *'
13+
- cron: "00 01 * * *"
1214

1315
# Stops the running workflow of previous pushes
1416
concurrency:
@@ -30,25 +32,17 @@ jobs:
3032
steps:
3133
- uses: actions/checkout@v3
3234

35+
# use nightly for rustfmt & clippy checks
3336
- name: Install Rust nightly toolchain
34-
uses: actions-rs/toolchain@v1
37+
uses: dtolnay/rust-toolchain@nightly
3538
with:
36-
toolchain: nightly
37-
profile: default
38-
override: true
3939
components: rustfmt, clippy
4040

4141
- name: Rust format
42-
uses: actions-rs/cargo@v1
43-
with:
44-
command: fmt
45-
args: --check
42+
run: cargo fmt --check
4643

4744
- name: Clippy lints
48-
uses: actions-rs/cargo@v1
49-
with:
50-
command: clippy
51-
args: --no-deps -- -D warnings
45+
run: cargo clippy --no-deps -- -D warnings
5246
test:
5347
name: Test
5448

@@ -65,50 +59,26 @@ jobs:
6559
steps:
6660
- uses: actions/checkout@v3
6761

68-
# We need to disable the existing toolchain to avoid updating rust-docs
69-
# which takes a long time. The fastest way to do this is to rename the
70-
# existing folder, as deleting it takes about as much time as not doing
71-
# anything and just updating rust-docs.
72-
- name: Rename existing rust toolchain (Windows)
73-
if: matrix.os == 'windows-latest'
74-
run: Rename-Item C:\Users\runneradmin\.rustup\toolchains\stable-x86_64-pc-windows-msvc C:\Users\runneradmin\.rustup\toolchains\stable-x86_64-pc-windows-msvc.old
75-
7662
- name: Install Rust toolchain
77-
uses: actions-rs/toolchain@v1
63+
uses: dtolnay/rust-toolchain@stable
7864
with:
79-
toolchain: ${{ matrix.rust }}
80-
profile: minimal
81-
override: true
8265
components: rust-src
66+
toolchain: ${{ matrix.rust }}
8367

8468
- name: Build
85-
uses: actions-rs/cargo@v1
86-
with:
87-
command: build
69+
run: cargo build
8870

8971
- name: Test --no-default-features
90-
uses: actions-rs/cargo@v1
91-
with:
92-
command: test
93-
args: --no-default-features
72+
run: cargo test --no-default-features
9473

9574
- name: Test --all-features
96-
uses: actions-rs/cargo@v1
97-
with:
98-
command: test
99-
args: --all-features
75+
run: cargo test --all-features
10076

10177
- name: Test (Release)
102-
uses: actions-rs/cargo@v1
103-
with:
104-
command: test
105-
args: --release --no-default-features
106-
78+
run: cargo test --release --no-default-features
79+
10780
- name: Test (Release) all-features
108-
uses: actions-rs/cargo@v1
109-
with:
110-
command: test
111-
args: --release --all-features
81+
run: cargo test --release --all-features
11282

11383
# Detect cases where documentation links don't resolve and such.
11484
doc:
@@ -118,37 +88,31 @@ jobs:
11888
RUSTDOCFLAGS: "-D warnings"
11989
steps:
12090
- uses: actions/checkout@v3
121-
- uses: actions-rs/toolchain@v1
91+
# Docs.rs uses nightly, which allows for easier syntax for linking to functions.
92+
- uses: dtolnay/rust-toolchain@nightly
12293
with:
123-
profile: minimal
124-
# Docs.rs uses nightly, which allows for easier syntax for linking to functions.
125-
toolchain: nightly
126-
override: true
94+
components: rust-docs
12795

12896
- name: Docs --all-features
129-
uses: actions-rs/cargo@v1
130-
with:
131-
command: doc
132-
args: --all-features --no-deps
97+
run: cargo doc --all-features --no-deps
13398

13499
- name: Docs --no-default-features
135-
uses: actions-rs/cargo@v1
100+
run: cargo doc --no-default-features --no-deps
101+
codecov:
102+
name: Generate code coverage
103+
runs-on: ubuntu-latest
104+
container:
105+
image: xd009642/tarpaulin:develop-nightly
106+
options: --security-opt seccomp=unconfined
107+
steps:
108+
- name: Checkout repository
109+
uses: actions/checkout@v3
110+
111+
- name: Generate code coverage
112+
run: |
113+
cargo +nightly tarpaulin --verbose --all-features --workspace --timeout 120 --out Xml
114+
115+
- name: Upload to codecov.io
116+
uses: codecov/codecov-action@v2
136117
with:
137-
command: doc
138-
args: --no-default-features --no-deps
139-
140-
# codecov:
141-
# name: Generate code coverage
142-
# runs-on: ubuntu-latest
143-
# steps:
144-
# - uses: actions/checkout@v3
145-
# - uses: actions-rs/toolchain@v1
146-
# with:
147-
# toolchain: stable
148-
# override: true
149-
150-
# - name: Run cargo-tarpaulin
151-
# uses: actions-rs/tarpaulin@v0.1
152-
153-
# - name: Upload to codecov.io
154-
# uses: codecov/codecov-action@v1
118+
fail_ci_if_error: true

0 commit comments

Comments
 (0)