Skip to content

Removed some #[allow(...)] s (#97) #250

Removed some #[allow(...)] s (#97)

Removed some #[allow(...)] s (#97) #250

Workflow file for this run

name: Rust
# Contains checks:
# - That the code compiles
# - That the code complies with formatting
# - Lints (using clippy) to find errors
# - That crates that are published are publish-able
# - Testing
# - Standard Rust integration and unit tests
# - Fuzz tests
# - WASM edition works tests
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
CACHE_PATHS: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
jobs:
validity:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: actions/cache@v3
with:
path: ${{ env.CACHE_PATHS }}
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Check source is valid
run: cargo check --workspace
- name: Check binary
run: cargo check --bin ezno
extras:
runs-on: ubuntu-latest
needs: validity
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: actions/cache@v3
with:
path: ${{ env.CACHE_PATHS }}
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
src:
- 'src/**'
parser:
- 'parser/**'
checker:
- 'checker/**'
- uses: brndnmtthws/rust-action-cargo-binstall@v1
if: steps.changes.outputs.src == 'true'
with:
packages: wasm-bindgen-cli@0.2.87
- uses: denoland/setup-deno@v1
if: steps.changes.outputs.src == 'true'
with:
deno-version: v1.x
- uses: actions/setup-node@v3
if: steps.changes.outputs.src == 'true'
with:
node-version: 18
- name: Check WASM
if: steps.changes.outputs.src == 'true'
run: |
rustup target add wasm32-unknown-unknown
# Need to build to check that the JS builds
npm ci
npm run build
working-directory: src/js-cli-and-library
- name: Build and test WASM
if: steps.changes.outputs.src == 'true'
run: |
npm ci
npm run test
node ./dist/cli.cjs info
deno run -A ./dist/cli.mjs info
working-directory: src/js-cli-and-library
shell: bash
- name: Check parser without extras
if: steps.changes.outputs.parser == 'true'
run:
cargo check -p ezno-parser --no-default-features
- name: Check checker without default features
if: steps.changes.outputs.checker == 'true'
run:
cargo check -p ezno-checker --no-default-features
formating:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- name: Check Rust formatting with rustfmt
run: cargo fmt --all --check
- uses: brndnmtthws/rust-action-cargo-binstall@v1
with:
packages: taplo-cli
- name: Check TOML formatting with taplo
run: taplo fmt --check **/*/Cargo.toml
tests:
needs: validity
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: actions/cache@v3
with:
path: ${{ env.CACHE_PATHS }}
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
parser:
- 'parser/**'
checker:
- 'checker/**'
- name: Run parser tests
if: steps.changes.outputs.parser == 'true'
run: |
cargo test
# TODO test other big libraries
curl https://esm.sh/v128/react-dom@18.2.0/es2022/react-dom.mjs > react.js
cargo run -p ezno-parser --example parse react.js > /dev/null
cargo test -p ezno-ast-generator
working-directory: parser
- name: Run checker specification
if: steps.changes.outputs.checker == 'true' && github.event_name != 'pull_request'
run: cargo test
working-directory: checker/specification
- name: Run checker specification (w/ staging)
if: steps.changes.outputs.checker == 'true' && github.event_name == 'pull_request'
run: cargo test -F staging
working-directory: checker/specification
env:
EZNO_DEBUG: 1
- name: Run checker tests
if: steps.changes.outputs.checker == 'true'
run: |
# Test checker with the parser features
cargo test -F ezno-parser
working-directory: checker
- name: Run base tests
run: cargo test
fuzzing:
needs: validity
runs-on: ubuntu-latest
timeout-minutes: 15
continue-on-error: true
strategy:
matrix:
fuzz-target: [module_roundtrip_naive, module_roundtrip_structured]
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: actions/cache@v3
with:
path: ${{ env.CACHE_PATHS }}
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
parser:
- 'parser/**'
- name: Install latest nightly and set it as default
if: steps.changes.outputs.parser == 'true'
run: |
rustup install nightly
rustup default nightly
- uses: brndnmtthws/rust-action-cargo-binstall@v1
if: steps.changes.outputs.parser == 'true'
with:
packages: cargo-fuzz
- name: Run fuzzing
if: steps.changes.outputs.parser == 'true'
run: |
cargo fuzz run -s none ${{ matrix.fuzz-target }} -- -timeout=10 -max_total_time=120 -use_value_profile=1
working-directory: parser/fuzz
clippy:
needs: validity
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: actions/cache@v3
with:
path: ${{ env.CACHE_PATHS }}
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Lint code with clippy
run: cargo clippy
publish-ability:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- name: Check that it will publish to crates
run: |
cargo metadata --offline --format-version 1 --no-deps | jq -r ".workspace_members[]" | while read -r _n _v pathInfo ; do
cd ${pathInfo:13:-1}
cargo publish --no-verify --dry-run
done
shell: bash