-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (48 loc) · 1.53 KB
/
tests.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
52
name: Tests
on: [push]
jobs:
test:
# See https://github.com/mozilla/grcov#example-how-to-generate-source-based-coverage-for-a-rust-project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.cargo
key: ${{ runner.os }}
- name: Install grcov
run: cargo install grcov
- name: Install llvm-tools-preview
run: rustup component add llvm-tools-preview
- name: Build
run: cargo build --verbose
env:
RUSTFLAGS: "-Cinstrument-coverage"
- name: Run tests
run: cargo test --verbose
env:
RUSTFLAGS: "-Cinstrument-coverage"
LLVM_PROFILE_FILE: "%p-%m.profraw"
- name: Compute coverage
run: grcov . --binary-path ./target/debug/ --source-dir . --output-path lcov.info --output-type lcov --branch --ignore-not-existing
- uses: codecov/codecov-action@v3
docker:
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dioptra-io/publish-docker-action@v1
with:
password: ${{ secrets.GITHUB_TOKEN }}
platforms: linux/amd64,linux/arm64
push: ${{ github.actor != 'dependabot[bot]' }}
publish:
runs-on: ubuntu-latest
needs: [test]
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
steps:
- uses: actions/checkout@v3
- name: Publish package
run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}