-
Notifications
You must be signed in to change notification settings - Fork 1
156 lines (129 loc) · 4.28 KB
/
Copy pathci.yml
File metadata and controls
156 lines (129 loc) · 4.28 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# Cache: 2025-09-03 02:13:59
name: CI
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
ci_test:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
rust: [stable]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
components: rustfmt, clippy, llvm-tools-preview
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: latest
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "pnpm"
cache-dependency-path: renamify-core/pnpm-lock.yaml
- name: Install renamify-core dependencies
run: |
cd renamify-core
pnpm install
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
- name: Check formatting
if: runner.os != 'Windows'
run: cargo fmt --all -- --check
- name: Check whitespace
if: runner.os != 'Windows'
run: ./scripts/check-whitespace.sh
- name: Run clippy
if: runner.os != 'Windows'
run: cargo clippy --all-targets --all-features
- name: Install cargo-llvm-cov
run: cargo install cargo-llvm-cov --version 0.6.15
- name: Run tests with coverage (summary)
run: cargo llvm-cov --workspace 2>&1 | tee coverage-output.txt
- name: Export LCOV
run: cargo llvm-cov report --lcov --output-path lcov-${{ matrix.os }}.info
- name: Check coverage meets minimum threshold
if: runner.os == 'Linux'
run: |
COVERAGE_THRESHOLD=90
if cargo llvm-cov report --fail-under-lines $COVERAGE_THRESHOLD; then
echo "✅ Code coverage meets the required threshold ($COVERAGE_THRESHOLD%)"
else
echo "❌ Code coverage is below the required threshold ($COVERAGE_THRESHOLD%)"
exit 1
fi
- name: Verify TypeScript bindings were generated
if: runner.os == 'Linux'
run: |
if [ ! -d "renamify-core/bindings" ] || [ -z "$(ls -A renamify-core/bindings/*.d.ts 2>/dev/null)" ]; then
echo "Error: TypeScript bindings were not generated"
exit 1
fi
echo "TypeScript bindings found:"
ls -la renamify-core/bindings/*.d.ts
- name: Upload TypeScript bindings
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: typescript-bindings
path: renamify-core/bindings/
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./lcov-${{ matrix.os }}.info
flags: ${{ runner.os }}
name: codecov-${{ matrix.os }}
fail_ci_if_error: false
- name: Build release binary
run: cargo build --release --verbose
- name: Upload release binary (Linux)
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: renamify-linux-x64
path: target/release/renamify
- name: Upload release binary (macOS)
if: runner.os == 'macOS'
uses: actions/upload-artifact@v4
with:
name: renamify-macos-x64
path: target/release/renamify
- name: Upload release binary (Windows)
if: runner.os == 'Windows'
uses: actions/upload-artifact@v4
with:
name: renamify-windows-x64
path: target/release/renamify.exe
ci_msrv:
name: Check MSRV
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust 1.80.1
uses: dtolnay/rust-toolchain@1.80.1
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
- name: Check MSRV
run: |
# Downgrade half package for MSRV compatibility
cargo update half@2.6.0 --precise 2.4.1 || true
cargo check --all-targets