• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: Build and Run Tests
2on:
3  push:
4    branches:
5      - main
6  pull_request:
7
8permissions:
9  contents: read
10
11# Cancel the workflow if a new one is triggered from the same PR, branch, or tag, except on main.
12concurrency:
13  group: ${{ github.workflow }}-${{ github.ref }}
14  cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
15
16jobs:
17  build-and-run-tests:
18    name: "Build and Run Tests on ${{ matrix.os }}"
19    runs-on: ${{ matrix.os }}
20    strategy:
21      fail-fast: false
22      matrix:
23        os: [ubuntu-latest, macos-latest, windows-latest]
24    env:
25      CC: clang
26      CXX: clang++
27
28    steps:
29    - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
30
31    - name: Setup Visual Studio shell
32      if: runner.os == 'Windows'
33      uses: egor-tensin/vs-shell@9a932a62d05192eae18ca370155cf877eecc2202 # v2.1
34
35    - name: Cache external dependencies
36      id: cache-ext
37      uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
38      with:
39        path: |
40          sys
41          external
42        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', 'sys/libgav1-sys/Cargo.toml', 'sys/libgav1-sys/libgav1.cmd', 'sys/libgav1-sys/build.rs', 'external/googletest.cmd') }}
43
44    - uses: jwlawson/actions-setup-cmake@d06b37b47cfd043ec794ffa3e40e0b6b5858a7ec # v1.14.2
45      if: steps.cache-ext.outputs.cache-hit != 'true'
46    - uses: ilammy/setup-nasm@13cbeb366c45c4379d3478cdcbadd8295feb5028 # v1.5.1
47      if: steps.cache-ext.outputs.cache-hit != 'true'
48    - uses: seanmiddleditch/gha-setup-ninja@8b297075da4cd2a5f1fd21fe011b499edf06e9d2 # v4
49      if: steps.cache-ext.outputs.cache-hit != 'true'
50    - run: pip install meson
51      if: steps.cache-ext.outputs.cache-hit != 'true'
52
53    - name: Build dav1d
54      if: steps.cache-ext.outputs.cache-hit != 'true'
55      working-directory: ./sys/dav1d-sys
56      run: ./dav1d.cmd
57    - name: Build libyuv
58      if: steps.cache-ext.outputs.cache-hit != 'true'
59      working-directory: ./sys/libyuv-sys
60      run: ./libyuv.cmd
61
62    - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7
63      with:
64        toolchain: stable
65
66    - name: Build and run the Rust tests
67      run: cargo test -- --skip test_conformance
68
69    - name: Build GoogleTest
70      if: steps.cache-ext.outputs.cache-hit != 'true' && runner.os != 'Windows'
71      working-directory: ./external
72      run: bash -e googletest.cmd
73
74    - name: Build and run the C++ tests
75      # TODO: This step fails on macos. So run it on linux only for now.
76      if: runner.os == 'Linux'
77      run: |
78        cargo build --features capi --release
79        cmake -S c_api_tests -B c_build
80        make -C c_build
81        ctest --test-dir c_build -E conformance_tests
82
83    - name: Build libgav1
84      if: steps.cache-ext.outputs.cache-hit != 'true'
85      working-directory: ./sys/libgav1-sys
86      run: ./libgav1.cmd
87
88    - name: Build and run the Rust tests with libgav1
89      run: cargo test --no-default-features --features libgav1,libyuv -- --skip test_conformance
90
91    - name: Build and run the C++ tests with libgav1
92      # TODO: This step fails on macos. So run it on linux only for now.
93      if: runner.os == 'Linux'
94      run: |
95        cargo build --no-default-features --features capi,libgav1,libyuv --release
96        cmake -S c_api_tests -B c_build_gav1
97        make -C c_build_gav1
98        ctest --test-dir c_build_gav1 -E conformance_tests
99
100    - name: Build and run the heic tests with heic feature enabled
101      run: cargo test --no-default-features --features heic heic
102