name: Continuous Integration
on:
  push:
    branches: [ 2_0_X ]

jobs:
  snap:
    permissions:
      contents: read
    uses: ./.github/workflows/snap.yml
    with:
      deploy: true
    secrets: inherit

  matrix:
    uses: ./.github/workflows/matrix.yml
    with:
      publish: false
    secrets: inherit

  fuzzing:
    permissions:
      actions: read # to fetch the artifacts (google/oss-fuzz/infra/cifuzz/actions/run_fuzzers)
      contents: read # to clone the repo (google/oss-fuzz/infra/cifuzz/actions/run_fuzzers)

    runs-on: ubuntu-latest
    timeout-minutes: 20
    steps:
    - name: Build Fuzzers
      id: build
      uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@32f1d4deadc82279ec9001a837f2424e185c69a2 # master
      with:
        oss-fuzz-project-name: 'fwupd'
        dry-run: false
    - name: Run Fuzzers
      uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@32f1d4deadc82279ec9001a837f2424e185c69a2 # master
      with:
        oss-fuzz-project-name: 'fwupd'
        fuzz-seconds: 150
        dry-run: false
    - name: Upload Crash
      uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
      if: failure() && steps.build.outcome == 'success'
      with:
        name: artifacts
        path: ./out/artifacts

