-
Notifications
You must be signed in to change notification settings - Fork 157
112 lines (91 loc) · 3.06 KB
/
ci.yml
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
name: CI
on:
pull_request:
push: # required for actions/cache to work
branches:
- master
jobs:
ci:
strategy:
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
runs-on: ${{ matrix.os }}
env:
RUSTFLAGS: --deny warnings
steps:
- uses: actions/checkout@v4
- name: Cache
id: rust-cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml', '.github/workflows/*.yml') }}
- name: Check for forbidden words
if: runner.os != 'Windows'
run: "! grep --include='*.rs' -RE 'to_be_bytes|from_be_bytes|dbg!' ."
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Rust
if: steps.rust-cache.outputs.cache-hit != 'true'
run: |
rustup default nightly-2024-11-15
rustup component add rustfmt
rustup component add clippy
- name: OSX x86 rust
if: startsWith(matrix.os, 'macos')
run: |
# For some reason this is required to run the fuzzer on OSX
rustup target add x86_64-apple-darwin
- name: Setup wasmtime
uses: bytecodealliance/actions/wasmtime/setup@v1
with:
version: "24.0.0"
- name: Install cargo-deny
if: steps.rust-cache.outputs.cache-hit != 'true'
run: cargo install --force --version 0.16.2 cargo-deny --locked
- name: Install cargo-fuzz
if: steps.rust-cache.outputs.cache-hit != 'true'
run: cargo install --force --version 0.12.0 cargo-fuzz --locked
- name: Install just
if: steps.rust-cache.outputs.cache-hit != 'true'
run: cargo install --force --version 1.36.0 just --locked
- name: Compile
run: cargo build --all-targets --all-features
- name: Fuzzer
if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos')
run: just fuzz_ci
- name: Run tests
run: just build test
- name: Clippy
run: cargo clippy --all --all-targets -- -Dwarnings
- name: Format
run: cargo fmt --all -- --check
- name: Run CPython wrapper tests
if: runner.os != 'Windows'
run: |
python3 -m venv venv
source venv/bin/activate
pip3 install --upgrade pip
pip3 install maturin
just test_py
- name: Run CPython wrapper tests
if: runner.os == 'Windows'
run: |
python3 -m venv venv
venv\Scripts\activate
pip3 install --upgrade pip
pip3 install maturin
just test_py
- name: Run WASI tests
if: runner.os != 'Windows'
run: |
rustup toolchain install nightly
rustup target add wasm32-wasip1 --toolchain=nightly
RUSTFLAGS="" just test_wasi