---
name: Rust
on:
push:
branches: [ "main" ]
paths:
- 'Cargo.toml'
- 'Cargo.lock'
- 'src/**'
- 'pddl/**'
- 'pddl-lsp/**'
- 'pddl-macros/**'
- 'pddl-nova-tests/**'
- 'pddl-runtime/**'
- 'pddl-bench/**'
- 'pddl-codegen/**'
- 'pddl-validate/**'
- 'schema/**'
- 'editors/vscode/**'
- '.github/workflows/rust.yml'
pull_request:
branches: [ "main" ]
paths:
- 'Cargo.toml'
- 'Cargo.lock'
- 'src/**'
- 'pddl/**'
- 'pddl-lsp/**'
- 'pddl-macros/**'
- 'pddl-nova-tests/**'
- 'pddl-runtime/**'
- 'pddl-bench/**'
- 'pddl-codegen/**'
- 'pddl-validate/**'
- 'schema/**'
- 'editors/vscode/**'
- '.github/workflows/rust.yml'
env:
CARGO_TERM_COLOR: always
permissions: {}
jobs:
clippy:
name: Clippy
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- name: Install Rust
run: |
rustup toolchain install stable --profile minimal --component clippy --no-self-update
rustup default stable
- name: Run clippy
run: cargo clippy --workspace --all-features --tests -- -D warnings
msrv:
name: MSRV
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- name: Install Rust
run: |
rustup toolchain install 1.86.0 --profile minimal --no-self-update
rustup default 1.86.0
- name: Build with MSRV
run: |
cargo build --workspace --all-features --exclude pddl --exclude pddl-macros --exclude pddl-nova-tests --exclude pddl-bench
cargo build -p pddl --features miette,pretty,serde
- name: Test with MSRV
run: |
cargo test -p pddl-core --all-features
cargo test -p pddl-runtime --all-features
cargo test -p pddl-validate --all-features
cargo test -p pddl-codegen
cargo test -p pddl-lsp --all-features
cargo test -p pddl --features miette,pretty,serde
- name: Install Rust 1.88 for pddl-macros
run: rustup toolchain install 1.88.0 --profile minimal --no-self-update
- name: Test pddl-macros with its MSRV
run: |
cargo +1.88.0 test -p pddl-macros --lib --test macros
cargo +1.88.0 test -p pddl --all-features
build:
name: Build and Test
runs-on: ${{ matrix.os }}
permissions:
contents: read
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- name: Check format
run: cargo fmt --check
- name: Build
run: cargo build --workspace --verbose
- uses: taiki-e/install-action@ab49d3c64680143e184118bed66a46419fc15519 with:
tool: nextest
- name: Run tests
run: cargo nextest run --workspace --verbose --all-features
- name: Run doctests
run: cargo test --workspace --doc --verbose --all-features
- name: Test without default features
run: cargo test --no-default-features
- name: Test with only the pretty feature
run: cargo test --no-default-features --features pretty
- name: Test with only the parser feature
run: cargo test --no-default-features --features parser
vscode:
name: VS Code Extension
runs-on: ubuntu-latest
permissions:
contents: read
defaults:
run:
working-directory: editors/vscode
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 with:
node-version: 22
- name: Install Rust
run: |
rustup toolchain install stable --profile minimal --target wasm32-wasip1 --no-self-update
rustup default stable
- name: Build the server as WebAssembly
run: |
cargo build --release -p pddl-lsp --target wasm32-wasip1
mkdir -p server
cp ../../target/wasm32-wasip1/release/pddl-lsp.wasm server/
- name: Install dependencies
run: yarn install --frozen-lockfile --ignore-scripts
- name: Compile
run: yarn run compile
- name: Test in VS Code
run: xvfb-run -a yarn run test
- name: Install Chromium for the web test
run: yarn playwright install --with-deps chromium
- name: Test in VS Code for the Web
run: yarn run test:web
- name: Package
run: yarn run package
codecov:
name: Code Coverage
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- name: Build
run: cargo build --verbose
- name: Install Rust
run: |
rustup toolchain install stable --profile minimal --component llvm-tools-preview --no-self-update
rustup default stable
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@ab49d3c64680143e184118bed66a46419fc15519 with:
tool: cargo-llvm-cov
- name: Install nextest
uses: taiki-e/install-action@ab49d3c64680143e184118bed66a46419fc15519 with:
tool: nextest
- name: Generate code coverage
run: cargo llvm-cov nextest --all-features --workspace --lcov --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
fail_ci_if_error: true
dependencies:
name: Dependency Submission
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- name: Install Rust
run: |
rustup toolchain install stable --profile minimal --no-self-update
rustup default stable
- name: Cache Cargo artifacts
uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0
- name: Install cargo-sbom
uses: psastras/sbom-rs/actions/install-cargo-sbom@9ecc460b937ac5558c4f8ebebc9e07d2bdbef67b
- name: Generate SBOM
run: cargo-sbom --output-format=spdx_json_2_3 > sbom.json
- name: Upload SBOM as artifact
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 with:
name: sbom
path: sbom.json
- name: Submit dependencies to GitHub
uses: advanced-security/spdx-dependency-submission-action@b009efcf8b9d562a4569d2028c276522232e631f with:
filePath: sbom.json