Add partial syntax, source maps, removed Keyword
from AST and other CLI fixes
#274
Workflow file for this run
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: 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 (works most of the time) | |
# - 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: [email protected] | |
- 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' | |
continue-on-error: 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' | |
continue-on-error: true | |
run: | |
cargo check -p ezno-parser --no-default-features | |
- name: Check parser generator | |
if: steps.changes.outputs.parser == 'true' | |
continue-on-error: true | |
run: | |
cargo test -p ezno-ast-generator | |
- name: Check checker without default features | |
if: steps.changes.outputs.checker == 'true' | |
continue-on-error: 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' | |
continue-on-error: true | |
run: | | |
cargo test | |
# TODO test other big libraries | |
curl https://esm.sh/v128/[email protected]/es2022/react-dom.mjs > react.js | |
cargo run -p ezno-parser --example parse react.js | |
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: | |
# TODO only need to do for `.toml` file changes | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
- name: Check that it will publish to crates.io | |
run: | | |
cargo metadata --offline --format-version 1 --no-deps | jq -r ".workspace_members[]" | while read -r _n _v pathInfo ; do | |
if ! grep -q "publish = false" "${pathInfo:13:-1}/Cargo.toml"; then | |
cd ${pathInfo:13:-1} | |
cargo publish --no-verify --dry-run | |
fi | |
done | |
shell: bash |