name: Pre-deploy

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

# Cancel any in-flight jobs for the same PR/branch so there's only one active
# at a time
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  pd_users:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 2
      - name: Base
        run: bash misc/users/base/build.sh
      - name: Magnum Plugins
        if: ${{ always() && !cancelled() }}
        run: |
          bash misc/users/magnum-plugins/build.sh
          bash misc/users/magnum-plugins/run.sh

  pd_rust:
    uses: ufbx/ufbx-rust/.github/workflows/test.yml@main
    with:
      ufbx-rust-ref: main
      ufbx-ref: ${{ github.ref }}

  pd_documentation:
    uses: ufbx/ufbx.github.io/.github/workflows/test.yml@integration
    with:
      ufbx-documentation-ref: integration
      ufbx-rust-ref: main
      ufbx-ref: ${{ github.ref }}

  pd_picort:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Run picort
        run: python misc/run_tests.py picort --strict
