Skip to content

Commit de6cba4

Browse files
authored
Update rust.yml
1 parent edcee8e commit de6cba4

File tree

1 file changed

+111
-0
lines changed

1 file changed

+111
-0
lines changed

.github/workflows/rust.yml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,114 @@ jobs:
2020
run: cargo build --verbose
2121
- name: Run tests
2222
run: cargo test --verbose
23+
24+
25+
26+
27+
28+
name: Rust CI
29+
30+
on:
31+
push:
32+
branches: [ main ]
33+
paths-ignore:
34+
- '**.md'
35+
pull_request:
36+
branches: [ main ]
37+
paths-ignore:
38+
- '**.md'
39+
40+
env:
41+
CARGO_TERM_COLOR: always
42+
RUST_TOOLCHAIN: nightly
43+
TOOLCHAIN_PROFILE: minimal
44+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
45+
46+
jobs:
47+
lints:
48+
name: Run cargo fmt and cargo clippy
49+
runs-on: ubuntu-latest
50+
steps:
51+
- name: Checkout sources
52+
uses: actions/checkout@v2
53+
- name: Install toolchain
54+
uses: actions-rs/toolchain@v1
55+
with:
56+
profile: ${{ env.TOOLCHAIN_PROFILE }}
57+
toolchain: ${{ env.RUST_TOOLCHAIN }}
58+
components: rustfmt, clippy
59+
override: true
60+
- name: Run cargo fmt
61+
uses: actions-rs/cargo@v1
62+
with:
63+
command: fmt
64+
args: --all -- --check
65+
- name: Run cargo clippy
66+
uses: actions-rs/cargo@v1
67+
with:
68+
command: clippy
69+
args: --all-features -- -D warnings
70+
build-linux:
71+
name: Build for linux using cargo
72+
runs-on: ubuntu-latest
73+
needs: [lints]
74+
steps:
75+
- name: Checkout sources
76+
uses: actions/checkout@v2
77+
- name: Install toolchain
78+
uses: actions-rs/toolchain@v1
79+
with:
80+
profile: ${{ env.TOOLCHAIN_PROFILE }}
81+
toolchain: ${{ env.RUST_TOOLCHAIN }}
82+
override: true
83+
- name: Run Build for Linux
84+
uses: actions-rs/cargo@v1
85+
with:
86+
command: build
87+
args: --verbose --target x86_64-unknown-linux-gnu
88+
test:
89+
name: Run cargo test
90+
runs-on: ubuntu-latest
91+
needs: [build-linux, build-windows]
92+
steps:
93+
- name: Checkout sources
94+
uses: actions/checkout@v2
95+
- name: Install toolchain
96+
uses: actions-rs/toolchain@v1
97+
with:
98+
profile: ${{ env.TOOLCHAIN_PROFILE }}
99+
toolchain: ${{ env.RUST_TOOLCHAIN }}
100+
override: true
101+
- name: Run cargo test -no-run
102+
uses: actions-rs/cargo@v1
103+
with:
104+
command: test
105+
args: --no-run --verbose
106+
- name: Run cargo test
107+
uses: actions-rs/cargo@v1
108+
with:
109+
command: test
110+
args: --verbose
111+
coverage:
112+
name: Attempt to generate code coverage
113+
runs-on: ubuntu-latest
114+
needs: [test]
115+
steps:
116+
- name: Checkout sources
117+
uses: actions/checkout@v2
118+
- name: Install toolchain
119+
uses: actions-rs/toolchain@v1
120+
with:
121+
profile: ${{ env.TOOLCHAIN_PROFILE }}
122+
toolchain: ${{ env.RUST_TOOLCHAIN }}
123+
components: llvm-tools-preview
124+
override: true
125+
- name: Generate coverage
126+
# runs cargo with defaults flags, using the default `lcov` output
127+
uses: Swatinem/fucov@v1
128+
- name: Upload coverage
129+
uses: codecov/codecov-action@v1
130+
env:
131+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
132+
with:
133+
directory: coverage

0 commit comments

Comments
 (0)