# CI for sysml-v2-parser: build, test, and SysML v2 validation suite
name: CI

on:
  push:
    branches: [main, master]
  pull_request:
    branches: [main, master]

jobs:
  test:
    name: Test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy

      - name: Cache cargo
        uses: Swatinem/rust-cache@v2

      - name: Fetch SysML v2 Release
        run: bash ./scripts/fetch-sysml-v2-release.sh

      - name: cargo test
        run: cargo test
        env:
          SYSML_V2_RELEASE_DIR: ${{ github.workspace }}/sysml-v2-release

      - name: cargo clippy
        run: cargo clippy -- -W clippy::all

  validation:
    name: SysML v2 validation suite
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable

      - name: Fetch SysML v2 Release
        run: |
          bash ./scripts/fetch-sysml-v2-release.sh

      - name: cargo test (full validation suite)
        run: cargo test -- --include-ignored
        env:
          SYSML_V2_RELEASE_DIR: ${{ github.workspace }}/sysml-v2-release
