fix(workflows): add workaround for hashFiles bug on macOS runners #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: FFmpeg library test | |
| on: | |
| push: | |
| branches: [ main ] | |
| paths: | |
| - '.github/workflows/ffmpeg-test.yml' | |
| - 'internal/builder/**' | |
| - '*.gen.go' | |
| workflow_dispatch: | |
| permissions: | |
| pull-requests: write | |
| contents: write | |
| jobs: | |
| ffmpeg-test: | |
| name: Build FFmpeg library for ${{ matrix.os }} ${{ matrix.arch }} | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: linux | |
| arch: amd64 | |
| runner: ubuntu-24.04 | |
| - os: linux | |
| arch: arm64 | |
| runner: ubuntu-24.04-arm | |
| - os: darwin | |
| arch: amd64 | |
| runner: macos-15-intel | |
| - os: darwin | |
| arch: arm64 | |
| runner: macos-latest | |
| fail-fast: false | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: '1.24' | |
| - name: Cache Go modules and build cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/go/pkg/mod | |
| ~/.cache/go-build | |
| # Workaround for GitHub Actions bug: https://github.com/actions/runner-images/issues/13341 | |
| # hashFiles() broken on macOS runners as of 2024-11-23, using static key temporarily | |
| key: ${{ runner.os }}-${{ runner.arch }}-go-${{ matrix.os == 'darwin' && 'static-v1' || hashFiles('go.sum', 'go.mod') }} | |
| restore-keys: | | |
| ${{ runner.os }}-${{ runner.arch }}-go- | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: stable | |
| - name: Cache Rust cargo | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| key: ${{ runner.os }}-${{ runner.arch }}-cargo-stable | |
| restore-keys: | | |
| ${{ runner.os }}-${{ runner.arch }}-cargo- | |
| - name: Install cargo-c | |
| run: cargo install cargo-c | |
| - name: Install Linux dependencies | |
| if: matrix.os == 'linux' | |
| run: sudo apt-get update && sudo apt-get install -y yasm nasm meson gperf python3 | |
| - name: Install macOS dependencies | |
| if: matrix.os == 'darwin' | |
| run: brew update && brew install yasm autoconf ragel meson nasm automake libtool python3 | |
| - name: Cache FFmpeg source downloads | |
| uses: actions/cache@v4 | |
| with: | |
| path: .build/downloads | |
| # Workaround for GitHub Actions bug: https://github.com/actions/runner-images/issues/13341 | |
| # hashFiles() broken on macOS runners as of 2024-11-23, using static key temporarily | |
| key: ${{ runner.os }}-${{ runner.arch }}-ffmpeg-downloads-${{ matrix.os == 'darwin' && 'static-v1' || hashFiles('internal/builder/libraries.go') }} | |
| restore-keys: | | |
| ${{ runner.os }}-${{ runner.arch }}-ffmpeg-downloads- | |
| - name: Cache compiled dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| .build/staging | |
| .build/build | |
| # Workaround for GitHub Actions bug: https://github.com/actions/runner-images/issues/13341 | |
| # hashFiles() broken on macOS runners as of 2024-11-23, using static key temporarily | |
| key: ${{ runner.os }}-${{ runner.arch }}-ffmpeg-deps-${{ matrix.os == 'darwin' && 'static-v1' || hashFiles('internal/builder/libraries.go', 'internal/builder/buildsystems.go') }} | |
| restore-keys: | | |
| ${{ runner.os }}-${{ runner.arch }}-ffmpeg-deps- | |
| - name: Build FFmpeg library | |
| run: go run ./internal/builder/ | |
| - name: List built files | |
| run: ls -lh lib/${{ matrix.os }}_${{ matrix.arch }}/ |