-
Notifications
You must be signed in to change notification settings - Fork 0
116 lines (109 loc) · 3.35 KB
/
lint-and-test.yml
File metadata and controls
116 lines (109 loc) · 3.35 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
name: Lint and Test
on:
push:
branches:
- '**'
jobs:
lint:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
# Default features (long, offline, batch, serde, json, build-binary)
- features: ""
name: "default"
# Special behavior-changing features
- features: "elgamal3"
name: "default+elgamal3"
- features: "legacy"
name: "default+legacy"
# Python bindings
- features: "python"
name: "default+python"
- features: "python,elgamal3"
name: "default+python+elgamal3"
# WASM bindings
- features: "wasm"
name: "default+wasm"
- features: "wasm,elgamal3"
name: "default+wasm+elgamal3"
name: cargo clippy (${{ matrix.name }})
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: Swatinem/rust-cache@v2
- run: cargo clippy --all-targets --features "${{ matrix.features }}" -- -D warnings
fmt:
runs-on: ubuntu-latest
name: cargo fmt
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo fmt -- --check
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
# Default features
- features: ""
name: "default"
# Special behavior-changing features
- features: "elgamal3"
name: "default+elgamal3"
- features: "legacy"
name: "default+legacy"
# Python bindings
- features: "python"
name: "default+python"
- features: "python,elgamal3"
name: "default+python+elgamal3"
# WASM bindings
- features: "wasm"
name: "default+wasm"
- features: "wasm,elgamal3"
name: "default+wasm+elgamal3"
name: cargo test (${{ matrix.name }})
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: Swatinem/rust-cache@v2
- run: cargo test --features "${{ matrix.features }}"
- run: cargo doc --no-deps --features "${{ matrix.features }}"
test-python:
runs-on: ubuntu-latest
name: test python bindings
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: Swatinem/rust-cache@v2
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Create virtual environment
run: python -m venv .venv
- name: Install dependencies and build Python extension
run: |
source .venv/bin/activate
pip install maturin pytest
maturin develop --features python
- name: Run Python tests
run: |
source .venv/bin/activate
python -m unittest discover tests/python/ -v
test-wasm:
runs-on: ubuntu-latest
name: test wasm bindings
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: Swatinem/rust-cache@v2
- uses: actions/setup-node@v4
with:
node-version: '20.x'
- run: cargo install wasm-pack
- run: npm install
- name: Build and test WASM package
run: npm test