-
Notifications
You must be signed in to change notification settings - Fork 1
76 lines (66 loc) · 1.97 KB
/
Copy pathci.yml
File metadata and controls
76 lines (66 loc) · 1.97 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
name: CI
on:
push:
branches: [main, master]
tags: ['v*']
pull_request:
branches: [main, master]
jobs:
# Run on all PRs and pushes
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup component add rustfmt
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --check
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup component add clippy
- uses: Swatinem/rust-cache@v2
- run: cargo clippy --all-targets -- -D warnings
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- name: Install cargo-tarpaulin
run: cargo install cargo-tarpaulin
- name: Run tests with coverage
run: cargo tarpaulin --all-targets --out Xml --output-dir cobertura
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: ./cobertura/cobertura.xml
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
# Build and package only on release tags
release-build:
needs: [fmt, clippy, test]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- name: Install cargo-deb
run: cargo install cargo-deb
- name: Build release binary
run: cargo build --release
- name: Build .deb package
run: cargo deb --no-build
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: baco-deb-package
path: target/debian/*.deb
- name: Upload release assets
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
files: |
target/debian/*.deb
target/release/baco
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}