-
Notifications
You must be signed in to change notification settings - Fork 22
145 lines (122 loc) · 4.04 KB
/
test.yaml
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
name: Test
on:
pull_request:
branches: [main]
paths-ignore:
- "examples/**"
- "README.md"
- "CONTRIBUTING.md"
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
WASI_SDK_VERSION: 20.46gf3a1f8991535
WASI_SDK_RELEASE: wasi-sockets-alpha-5
jobs:
linux:
name: Populate cache
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: "recursive"
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install latest Rust nightly toolchain
uses: dtolnay/rust-toolchain@nightly
with:
targets: wasm32-wasip1 wasm32-unknown-unknown
- name: Install latest Rust stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-wasip1 wasm32-unknown-unknown
components: clippy, rustfmt
- name: Install Rust std source
shell: bash
run: rustup component add rust-src --toolchain nightly
- uses: Swatinem/rust-cache@v2
with:
shared-key: "rust-cache-${{ hashFiles('./Cargo.lock') }}"
cache-on-failure: false
- name: Install WASI-SDK
shell: bash
run: |
cd /tmp
curl -LO https://github.com/dicej/wasi-sdk/releases/download/${WASI_SDK_RELEASE}/wasi-sdk-${WASI_SDK_VERSION}-linux.tar.gz
tar xf wasi-sdk-${WASI_SDK_VERSION}-linux.tar.gz
mv wasi-sdk-${WASI_SDK_VERSION} /opt/wasi-sdk
- name: Cache CPython
id: cache-cpython-wasi
uses: actions/cache@v4
with:
path: cpython/builddir/wasi
key: cpython-wasi
enableCrossOsArchive: true
- name: Build
shell: bash
run: cargo build --release
test:
name: Test
strategy:
fail-fast: false
matrix:
config:
- { os: "ubuntu-latest", wasiSDK: "linux" }
- { os: "macos-latest", wasiSDK: "macos" }
- { os: "windows-latest", wasiSDK: "mingw" }
runs-on: ${{ matrix.config.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Install latest Rust nightly toolchain
uses: dtolnay/rust-toolchain@nightly
with:
targets: wasm32-wasip1 wasm32-unknown-unknown
- name: Install latest Rust stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-wasip1 wasm32-unknown-unknown
components: clippy, rustfmt
- name: Install Rust std source
shell: bash
run: rustup component add rust-src --toolchain nightly
- uses: Swatinem/rust-cache@v2
with:
shared-key: "rust-cache-${{ hashFiles('./Cargo.lock') }}"
cache-on-failure: false
- name: Download WASI-SDK
shell: bash
run: |
cd /tmp
curl -LO https://github.com/dicej/wasi-sdk/releases/download/${WASI_SDK_RELEASE}/wasi-sdk-${WASI_SDK_VERSION}-${{ matrix.config.wasiSDK }}.tar.gz
tar xf wasi-sdk-${WASI_SDK_VERSION}-${{ matrix.config.wasiSDK }}.tar.gz
- name: Install WASI-SDK
if: runner.os != 'Windows'
shell: bash
run: sudo mv /tmp/wasi-sdk-${WASI_SDK_VERSION} /opt/wasi-sdk
- name: Install WASI-SDK on Windows
if: runner.os == 'Windows'
shell: bash
run: echo "WASI_SDK_PATH=$(cygpath -m /tmp/wasi-sdk-${WASI_SDK_VERSION})" >> ${GITHUB_ENV}
- name: Restore CPython
id: cache-cpython-wasi
uses: actions/cache/restore@v4
with:
path: cpython/builddir/wasi
key: cpython-wasi
enableCrossOsArchive: true
- name: Lint
shell: bash
run: bash .github/workflows/lint.sh
- uses: taiki-e/install-action@v2
with:
tool: wasmtime-cli
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Test
shell: bash
run: COMPONENTIZE_PY_TEST_COUNT=20 PROPTEST_MAX_SHRINK_ITERS=0 cargo test --release