chore: add CI checking for node ffi (#487) #787
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: QACI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
- develop | |
env: | |
CARGO_TERM_COLOR: always | |
WASM_BINDGEN_TEST_TIMEOUT: 120 | |
jobs: | |
build_wasm: | |
name: Build and test for wasm | |
timeout-minutes: 10 | |
strategy: | |
matrix: | |
os: ["ubuntu-latest"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup rust toolchain | |
run: rustup show | |
- uses: jetli/[email protected] | |
with: | |
version: "0.2.87" | |
# If you need to reset the cache version, increment the number after `v` | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
shared-key: wasm-v1 | |
- name: Run clippy for core wasm | |
run: cargo clippy -p rings-core --features wasm --no-deps --no-default-features --target=wasm32-unknown-unknown --tests -- -D warnings | |
- name: Run clippy for node browser | |
run: cargo clippy -p rings-node --features browser --no-deps --no-default-features --target=wasm32-unknown-unknown --tests -- -D warnings | |
- name: Install wasm-pack | |
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh | |
- name: Run core browser tests | |
uses: coactions/setup-xvfb@v1 | |
with: | |
run: cargo test -p rings-core --target=wasm32-unknown-unknown --features wasm --no-default-features | |
working-directory: ./ | |
- name: Run node browser tests | |
uses: coactions/setup-xvfb@v1 | |
with: | |
run: cargo test -p rings-node --target=wasm32-unknown-unknown --features browser --no-default-features | |
working-directory: ./ | |
build: | |
name: Build and test | |
timeout-minutes: 20 | |
strategy: | |
matrix: | |
os: ["ubuntu-latest"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup rust toolchain | |
run: rustup show | |
# If you need to reset the cache version, increment the number after `v` | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
shared-key: default-v1 | |
- name: Build | |
run: cargo build --all --verbose | |
- name: Run dummy tests | |
run: cargo test -p rings-core --features dummy --verbose | |
- name: Run tests | |
run: cargo test --all --verbose | |
build_ffi: | |
name: Build and test for ffi | |
timeout-minutes: 20 | |
strategy: | |
matrix: | |
os: ["ubuntu-latest", "macos-latest"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup rust toolchain | |
run: rustup show | |
# If you need to reset the cache version, increment the number after `v` | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
shared-key: ffi-${{ matrix.os }}-v1 | |
- name: Run clippy for node ffi | |
run: cargo clippy -p rings-node --features ffi | |
- name: Build | |
run: cargo build -p rings-node --features ffi && ls target/include && ls target/debug | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Smoke test | |
run: pip install wheel && pip install web3 cffi && python examples/ffi/rings.py | |
rustfmt_and_clippy: | |
name: Check rustfmt style && run clippy | |
timeout-minutes: 10 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Check typos | |
uses: crate-ci/typos@master | |
- name: Setup rust toolchain | |
run: | | |
rustup install nightly | |
rustup component add rustfmt --toolchain nightly | |
rustup show | |
# If you need to reset the cache version, increment the number after `v` | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
shared-key: static-v1 | |
- name: Run clippy | |
run: cargo clippy --all --tests -- -D warnings | |
- name: Check formating | |
run: cargo +nightly fmt --all -- --check | |
- name: Install taplo | |
run: cargo install taplo-cli --locked | |
- name: Check toml file formating by taplo | |
run: taplo format --check |