-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (77 loc) · 2.15 KB
/
rust.yml
File metadata and controls
96 lines (77 loc) · 2.15 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
92
93
94
95
96
name: Rust
on:
push:
branches:
- '**'
pull_request:
types: [closed]
branches:
- main
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Caching objects
id: cache-objects
uses: actions/cache@v4
with:
path: |
~/.cargo
${{ github.workspace }}/target
key: ${{ runner.os }}-rust-objects
- name: pre-commit
run: |
pip install pre-commit
pre-commit autoupdate --repo https://github.com/pre-commit/pre-commit-hooks
pre-commit run --all-files
- name: Build
run: cargo build
- name: Run tests
run: cargo test
- name: Code coverage
run: |
cargo install cargo-llvm-cov
# rustup component add llvm-tools-preview --toolchain stable-x86_64-unknown-linux-gnu
cargo llvm-cov
COVERAGE=$(cargo llvm-cov --json | jq -r '.data[0].totals.lines.percent')
if (( $(echo "$COVERAGE < 90" | bc -l) )); then
echo "❌ Code coverage is below 90% (Current: ${COVERAGE}%)"
exit 1
fi
# - name: Install Miri
# run: |
# rustup toolchain install nightly --component miri
# rustup override set nightly
# cargo miri setup
# - name: Test with Miri
# run: cargo miri test
release:
needs: build
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
steps:
- uses: actions/checkout@v4
- name: Caching objects
id: cache-objects
uses: actions/cache@v4
with:
path: |
~/.cargo
${{ github.workspace }}/target
key: ${{ runner.os }}-release-objects
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
- name: Install dependencies
run: npm ci
- name: Install cargo-release
run: cargo install cargo-release
- name: Semantic Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: npx semantic-release