name: CI-integ-test

on:
  workflow_dispatch:
  pull_request:
  push:
    branches:
    - 'main'
    - 'release/**'
    - 'dev/**' # Allow running tests on dev branches without a PR
    paths-ignore:
    - 'dist/**'

permissions:
  contents: read

jobs:
  build-distribution:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout sources
      uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
    - name: Build and upload distribution
      if: ${{ needs.determine-suite.outputs.suite != 'full' }}
      uses: ./.github/actions/build-dist

  caching-integ-tests:
    needs: build-distribution
    uses: ./.github/workflows/suite-integ-test-caching.yml
    concurrency:
      group: CI-integ-test-caching
      cancel-in-progress: false
    with:
      skip-dist: false
    secrets: inherit

  other-integ-tests:
    permissions:
      contents: write
    needs: caching-integ-tests
    uses: ./.github/workflows/suite-integ-test-other.yml
    concurrency:
      group: CI-integ-test-other
      cancel-in-progress: false
    with:
      skip-dist: false
    secrets: inherit

  dependency-submission-integ-tests:
    permissions:
      contents: write
    needs: other-integ-tests
    uses: ./.github/workflows/suite-integ-test-dependency-submission.yml
    concurrency:
      group: CI-integ-test-dependency-submission
      cancel-in-progress: false
    with:
      skip-dist: false
    secrets: inherit
