-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (96 loc) · 2.98 KB
/
Copy pathci.yml
File metadata and controls
119 lines (96 loc) · 2.98 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: CI
on:
push:
branches: [main]
paths-ignore: ['**.md', 'docs/**', 'LICENSE', '.gitignore']
pull_request:
branches: [main]
paths-ignore: ['**.md', 'docs/**']
workflow_dispatch:
concurrency:
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-ci
cancel-in-progress: true
permissions:
contents: read
jobs:
check:
name: clippy + fmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
- name: Clippy
run: cargo clippy -- -W clippy::all
- name: Format check
run: cargo fmt -- --check
test:
name: test (${{ matrix.target }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
cross: true
- target: x86_64-apple-darwin
os: macos-latest
- target: aarch64-apple-darwin
os: macos-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Install cross
if: matrix.cross
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Test (native)
if: ${{ !matrix.cross }}
run: cargo test --target ${{ matrix.target }}
- name: Test (cross)
if: matrix.cross
# Only run unit tests under QEMU — integration tests need real PTY
# timing that doesn't work under emulation.
run: cross test --target ${{ matrix.target }} --bin hm
- name: Build release
if: ${{ !matrix.cross }}
run: cargo build --release --target ${{ matrix.target }}
- name: Build release (cross)
if: matrix.cross
run: cross build --release --target ${{ matrix.target }}
coverage:
name: coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- uses: Swatinem/rust-cache@v2
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Install uv
uses: astral-sh/setup-uv@v6
- name: Generate coverage
run: |
source <(cargo llvm-cov show-env --sh)
cargo llvm-cov clean --workspace
cargo build
cargo test
HM_BIN="$PWD/target/debug/hm" uv run pytest tests/ -v
cargo llvm-cov report --lcov --output-path lcov.info
- name: Upload to Codecov
uses: codecov/codecov-action@v5
with:
files: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false