-
-
Notifications
You must be signed in to change notification settings - Fork 73
63 lines (60 loc) · 2.05 KB
/
lib.yml
File metadata and controls
63 lines (60 loc) · 2.05 KB
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
53
54
55
56
57
58
59
60
61
62
63
name: Build, test, and publish coverage for svg2gcode
on:
push:
branches: [main]
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Get stable release date
id: stable-date
run: echo "date=$(curl -s https://static.rust-lang.org/dist/channel-rust-stable.toml | grep '^date' -m1 | cut -d'"' -f2)" >> $GITHUB_OUTPUT
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly-${{ steps.stable-date.outputs.date }}
components: rustfmt
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- name: Fmt
run: cargo +nightly-${{ steps.stable-date.outputs.date }} fmt --check -p svg2gcode
- name: Clippy
run: cargo clippy -p svg2gcode -- -D warnings
- name: Build
run: cargo build -p svg2gcode
- name: Test
run: cargo test -p svg2gcode
coverage:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: Swatinem/rust-cache@v2
with:
cache-all-crates: true
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
components: llvm-tools-preview
- run: cargo install grcov
- run: cargo build -p svg2gcode
env:
RUSTFLAGS: '-Cinstrument-coverage'
RUSTDOCFLAGS: '-Cinstrument-coverage'
LLVM_PROFILE_FILE: 'codecov-instrumentation-%p-%m.profraw'
- run: RUSTFLAGS='-Cinstrument-coverage' cargo test --all-features --no-fail-fast -p svg2gcode
env:
RUSTFLAGS: '-Cinstrument-coverage'
RUSTDOCFLAGS: '-Cinstrument-coverage'
LLVM_PROFILE_FILE: 'codecov-instrumentation-%p-%m.profraw'
- run: grcov . -s . --binary-path ./target/debug/ -t lcov --branch -o lcov.info
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}