| # Workflow that builds libabvif with aom and libyuv, also builds MP4box, |
| # and runs tests with "golden" in their name. Test results are saved as artifacts |
| # which can be downloaded from GitHub'S UI or with 'gh run download'. |
| |
| name: CI Linux Golden Tests |
| on: [push, pull_request] |
| |
| permissions: |
| contents: read |
| |
| # Cancel the workflow if a new one is triggered from the same PR, branch, or tag, except on main. |
| concurrency: |
| group: ${{ github.workflow }}-${{ github.ref }} |
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} |
| |
| jobs: |
| build-shared-run-golden-tests: |
| runs-on: ${{ matrix.os }} |
| strategy: |
| fail-fast: false |
| matrix: |
| os: [ubuntu-latest] |
| include: |
| - runs-on: ubuntu-latest |
| compiler: gcc |
| gcc: 13 |
| |
| steps: |
| - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 |
| - name: Set GCC & G++ compiler (on Linux) |
| run: echo "CC=gcc-${{matrix.gcc}}" >> $GITHUB_ENV && echo "CXX=g++-${{matrix.gcc}}" >> $GITHUB_ENV |
| - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 |
| with: |
| python-version: '3.x' |
| - name: Cache external dependencies |
| id: cache-ext |
| uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 |
| with: |
| path: ext, build/_deps |
| key: ${{ runner.os }}-golden-tests-${{ hashFiles('cmake/Modules/*', 'ext/*.cmd', 'ext/*.sh') }} |
| - name: Setup cmake |
| uses: jwlawson/actions-setup-cmake@959f1116cf9f1ae42fff8ec1a4aaae6d4a0e348b |
| with: |
| # CMake 3.18 or higher is required for libxml2 |
| cmake-version: '3.18.x' |
| - name: Print cmake version |
| run: cmake --version |
| - uses: ilammy/setup-nasm@13cbeb366c45c4379d3478cdcbadd8295feb5028 # v1.5.1 |
| - uses: seanmiddleditch/gha-setup-ninja@8b297075da4cd2a5f1fd21fe011b499edf06e9d2 # v4 |
| - name: Build mp4box |
| if: steps.cache-ext.outputs.cache-hit != 'true' |
| working-directory: ./ext |
| run: bash -e mp4box.sh |
| |
| - name: Prepare libavif (cmake) |
| run: > |
| mkdir build && cd build |
| |
| cmake .. -G Ninja |
| -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF |
| -DAVIF_CODEC_AOM=LOCAL -DAVIF_LIBYUV=LOCAL |
| -DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON |
| -DAVIF_ENABLE_EXPERIMENTAL_GAIN_MAP=ON |
| -DAVIF_LIBXML2=LOCAL |
| -DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GOLDEN_TESTS=ON |
| -DAVIF_ENABLE_GTEST=OFF -DAVIF_ENABLE_WERROR=ON |
| -DGOLDEN_TESTS_OUTPUT_DIR=${{ runner.temp }}/golden_tests |
| - name: Build libavif (ninja) |
| working-directory: ./build |
| run: ninja |
| - name: Run AVIF golden tests |
| working-directory: ./build |
| # Runs test that have "golden" in their name. |
| run: ctest -j $(getconf _NPROCESSORS_ONLN) --output-on-failure -R golden |
| |
| # See https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts |
| - name: Archive golden tests output for debugging |
| if: failure() |
| uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 |
| with: |
| name: golden-tests-output |
| path: ${{ runner.temp }}/golden_tests/**/* |
| |
| # Print instructions to help fix the tests. |
| - name: How to fix failing tests |
| if: failure() |
| run: > |
| echo "If the tests fail, download the test results from the Artifacts list at https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} or with: |
| gh run download --dir /tmp/golden-tests-output-${{ github.run_id }} --repo ${{ github.repository }} --name golden-tests-output ${{ github.run_id }} |
| Update all files with: |
| cp /tmp/golden-tests-output-${{ github.run_id }}/*/*.xml ~/git/libavif/tests/data/goldens |
| Or look at detailed instructions in the README.txt file in the test ouputs." |