| name: Conformance Tests |
| on: |
| push: |
| branches: |
| - main |
| 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: |
| conformance-tests: |
| name: "Conformance Tests on ${{ matrix.os }}" |
| runs-on: ${{ matrix.os }} |
| strategy: |
| fail-fast: false |
| matrix: |
| os: [ubuntu-latest, macos-latest, windows-latest] |
| |
| steps: |
| - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 |
| |
| - name: Setup Visual Studio shell |
| if: runner.os == 'Windows' |
| uses: egor-tensin/vs-shell@9a932a62d05192eae18ca370155cf877eecc2202 # v2.1 |
| |
| - name: Cache external dependencies including libavif |
| id: cache-ext-with-libavif |
| uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 |
| with: |
| path: | |
| sys |
| external |
| key: ${{ runner.os }}-${{ hashFiles('sys/dav1d-sys/Cargo.toml', 'sys/dav1d-sys/dav1d.cmd', 'sys/dav1d-sys/build.rs', 'sys/libyuv-sys/Cargo.toml', 'sys/libyuv-sys/libyuv.cmd', 'sys/libyuv-sys/build.rs', 'external/googletest.cmd') }} |
| |
| - uses: jwlawson/actions-setup-cmake@d06b37b47cfd043ec794ffa3e40e0b6b5858a7ec # v1.14.2 |
| if: steps.cache-ext-with-libavif.outputs.cache-hit != 'true' |
| - uses: ilammy/setup-nasm@13cbeb366c45c4379d3478cdcbadd8295feb5028 # v1.5.1 |
| if: steps.cache-ext-with-libavif.outputs.cache-hit != 'true' |
| - uses: seanmiddleditch/gha-setup-ninja@8b297075da4cd2a5f1fd21fe011b499edf06e9d2 # v4 |
| if: steps.cache-ext-with-libavif.outputs.cache-hit != 'true' |
| - run: pip install meson |
| if: steps.cache-ext-with-libavif.outputs.cache-hit != 'true' |
| |
| - name: Build dav1d |
| if: steps.cache-ext-with-libavif.outputs.cache-hit != 'true' |
| working-directory: ./sys/dav1d-sys |
| run: ./dav1d.cmd |
| - name: Build libyuv |
| if: steps.cache-ext-with-libavif.outputs.cache-hit != 'true' |
| working-directory: ./sys/libyuv-sys |
| run: ./libyuv.cmd |
| env: |
| CC: clang |
| CXX: clang++ |
| |
| - name: Clone av1-avif (specification repository for testFiles) |
| if: steps.cache-ext-with-libavif.outputs.cache-hit != 'true' |
| working-directory: ./external |
| run: | |
| git clone https://github.com/AOMediaCodec/av1-avif.git |
| cd av1-avif |
| git checkout aa906e00c9d8655a8b97718aa16d379970678663 |
| |
| - name: Clone libavif |
| if: steps.cache-ext-with-libavif.outputs.cache-hit != 'true' |
| working-directory: ./external |
| run: | |
| git clone https://github.com/AOMediaCodec/libavif.git |
| cd libavif |
| git checkout 329dc9987e63e1e201f55cad5b5c42a6f750a29e |
| |
| - name: Copy dav1d into libavif (for windows) |
| if: steps.cache-ext-with-libavif.outputs.cache-hit != 'true' && runner.os == 'Windows' |
| working-directory: ./external/libavif |
| run: xcopy ..\..\sys\dav1d-sys\dav1d ext\dav1d /s /e /h /i |
| |
| - name: Copy dav1d into libavif (for linux/mac) |
| if: steps.cache-ext-with-libavif.outputs.cache-hit != 'true' && runner.os != 'Windows' |
| working-directory: ./external/libavif |
| run: cp -R ../../sys/dav1d-sys/dav1d ext/dav1d |
| |
| - name: vcpkg build (for windows) |
| if: runner.os == 'Windows' |
| uses: johnwason/vcpkg-action@v6 |
| id: vcpkg |
| with: |
| pkgs: libjpeg-turbo libpng zlib |
| triplet: x64-windows-release |
| token: ${{ github.token }} |
| github-binarycache: true |
| |
| - name: jpeg, zlib and png (for linux) |
| if: runner.os == 'Linux' |
| run: sudo apt install -y zlib1g libpng-dev libjpeg-dev |
| |
| - name: Configure libavif (cmake) |
| if: steps.cache-ext-with-libavif.outputs.cache-hit != 'true' |
| working-directory: ./external/libavif |
| run: > |
| cmake ${{ steps.vcpkg.outputs.vcpkg-cmake-config }} -G Ninja -S . |
| -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF |
| -DAVIF_CODEC_DAV1D=LOCAL -DAVIF_JPEG=SYSTEM -DAVIF_LIBYUV=OFF |
| -DAVIF_ZLIBPNG=SYSTEM -DAVIF_BUILD_APPS=ON |
| |
| - name: Build libavif (avifdec for conformance comparison) |
| if: steps.cache-ext-with-libavif.outputs.cache-hit != 'true' |
| working-directory: ./external/libavif/build |
| run: ninja avifdec |
| |
| - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 |
| with: |
| toolchain: stable |
| |
| - name: Build and run the Rust tests |
| run: cargo test -- test_conformance |
| |
| - name: Build GoogleTest |
| if: steps.cache-ext-with-libavif.outputs.cache-hit != 'true' && runner.os == 'Linux' |
| working-directory: ./external |
| run: bash -e googletest.cmd |
| |
| - name: Build and run the C++ tests |
| if: runner.os == 'Linux' |
| run: | |
| cargo build --features capi --release |
| cmake -S c_api_tests -B c_build |
| make -C c_build |
| ctest --test-dir c_build -R conformance_tests |