-
-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (85 loc) · 2.48 KB
/
rust.yml
File metadata and controls
91 lines (85 loc) · 2.48 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: Rust
permissions:
contents: read
on:
push:
branches: [main]
paths:
- crates/**/*.rs
- crates/**/Cargo.toml
- .github/workflows/rust.yml
tags:
- 'rf24-rs/*'
- 'rf24ble-rs/*'
# - 'rf24network-rs/*'
# - 'rf24mesh-rs/*'
pull_request:
branches: [main]
paths:
- crates/**/*.rs
- crates/**/Cargo.toml
- .github/workflows/rust.yml
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
defaults:
run:
shell: bash
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Setup Rust
run: rustup update --no-self-update
- name: Install cargo-binstall
uses: cargo-bins/cargo-binstall@main
- name: Install cargo-llvm-cov and cargo-nextest
run: cargo binstall -y cargo-nextest cargo-llvm-cov
- name: Setup nushell
uses: hustcer/setup-nu@v3
with:
version: ${{ vars.NU_SHELL_VERSION || '*' }}
- name: Cache deps
uses: actions/cache@v4
with:
path: ~/.cargo
key: cargo-crates-${{ hashFiles('crates/*/src/**', 'crates/**/Cargo.toml') }}
- run: rustup component add llvm-tools-preview
# this enables a tool (for default toolchain) needed to measure code coverage.
- name: Run tests
run: nu -c "use nurfile *; nur test --profile ci"
- name: Generate coverage reports
run: nu -c "use nurfile *; nur test lcov"
- uses: codecov/codecov-action@v5
if: github.repository == 'nRF24/rf24-rs'
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
fail_ci_if_error: true
publish:
name: Publish
runs-on: ubuntu-latest
if: startswith(github.ref, 'refs/tags/')
permissions:
contents: write
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
- name: Setup nushell
uses: hustcer/setup-nu@v3
with:
version: ${{ vars.NU_SHELL_VERSION || '*' }}
- name: Get pkg from tag
id: pkg
shell: nu {0}
run: |-
let tag = ${{ github.ref_name }}
let pkg = $tag | parse "{name}/{version}" | first
$"name=($pkg | get name)\n" | save --append $env.GITHUB_OUTPUT
- name: Install Rust
run: rustup update stable --no-self-update
- run: cargo publish -p ${{ steps.pkg.outputs.name }}
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}