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..d4b1bc46 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -7,27 +7,43 @@ on: branches: - main +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + 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 ] + env: + # bump: FFmpeg /FF_VERSION: '([\d.]+)'/ docker:mwader/static-ffmpeg|/\d+\./|* + FF_VERSION: '9.0' steps: - name: Checkout code changes uses: actions/checkout@v7 - - name: Setup FFmpeg and FFprobe - uses: ./.github/actions/setup-ffmpeg + - name: Cache FFmpeg binaries + id: cache-ffmpeg + uses: actions/cache@v6 with: - # bump: FFmpeg /ffmpeg-version: '([\d.]+)'/ docker:mwader/static-ffmpeg|/\d+\./|* - ffmpeg-version: '9.0' + 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" + CID=$(docker create "mwader/static-ffmpeg:$FF_VERSION") + docker export "$CID" | tar -xf - -C "$INSTALL_DIR" --wildcards 'ff*' + docker rm -v "$CID" > /dev/null + + - name: Add FFmpeg to PATH + run: echo "$RUNNER_TEMP/ffmpeg" >> "$GITHUB_PATH" - name: Setup Java uses: actions/setup-java@v5 @@ -44,8 +60,7 @@ jobs: build-scan-terms-of-use-agree: 'yes' - name: Execute tests - shell: bash - run: ./gradlew test + run: ./gradlew check qodana: name: Perform Qodana analysis @@ -73,6 +88,7 @@ jobs: args: --image jetbrains/qodana-jvm-community:2026.2 - name: Upload results to GitHub + if: ${{ !cancelled() }} uses: github/codeql-action/upload-sarif@v4 with: sarif_file: ${{ runner.temp }}/qodana/results/qodana.sarif.json