forked from adracea/rsubs-lib
-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (48 loc) · 1.33 KB
/
rust.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: CI
on:
push:
branches: [ "master" ]
paths-ignore:
- "/README.md"
- "/LICENSE"
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
outputs:
publish: ${{ steps.publish.outputs.publish }}
steps:
- uses: actions/checkout@v4
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- name: Do we publish?
id: publish
run: |
if (git show -- Cargo.toml | grep -q '+version') then echo 'publish=true';else echo 'publish=false'; fi >> $GITHUB_OUTPUT
test:
name: coverage
runs-on: ubuntu-latest
container:
image: xd009642/tarpaulin:develop-nightly
options: --security-opt seccomp=unconfined
steps:
- uses: actions/checkout@v4
- name: Generate code coverage
run: |
cargo +nightly tarpaulin --verbose --all-features --workspace --timeout 120 --out Xml
- name: Upload to codecov.io
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
token: ${{secrets.CODECOV_TOKEN}}
publish:
needs: build
if: ${{ needs.build.outputs.publish == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Publish
run: cargo publish --verbose --token ${{ secrets.CARGO_REGISTRY_TOKEN }}