I am good at Rust #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test | |
on: | |
push: | |
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: | |
test: | |
name: Test | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
- name: Patch CPython | |
working-directory: cpython | |
run: patch -p1 <../patches/enable-zlib.patch | |
- name: Install latest Rust stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
default: true | |
components: clippy, rustfmt | |
- name: Install latest Rust nightly toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
default: false | |
- name: Install Rust std source | |
shell: bash | |
run: rustup component add rust-src --toolchain nightly | |
- name: Install Wasm Rust targets | |
shell: bash | |
run: rustup target add wasm32-wasi wasm32-unknown-unknown | |
- 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: Checkout zlib | |
uses: actions/checkout@v4 | |
with: | |
repository: "madler/zlib" | |
ref: "0f51fb4933fc9ce18199cb2554dacea8033e7fd3" | |
path: "zlib/src" | |
- name: Build zlib | |
working-directory: zlib/src | |
run: | | |
./configure --static --prefix="/opt/wasi-zlib" | |
make | |
make install | |
env: | |
CHOST: "Linux" | |
CC: "/opt/wasi-sdk/bin/clang" | |
LDSHARED: "/opt/wasi-sdk/bin/clang" | |
CFLAGS: "-fPIC" | |
CXX: "/opt/wasi-sdk/bin/clang++" | |
LD: "/opt/wasi-sdk/bin/wasm-ld" | |
AR: "/opt/wasi-sdk/bin/ar" | |
RANLIB: "/opt/wasi-sdk/bin/ranlib" | |
- name: Cache CPython | |
id: cache-cpython-wasi | |
uses: actions/cache@v3 | |
with: | |
path: cpython/builddir/wasi | |
key: cpython-wasi | |
enableCrossOsArchive: true | |
- name: Lint | |
if: false | |
shell: bash | |
run: bash .github/workflows/lint.sh | |
- name: Test | |
shell: bash | |
run: COMPONENTIZE_PY_TEST_COUNT=20 PROPTEST_MAX_SHRINK_ITERS=0 cargo test --release |