Added filter iterator. #245
This file contains hidden or 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: Cargo Build & Test | |
| on: [push, pull_request] | |
| jobs: | |
| build_and_test: | |
| name: Rust Formatting & Tests (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| toolchain: [stable] # beta, nightly | |
| os: [ubuntu-latest, macos-latest] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt, clippy | |
| targets: wasm32-unknown-unknown | |
| - name: Set up Rust cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: ${{ runner.os }}-cargo | |
| - name: Check formatting | |
| if: runner.os != 'macOS' | |
| run: cargo fmt --check | |
| - name: Run Clippy (Linting) | |
| if: runner.os != 'macOS' | |
| run: cargo clippy -- -D warnings | |
| - name: Build | |
| run: cargo build | |
| - name: Install cargo-nextest | |
| uses: baptiste0928/cargo-install@v3 | |
| with: | |
| crate: cargo-nextest | |
| locked: true | |
| - name: Run local tests | |
| run: cargo nextest run | |
| - name: Install wasm-pack | |
| run: cargo install wasm-pack | |
| - name: Run WASM tests (Chrome and Firefox) | |
| if: runner.os != 'macOS' | |
| run: WASM_BINDGEN_USE_BROWSER=1 wasm-pack test --chrome --firefox --headless --test language --lib | |
| - name: Run WASM tests (Safari) | |
| if: runner.os == 'macOS' | |
| run: WASM_BINDGEN_USE_BROWSER=1 wasm-pack test --safari --headless --test language --lib | |
| build_site: | |
| name: Build and upload playground and book | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| lfs: true | |
| - name: Set up Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: wasm32-unknown-unknown | |
| - name: Set up Rust cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: ${{ runner.os }}-cargo | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: lts/* | |
| - name: Build Playground | |
| working-directory: playground | |
| run: make build | |
| - name: Install mdBook | |
| run: | | |
| mkdir -p $HOME/mdbook | |
| curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.5.2/mdbook-v0.5.2-x86_64-unknown-linux-musl.tar.gz | tar -xz --directory=$HOME/mdbook | |
| echo "$HOME/mdbook" >> $GITHUB_PATH | |
| - name: Build Book | |
| run: mdbook build docs/book/en | |
| - name: Prepare site directory | |
| run: | | |
| mkdir -p site | |
| mv playground/dist site/playground | |
| mv docs/book/en/book site/book | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: site | |
| validate_lezer_grammar: | |
| name: Validate Lezer grammar | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: playground | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: lts/* | |
| - name: Install npm dependencies | |
| run: make install-npm-deps | |
| - name: Validate Lezer grammar | |
| run: make validate-grammar | |
| deploy_pages: | |
| name: Deploy playground and book to GitHub Pages | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| permissions: | |
| pages: write | |
| id-token: write | |
| runs-on: ubuntu-latest | |
| needs: build_site | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |