From c14cd93f5900421bdf5f733b8d477db2fda46cf6 Mon Sep 17 00:00:00 2001 From: Roberto Cella Date: Thu, 20 Aug 2026 18:13:15 +0200 Subject: [PATCH 1/6] Refactor test workflow to run only on linux --- .github/actions/setup-ffmpeg/action.yml | 69 ------------------------- .github/workflows/unit-test.yml | 31 +++++------ 2 files changed, 14 insertions(+), 86 deletions(-) delete mode 100644 .github/actions/setup-ffmpeg/action.yml diff --git a/.github/actions/setup-ffmpeg/action.yml b/.github/actions/setup-ffmpeg/action.yml deleted file mode 100644 index 7a6c5d0f..00000000 --- a/.github/actions/setup-ffmpeg/action.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: Setup FFmpeg and FFprobe -description: Install FFmpeg and FFprobe across Linux, macOS, and Windows -inputs: - ffmpeg-version: - description: FFmpeg version to install - required: true -runs: - using: composite - steps: - - name: Install FFmpeg and FFprobe - shell: bash - run: | - set -euo pipefail - - FF_VERSION="${{ inputs.ffmpeg-version }}" - INSTALL_DIR="$HOME/ffmpeg" - mkdir -p "$INSTALL_DIR" - - echo "Installing FFmpeg and FFprobe $FF_VERSION on ${{ runner.os }}" - - download_binary() { - local url="$1" - local binary_name="${2:-FFmpeg}" - local output_file="$(echo "$binary_name" | tr '[:upper:]' '[:lower:]').zip" - - if curl -sS -f -L --retry 3 --retry-delay 8 --retry-all-errors "$url" -o "$output_file"; then - echo "Downloaded $binary_name from $url" - unzip -q "$output_file" - rm -f "$output_file" - else - echo "Failed to download $binary_name from $url" - return 1 - fi - } - - if [[ "${{ runner.os }}" == "Linux" ]]; then - docker pull mwader/static-ffmpeg:$FF_VERSION - CID=$(docker create mwader/static-ffmpeg:$FF_VERSION) - docker cp "$CID:/ffmpeg" "$INSTALL_DIR/ffmpeg" - docker cp "$CID:/ffprobe" "$INSTALL_DIR/ffprobe" - docker rm "$CID" - chmod +x "$INSTALL_DIR/"* - - elif [[ "${{ runner.os }}" == "macOS" ]]; then - major=$(echo "$FF_VERSION" | cut -d. -f1) - minor=$(echo "$FF_VERSION" | cut -d. -f2 | sed 's/^0*//') - FF_VERSION="${major}${minor}" - if [[ -z "$minor" ]]; then - FF_VERSION="$major" - fi - - download_binary "https://www.osxexperts.net/ffmpeg${FF_VERSION}arm.zip" - mv ffmpeg "$INSTALL_DIR/ffmpeg" - download_binary "https://www.osxexperts.net/ffprobe${FF_VERSION}arm.zip" "FFprobe" - mv ffprobe "$INSTALL_DIR/ffprobe" - chmod +x "$INSTALL_DIR/"* - - elif [[ "${{ runner.os }}" == "Windows" ]]; then - download_binary "https://www.gyan.dev/ffmpeg/builds/packages/ffmpeg-$FF_VERSION-essentials_build.zip" - find . -type f \( -name ffmpeg.exe -o -name ffprobe.exe \) -exec mv {} "$INSTALL_DIR/" \; - fi - - echo "$INSTALL_DIR" >> "$GITHUB_PATH" - - - name: Verify FFmpeg and FFprobe installations - shell: bash - run: | - ffmpeg -version - ffprobe -version diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index b0a910f7..dac22cbc 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -12,22 +12,27 @@ permissions: read-all jobs: tests: name: Execute unit tests - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest permissions: contents: write - strategy: - fail-fast: false - matrix: - os: [ ubuntu-latest, windows-latest, macos-latest ] + checks: write + security-events: write steps: - name: Checkout code changes uses: actions/checkout@v7 - name: Setup FFmpeg and FFprobe - uses: ./.github/actions/setup-ffmpeg - with: - # bump: FFmpeg /ffmpeg-version: '([\d.]+)'/ docker:mwader/static-ffmpeg|/\d+\./|* - ffmpeg-version: '9.0' + env: + # bump: FFmpeg /FF_VERSION: ([\d.]+)/ docker:mwader/static-ffmpeg|/\d+\./|* + FF_VERSION: 9.0 + run: | + INSTALL_DIR="$RUNNER_TEMP/ffmpeg" + mkdir -p "$INSTALL_DIR" + CID=$(docker create "mwader/static-ffmpeg:$FF_VERSION") + docker export "$CID" | tar -xf - -C "$INSTALL_DIR" --wildcards 'ff*' + docker rm -v "$CID" > /dev/null + + echo "$INSTALL_DIR" >> "$GITHUB_PATH" - name: Setup Java uses: actions/setup-java@v5 @@ -47,14 +52,6 @@ jobs: shell: bash run: ./gradlew test - qodana: - name: Perform Qodana analysis - needs: tests - runs-on: ubuntu-latest - permissions: - checks: write - security-events: write - steps: - name: Checkout code changes uses: actions/checkout@v7 with: From db680cf9bef2764381ab85f64c211b00fa1b5064 Mon Sep 17 00:00:00 2001 From: Roberto Cella Date: Thu, 20 Aug 2026 18:15:01 +0200 Subject: [PATCH 2/6] Fix ffmpeg version type --- .github/workflows/unit-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index dac22cbc..2dc2df0f 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -23,8 +23,8 @@ jobs: - name: Setup FFmpeg and FFprobe env: - # bump: FFmpeg /FF_VERSION: ([\d.]+)/ docker:mwader/static-ffmpeg|/\d+\./|* - FF_VERSION: 9.0 + # bump: FFmpeg /FF_VERSION: '([\d.]+)'/ docker:mwader/static-ffmpeg|/\d+\./|* + FF_VERSION: '9.0' run: | INSTALL_DIR="$RUNNER_TEMP/ffmpeg" mkdir -p "$INSTALL_DIR" From 983f641a521b881ebcdc9ce9a5179919f8ddbd3b Mon Sep 17 00:00:00 2001 From: Enrico Martelli Date: Thu, 20 Aug 2026 18:38:41 +0200 Subject: [PATCH 3/6] Added cache for executables and concurrency configuration --- .github/workflows/unit-test.yml | 36 +++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 2dc2df0f..57cda0cc 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -7,6 +7,10 @@ on: branches: - main +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + permissions: read-all jobs: @@ -17,14 +21,25 @@ jobs: contents: write checks: write security-events: write + env: + # bump: FFmpeg /FF_VERSION: '([\d.]+)'/ docker:mwader/static-ffmpeg|/\d+\./|* + FF_VERSION: '9.0' steps: - name: Checkout code changes uses: actions/checkout@v7 + with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} + fetch-depth: 0 - - name: Setup FFmpeg and FFprobe - env: - # bump: FFmpeg /FF_VERSION: '([\d.]+)'/ docker:mwader/static-ffmpeg|/\d+\./|* - FF_VERSION: '9.0' + - name: Cache FFmpeg binaries + id: cache-ffmpeg + uses: actions/cache@v4 + with: + path: ${{ runner.temp }}/ffmpeg + key: ffmpeg-static-${{ runner.os }}-${{ env.FF_VERSION }} + + - name: Setup FFmpeg + if: steps.cache-ffmpeg.outputs.cache-hit != 'true' run: | INSTALL_DIR="$RUNNER_TEMP/ffmpeg" mkdir -p "$INSTALL_DIR" @@ -32,7 +47,8 @@ jobs: docker export "$CID" | tar -xf - -C "$INSTALL_DIR" --wildcards 'ff*' docker rm -v "$CID" > /dev/null - echo "$INSTALL_DIR" >> "$GITHUB_PATH" + - name: Add FFmpeg to PATH + run: echo "$RUNNER_TEMP/ffmpeg" >> "$GITHUB_PATH" - name: Setup Java uses: actions/setup-java@v5 @@ -49,14 +65,7 @@ jobs: build-scan-terms-of-use-agree: 'yes' - name: Execute tests - shell: bash - run: ./gradlew test - - - name: Checkout code changes - uses: actions/checkout@v7 - with: - ref: ${{ github.event.pull_request.head.sha || github.sha }} - fetch-depth: 0 + run: ./gradlew check - name: Execute analysis uses: JetBrains/qodana-action@v2026.2.0 @@ -70,6 +79,7 @@ jobs: args: --image jetbrains/qodana-jvm-community:2026.2 - name: Upload results to GitHub + if: always() uses: github/codeql-action/upload-sarif@v4 with: sarif_file: ${{ runner.temp }}/qodana/results/qodana.sarif.json From 525ed9107204550ef3b35620f33bebf24253cb97 Mon Sep 17 00:00:00 2001 From: Enrico Martelli Date: Thu, 20 Aug 2026 19:05:00 +0200 Subject: [PATCH 4/6] Use latest version of cache --- .github/workflows/unit-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 57cda0cc..352baf07 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -33,7 +33,7 @@ jobs: - name: Cache FFmpeg binaries id: cache-ffmpeg - uses: actions/cache@v4 + uses: actions/cache@v6 with: path: ${{ runner.temp }}/ffmpeg key: ffmpeg-static-${{ runner.os }}-${{ env.FF_VERSION }} From cf5ec1e5b02f1ffee4e164fce9a083d7b53eeebc Mon Sep 17 00:00:00 2001 From: Roberto Cella Date: Thu, 20 Aug 2026 20:09:13 +0200 Subject: [PATCH 5/6] Split workflow in 2 jobs --- .github/workflows/unit-test.yml | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 352baf07..b52bdd12 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -19,17 +19,12 @@ jobs: runs-on: ubuntu-latest permissions: contents: write - checks: write - security-events: write env: # bump: FFmpeg /FF_VERSION: '([\d.]+)'/ docker:mwader/static-ffmpeg|/\d+\./|* FF_VERSION: '9.0' steps: - name: Checkout code changes uses: actions/checkout@v7 - with: - ref: ${{ github.event.pull_request.head.sha || github.sha }} - fetch-depth: 0 - name: Cache FFmpeg binaries id: cache-ffmpeg @@ -67,6 +62,20 @@ jobs: - name: Execute tests run: ./gradlew check + qodana: + name: Perform Qodana analysis + needs: tests + runs-on: ubuntu-latest + permissions: + checks: write + security-events: write + steps: + - name: Checkout code changes + uses: actions/checkout@v7 + with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} + fetch-depth: 0 + - name: Execute analysis uses: JetBrains/qodana-action@v2026.2.0 env: From e7d868d8d83f9b4b38f3e52786e75e8fd1e4b1e3 Mon Sep 17 00:00:00 2001 From: Roberto Cella Date: Thu, 20 Aug 2026 20:39:39 +0200 Subject: [PATCH 6/6] Upload results to GitHub only when the run has not been canceled --- .github/workflows/unit-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index b52bdd12..d4b1bc46 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -88,7 +88,7 @@ jobs: args: --image jetbrains/qodana-jvm-community:2026.2 - name: Upload results to GitHub - if: always() + if: ${{ !cancelled() }} uses: github/codeql-action/upload-sarif@v4 with: sarif_file: ${{ runner.temp }}/qodana/results/qodana.sarif.json