pddl-core 0.5.0

The types and the parser behind the pddl crate; depend on pddl instead
Documentation
---
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 # v7.0.1
        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 # v7.0.1
        with:
          persist-credentials: false
      - name: Install Rust
        run: |
          rustup toolchain install 1.86.0 --profile minimal --no-self-update
          rustup default 1.86.0
      # pddl-macros, and pddl's `macros` feature that pulls it in, need Rust 1.88.
      - 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
      # The NOVA tests are in pddl-nova-tests, because novafile needs Rust 1.90
      # and Cargo builds every dev-dependency for any test. They run on stable
      # in "Build and Test".
      - 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
      # `proc_macro::Span::local_file` and `line` are stable since 1.88. The
      # compile-fail tests are left out: their `.stderr` files follow stable rustc.
      - 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 # v7.0.1
        with:
          persist-credentials: false
      - name: Check format
        run: cargo fmt --check
      - name: Build
        run: cargo build --workspace --verbose
      - uses: taiki-e/install-action@ab49d3c64680143e184118bed66a46419fc15519 # v2.90.5
        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 # v7.0.1
        with:
          persist-credentials: false
      - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
        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 # v7.0.1
        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 # v2.90.5
        with:
          tool: cargo-llvm-cov
      - name: Install nextest
        uses: taiki-e/install-action@ab49d3c64680143e184118bed66a46419fc15519 # v2.90.5
        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 # v7.1.1
        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 # v7.0.1
        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 # v2.9.3

      - name: Install cargo-sbom
        uses: psastras/sbom-rs/actions/install-cargo-sbom@9ecc460b937ac5558c4f8ebebc9e07d2bdbef67b # cargo-sbom-v0.10.0

      - name: Generate SBOM
        run: cargo-sbom --output-format=spdx_json_2_3 > sbom.json

      - name: Upload SBOM as artifact
        uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
        with:
          name: sbom
          path: sbom.json

      - name: Submit dependencies to GitHub
        uses: advanced-security/spdx-dependency-submission-action@b009efcf8b9d562a4569d2028c276522232e631f # v0.4.0
        with:
          filePath: sbom.json