-
Notifications
You must be signed in to change notification settings - Fork 0
240 lines (240 loc) · 8 KB
/
ci.yml
File metadata and controls
240 lines (240 loc) · 8 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
---
name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
version-check:
name: Version consistency
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Check version sync
run: python scripts/version_sync.py --check
rust:
name: Rust (fmt, clippy, test)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: Check formatting
run: cargo fmt --all --check
- name: Run clippy
run: cargo clippy --workspace --exclude iscc-rb --all-targets -- -D warnings
- name: Clippy iscc-lib (no default features)
run: cargo clippy -p iscc-lib --no-default-features -- -D warnings
- name: Clippy iscc-lib (all features)
run: cargo clippy -p iscc-lib --all-features -- -D warnings
- name: Run tests
run: cargo test --workspace --exclude iscc-rb
- name: Test iscc-lib (no default features)
run: cargo test -p iscc-lib --no-default-features
- name: Test iscc-lib (all features)
run: cargo test -p iscc-lib --all-features
- name: Test iscc-lib (text-processing only)
run: cargo test -p iscc-lib --no-default-features --features text-processing
python-test:
name: Python ${{ matrix.python-version }} (ruff, pytest)
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.14']
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- uses: astral-sh/setup-uv@v4
- name: Install dev dependencies
run: uv sync --group dev
- name: Build Python bindings
run: uv run maturin develop --manifest-path crates/iscc-py/Cargo.toml
- name: Run ruff check
run: uv run ruff check
- name: Run ruff format check
run: uv run ruff format --check
- name: Run pytest
run: uv run pytest
python:
name: Python (ruff, pytest)
if: always()
needs: python-test
runs-on: ubuntu-latest
steps:
- name: Verify all Python versions passed
run: test "${{ needs.python-test.result }}" = "success"
nodejs:
name: Node.js (napi build, test)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install npm dependencies
run: npm install
working-directory: crates/iscc-napi
- name: Build native addon
run: npx napi build --platform
working-directory: crates/iscc-napi
- name: Run tests
run: npm test
working-directory: crates/iscc-napi
wasm:
name: WASM (wasm-pack test)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Run tests
run: wasm-pack test --node crates/iscc-wasm --features conformance
c-ffi:
name: C FFI (cbindgen, gcc, test)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Install cbindgen
run: cargo install cbindgen
- name: Build FFI crate
run: cargo build -p iscc-ffi
- name: Check C header freshness
run: |
cbindgen --config crates/iscc-ffi/cbindgen.toml --crate iscc-ffi --output crates/iscc-ffi/include/iscc.h
git diff --exit-code crates/iscc-ffi/include/iscc.h || \
(echo "::error::iscc.h is stale. Run: cbindgen --config crates/iscc-ffi/cbindgen.toml --crate iscc-ffi --output crates/iscc-ffi/include/iscc.h" && exit 1)
- name: Compile C test program
run: >
gcc -o test_iscc
crates/iscc-ffi/tests/test_iscc.c
-I crates/iscc-ffi/include
-L target/debug
-liscc_ffi
-lpthread -ldl -lm
- name: Run C test program
run: LD_LIBRARY_PATH=target/debug ./test_iscc
dotnet:
name: C# / .NET (dotnet build, test)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0'
- name: Build FFI native library
run: cargo build -p iscc-ffi
- name: Build .NET projects
run: dotnet build packages/dotnet/Iscc.Lib.Tests/Iscc.Lib.Tests.csproj
- name: Run .NET tests
run: >
dotnet test packages/dotnet/Iscc.Lib.Tests/
-e LD_LIBRARY_PATH=${{ github.workspace }}/target/debug
java:
name: Java (JNI build, mvn test)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'
- name: Build JNI native library
run: cargo build -p iscc-jni
- name: Run Maven tests
run: mvn test -f crates/iscc-jni/java/pom.xml
go:
name: Go (go test, go vet)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: packages/go/go.mod
- name: Run Go tests
run: CGO_ENABLED=0 go test -v -count=1 ./...
working-directory: packages/go
- name: Run Go vet
run: go vet ./...
working-directory: packages/go
ruby:
name: Ruby (magnus build, test)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- name: Install libclang-dev
run: sudo apt-get update && sudo apt-get install -y libclang-dev
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1'
working-directory: crates/iscc-rb
bundler-cache: true
- name: Run standardrb
run: bundle exec standardrb
working-directory: crates/iscc-rb
- name: Run clippy
run: cargo clippy -p iscc-rb -- -D warnings
- name: Compile native extension
run: bundle exec rake compile
working-directory: crates/iscc-rb
- name: Run tests
run: bundle exec rake test
working-directory: crates/iscc-rb
cpp:
name: C++ (cmake, ASAN, test)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Install cmake
run: sudo apt-get update && sudo apt-get install -y cmake
- name: Build FFI native library
run: cargo build -p iscc-ffi
- name: Configure CMake
run: >
cmake -B build -DCMAKE_BUILD_TYPE=Debug
-DFFI_LIB_DIR=../../target/debug -DSANITIZE_ADDRESS=ON
working-directory: packages/cpp
- name: Build C++ tests
run: cmake --build build
working-directory: packages/cpp
- name: Run C++ tests
run: LD_LIBRARY_PATH=../../target/debug ./build/tests/test_iscc
working-directory: packages/cpp
bench:
name: Bench (compile check)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Compile benchmarks
run: cargo bench --no-run