diff --git a/.github/actions/cache/action.yml b/.github/actions/cache/action.yml new file mode 100644 index 0000000000..0d9ef046e5 --- /dev/null +++ b/.github/actions/cache/action.yml @@ -0,0 +1,28 @@ +name: 'Cache setup ' +description: 'Caches cargo and external dependencies.' +inputs: + codec-rav1e: + description: 'Can take the values: OFF, LOCAL, SYSTEM' + default: 'OFF' +runs: + using: "composite" + steps: + - name: Cache cargo registry + if: ${{ inputs.codec-rav1e == 'LOCAL' }} + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 + continue-on-error: true + with: + path: ~/.cargo/registry/cache + key: cargo-registry-${{ runner.os }}-${{ hashFiles('CMakeLists.txt', 'cmake/Modules/*', 'ext/*.cmd', 'ext/*.sh') }}-${{ github.job }} + restore-keys: | + cargo-registry-${{ runner.os }}-${{ hashFiles('CMakeLists.txt', 'cmake/Modules/*', 'ext/*.cmd', 'ext/*.sh') }}- + cargo-registry-${{ runner.os }}- + - name: Cache external dependencies + id: cache-ext + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 + with: + path: ext, build/_deps + key: ext-${{ runner.os }}-${{ hashFiles('CMakeLists.txt', 'cmake/Modules/*', 'ext/*.cmd', 'ext/*.sh') }}-${{ github.job }} + restore-keys: | + ext-${{ runner.os }}-${{ hashFiles('CMakeLists.txt', 'cmake/Modules/*', 'ext/*.cmd', 'ext/*.sh') }}- + ext-${{ runner.os }}- diff --git a/.github/actions/setup-common/action.yml b/.github/actions/setup-common/action.yml new file mode 100644 index 0000000000..c9b652e01f --- /dev/null +++ b/.github/actions/setup-common/action.yml @@ -0,0 +1,52 @@ +name: 'Setup for all OSes' +description: 'Installs dependencies for all OSes' +inputs: + codec-aom: + description: 'Can take the values: OFF, LOCAL, SYSTEM' + default: 'OFF' + codec-dav1d: + description: 'Can take the values: OFF, LOCAL, SYSTEM' + default: 'OFF' + codec-rav1e: + description: 'Can take the values: OFF, LOCAL, SYSTEM' + default: 'OFF' + recent-cmake: + description: 'Can take the values: true, false. Only useful on Linux' + default: false +runs: + using: "composite" + steps: + - name: Set up Python + uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 + with: + python-version: '3.x' + - name: Set up CMake < 3.18 + if: ${{ runner.os == 'Linux' && !inputs.recent-cmake }} + uses: jwlawson/actions-setup-cmake@802fa1a2c4e212495c05bf94dba2704a92a472be # v2.0.2 + with: + cmake-version: '3.13.x' + - name: Set up CMake >= 3.18 + if: ${{ runner.os == 'Linux' && inputs.recent-cmake }} + uses: jwlawson/actions-setup-cmake@802fa1a2c4e212495c05bf94dba2704a92a472be # v2.0.2 + with: + cmake-version: '3.18.x' + - name: Print CMake version + run: cmake --version + shell: bash + - name: Set up ninja + uses: seanmiddleditch/gha-setup-ninja@8b297075da4cd2a5f1fd21fe011b499edf06e9d2 # v4 + + - name: Set up nasm + if: ${{ inputs.codec-aom == 'LOCAL' }} + uses: ilammy/setup-nasm@13cbeb366c45c4379d3478cdcbadd8295feb5028 # v1.5.1 + - name: Set up meson + if: ${{ inputs.codec-dav1d == 'LOCAL' }} + run: pip install meson + shell: bash + - name: Set up rust + uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 + if: ${{ inputs.codec-rav1e == 'LOCAL' }} + with: + profile: minimal + toolchain: stable + override: true diff --git a/.github/actions/setup-linux/action.yml b/.github/actions/setup-linux/action.yml new file mode 100644 index 0000000000..42a199cf60 --- /dev/null +++ b/.github/actions/setup-linux/action.yml @@ -0,0 +1,76 @@ +name: 'Setup on Linux' +description: 'Installs dependencies and sets up env variables' +inputs: + codec-aom: + description: 'Can take the values: OFF, LOCAL, SYSTEM' + default: 'OFF' + codec-dav1d: + description: 'Can take the values: OFF, LOCAL, SYSTEM' + edfault: 'OFF' + codec-rav1e: + description: 'Can take the values: OFF, LOCAL, SYSTEM' + default: 'OFF' + gcc-version: + description: 'Can be empty, in which case CC and CXX are not overriden' + default: '' + libxml2: + default: 'OFF' + libyuv: + default: 'OFF' + recent-cmake: + description: 'Can take the values: true, false' + default: false +runs: + using: "composite" + steps: + - name: Install non-library dependencies + run: | + sudo apt update + sudo apt install imagemagick libjpeg-turbo8-dev libpng-dev + shell: bash + - name: Install libaom library + if: ${{ inputs.codec-aom == 'SYSTEM' }} + run: + sudo apt install libaom-dev + shell: bash + - name: Install libdav1d library + if: ${{ inputs.codec-dav1d == 'SYSTEM' }} + run: + sudo apt install libdav1d-dev + shell: bash + - name: Install rav1e library + if: ${{ inputs.codec-rav1e == 'SYSTEM' }} + run: + sudo apt install librav1e-dev + shell: bash + - name: Install libxml2 library + if: ${{ inputs.libxml2 == 'SYSTEM' }} + run: + sudo apt install libxml2 + shell: bash + - name: Install libyuv library + if: ${{ inputs.libyuv == 'SYSTEM' }} + run: + sudo apt install libyuv-dev + shell: bash + + - name: Install cargo-c + if: ${{ inputs.codec-rav1e == 'LOCAL' }} + env: + LINK: https://github.com/lu-zero/cargo-c/releases/latest/download + CARGO_C_FILE: cargo-c-x86_64-unknown-linux-musl.tar.gz + run: | + curl -L $LINK/$CARGO_C_FILE | tar xz -C ~/.cargo/bin + shell: bash + + - uses: ./.github/actions/setup-common + with: + codec-aom: ${{ inputs.codec-aom }} + codec-dav1d: ${{ inputs.codec-dav1d }} + codec-rav1e: ${{ inputs.codec-rav1e }} + recent-cmake: ${{ inputs.recent-cmake }} + + - name: Set GCC & G++ compiler + if: ${{ inputs.gcc-version != '' }} + run: echo "CC=gcc-${{ inputs.gcc-version }}" >> $GITHUB_ENV && echo "CXX=g++-${{ inputs.gcc-version }}" >> $GITHUB_ENV + shell: bash diff --git a/.github/actions/setup-macos/action.yml b/.github/actions/setup-macos/action.yml new file mode 100644 index 0000000000..b25a0946e4 --- /dev/null +++ b/.github/actions/setup-macos/action.yml @@ -0,0 +1,44 @@ +name: 'Setup on Linux' +description: 'Installs dependencies and sets up env variables' +inputs: + codec-aom: + description: 'Can take the values: OFF, LOCAL, SYSTEM' + default: 'OFF' + codec-dav1d: + description: 'Can take the values: OFF, LOCAL, SYSTEM' + default: 'OFF' + codec-rav1e: + description: 'Can take the values: OFF, LOCAL, SYSTEM' + default: 'OFF' +runs: + using: "composite" + steps: + - name: Install non-library dependencies + run: brew install imagemagick + shell: bash + - name: Install AOM library + if: ${{ inputs.codec-aom == 'SYSTEM' }} + run: brew install aom + shell: bash + - name: Install dav1d library + if: ${{ inputs.codec-dav1d == 'SYSTEM' }} + run: brew install dav1d + shell: bash + + - name: Install cargo-c + if: ${{ inputs.codec-rav1e == 'LOCAL' }} + env: + LINK: https://github.com/lu-zero/cargo-c/releases/latest/download + CARGO_C_FILE: cargo-c-macos.zip + run: | + curl -sLo $CARGO_C_FILE $LINK/$CARGO_C_FILE + unzip -o $CARGO_C_FILE -d ~/.cargo/bin + rm $CARGO_C_FILE + shell: bash + + - uses: ./.github/actions/setup-common + with: + codec-aom: ${{ inputs.codec-aom }} + codec-dav1d: ${{ inputs.codec-dav1d }} + codec-rav1e: ${{ inputs.codec-rav1e }} + recent-cmake: true diff --git a/.github/workflows/ci-android-emulator-tests.yml b/.github/workflows/ci-android-emulator-tests.yml index af07439b18..02ea5d1b6c 100644 --- a/.github/workflows/ci-android-emulator-tests.yml +++ b/.github/workflows/ci-android-emulator-tests.yml @@ -31,20 +31,11 @@ jobs: # r25c is the same as 25.2.9519653. ndk-version: r25c add-to-path: false - - name: Setup ninja - uses: seanmiddleditch/gha-setup-ninja@8b297075da4cd2a5f1fd21fe011b499edf06e9d2 # v4 - - name: Setup cmake - uses: jwlawson/actions-setup-cmake@802fa1a2c4e212495c05bf94dba2704a92a472be # v2.0.2 + - uses: ./.github/actions/setup-common with: - cmake-version: "3.19.x" - - name: Setup python - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 - with: - python-version: '3.x' - - name: Setup meson - run: pip install meson - - name: Setup nasm - uses: ilammy/setup-nasm@13cbeb366c45c4379d3478cdcbadd8295feb5028 # v1.5.1 + codec-aom: 'LOCAL' + codec-dav1d: 'LOCAL' + recent-cmake: true - name: Setup JDK uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 with: diff --git a/.github/workflows/ci-android-jni.yml b/.github/workflows/ci-android-jni.yml index 20113b6e31..0fbbcf93d6 100644 --- a/.github/workflows/ci-android-jni.yml +++ b/.github/workflows/ci-android-jni.yml @@ -25,20 +25,11 @@ jobs: # r25c is the same as 25.2.9519653. ndk-version: r25c add-to-path: false - - name: Setup ninja - uses: seanmiddleditch/gha-setup-ninja@8b297075da4cd2a5f1fd21fe011b499edf06e9d2 # v4 - - name: Setup cmake - uses: jwlawson/actions-setup-cmake@802fa1a2c4e212495c05bf94dba2704a92a472be # v2.0.2 + - uses: ./.github/actions/setup-common with: - cmake-version: "3.19.x" - - name: Setup python - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 - with: - python-version: '3.x' - - name: Setup meson - run: pip install meson - - name: Setup nasm - uses: ilammy/setup-nasm@13cbeb366c45c4379d3478cdcbadd8295feb5028 # v1.5.1 + codec-aom: 'LOCAL' + codec-dav1d: 'LOCAL' + recent-cmake: true - name: Setup JDK uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 with: diff --git a/.github/workflows/ci-disable-gtest.yml b/.github/workflows/ci-disable-gtest.yml index ad576d70f0..1b6dabbc52 100644 --- a/.github/workflows/ci-disable-gtest.yml +++ b/.github/workflows/ci-disable-gtest.yml @@ -36,40 +36,14 @@ jobs: steps: - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 - - name: Set GCC & G++ compiler (on Linux) - if: runner.os == 'Linux' - run: echo "CC=gcc-${{matrix.gcc}}" >> $GITHUB_ENV && echo "CXX=g++-${{matrix.gcc}}" >> $GITHUB_ENV - - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 + - uses: ./.github/actions/setup-linux with: - python-version: '3.x' - - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 - with: - profile: minimal - toolchain: stable - override: true - - - name: Install cargo-c - env: - LINK: https://github.com/lu-zero/cargo-c/releases/latest/download - CARGO_C_FILE: cargo-c-x86_64-unknown-linux-musl.tar.gz - run: | - curl -L $LINK/$CARGO_C_FILE | tar xz -C ~/.cargo/bin - - name: Cache external dependencies - id: cache-ext - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 - with: - path: ext, build/_deps - key: ${{ runner.os }}-disable-gtest-${{ hashFiles('cmake/Modules/*', 'ext/*.cmd', 'ext/*.sh') }} - - name: Setup cmake - uses: jwlawson/actions-setup-cmake@802fa1a2c4e212495c05bf94dba2704a92a472be # v2.0.2 - with: - # CMake version 3.17 is required to build libwebp (which libsharpyuv is part of) on macOS. - cmake-version: '3.17.x' - - name: Print cmake version - run: cmake --version - - uses: ilammy/setup-nasm@13cbeb366c45c4379d3478cdcbadd8295feb5028 # v1.5.1 - - uses: seanmiddleditch/gha-setup-ninja@8b297075da4cd2a5f1fd21fe011b499edf06e9d2 # v4 - - run: pip install meson + codec-aom: 'LOCAL' + codec-dav1d: 'LOCAL' + codec-rav1e: 'LOCAL' + gcc-version: ${{ matrix.gcc }} + libyuv: 'LOCAL' + recent-cmake: true - name: Prepare libavif (cmake) run: > @@ -83,15 +57,9 @@ jobs: -DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON -DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=OFF -DAVIF_ENABLE_WERROR=ON - - name: Cache cargo registry - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 - continue-on-error: true + - uses: ./.github/actions/cache with: - path: ~/.cargo/registry/cache - key: cargo-registry-${{ runner.os }}-${{ hashFiles('ext/rav1e/Cargo.lock') }}-disable-gtest - restore-keys: | - cargo-registry-${{ runner.os }}-${{ hashFiles('ext/rav1e/Cargo.lock') }}- - cargo-registry-${{ runner.os }}- + codec-rav1e: 'LOCAL' - name: Build libavif (ninja) working-directory: ./build run: ninja diff --git a/.github/workflows/ci-linux-golden-tests.yml b/.github/workflows/ci-linux-golden-tests.yml index 53786a7aa3..8474a22533 100644 --- a/.github/workflows/ci-linux-golden-tests.yml +++ b/.github/workflows/ci-linux-golden-tests.yml @@ -27,26 +27,14 @@ jobs: steps: - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 - - 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 + - uses: ./.github/actions/setup-linux 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@802fa1a2c4e212495c05bf94dba2704a92a472be - 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 + codec-aom: 'LOCAL' + codec-dav1d: 'LOCAL' + gcc-version: ${{ matrix.gcc }} + libxml2: 'LOCAL' + libyuv: 'LOCAL' + recent-cmake: true - name: Build mp4box if: steps.cache-ext.outputs.cache-hit != 'true' working-directory: ./ext @@ -65,6 +53,7 @@ jobs: -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 + - uses: ./.github/actions/cache - name: Build libavif (ninja) working-directory: ./build run: ninja diff --git a/.github/workflows/ci-linux-static-old-local.yml b/.github/workflows/ci-linux-static-old-local.yml index cf7d46b015..217aed976e 100644 --- a/.github/workflows/ci-linux-static-old-local.yml +++ b/.github/workflows/ci-linux-static-old-local.yml @@ -17,7 +17,7 @@ concurrency: cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} jobs: - build-static: + build-static-old-local: runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -30,40 +30,14 @@ jobs: steps: - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 - - 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 + - uses: ./.github/actions/setup-linux with: - python-version: '3.x' - - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 - with: - profile: minimal - toolchain: stable - override: true - - name: Install cargo-c (linux) - env: - LINK: https://github.com/lu-zero/cargo-c/releases/latest/download - CARGO_C_FILE: cargo-c-x86_64-unknown-linux-musl.tar.gz - run: | - curl -L $LINK/$CARGO_C_FILE | tar xz -C ~/.cargo/bin - - name: Cache external dependencies - id: cache-ext - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 - with: - path: ext, build/_deps - key: ${{ runner.os }}-linux-static-old-local-${{ hashFiles('cmake/Modules/*', 'ext/*.cmd', 'ext/*.sh') }} - - name: Setup cmake - uses: jwlawson/actions-setup-cmake@802fa1a2c4e212495c05bf94dba2704a92a472be # v2.0.2 - with: - # CMake version 3.18 is required to build 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 - - run: pip install meson - - name: Print ImageMagick version - run: convert --version + codec-aom: 'LOCAL' + codec-dav1d: 'LOCAL' + codec-rav1e: 'LOCAL' + gcc-version: ${{ matrix.gcc }} + libxml2: 'LOCAL' + libyuv: 'LOCAL' - name: Prepare libavif (cmake) run: > mkdir build && cd build @@ -82,15 +56,9 @@ jobs: -DAVIF_ENABLE_EXPERIMENTAL_GAIN_MAP=ON -DAVIF_ENABLE_EXPERIMENTAL_MINI=ON -DAVIF_ENABLE_WERROR=ON - - name: Cache cargo registry - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 - continue-on-error: true + - uses: ./.github/actions/cache with: - path: ~/.cargo/registry/cache - key: cargo-registry-${{ runner.os }}-${{ hashFiles('ext/rav1e/Cargo.lock') }}-unix-static - restore-keys: | - cargo-registry-${{ runner.os }}-${{ hashFiles('ext/rav1e/Cargo.lock') }}- - cargo-registry-${{ runner.os }}- + codec-rav1e: 'LOCAL' - name: Build libavif (ninja) working-directory: ./build run: ninja diff --git a/.github/workflows/ci-unix-shared-installed.yml b/.github/workflows/ci-unix-shared-installed.yml index 5bacacce4d..26b607cdde 100644 --- a/.github/workflows/ci-unix-shared-installed.yml +++ b/.github/workflows/ci-unix-shared-installed.yml @@ -26,38 +26,24 @@ jobs: steps: - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 - - name: Set GCC & G++ compiler (on Linux) + - uses: ./.github/actions/setup-linux if: runner.os == 'Linux' - run: echo "CC=gcc-${{matrix.gcc}}" >> $GITHUB_ENV && echo "CXX=g++-${{matrix.gcc}}" >> $GITHUB_ENV + with: + codec-aom: 'SYSTEM' + codec-dav1d: 'SYSTEM' + codec-rav1e: 'OFF' + gcc-version: ${{ matrix.gcc }} + libyuv: 'SYSTEM' + - uses: ./.github/actions/setup-macos + if: runner.os == 'macOS' + with: + codec-aom: 'SYSTEM' + codec-dav1d: 'SYSTEM' + codec-rav1e: 'OFF' - name: Disable libyuv on macOS # TODO(yguyon): Install libyuv (not available with brew). if: runner.os == 'macOS' run: echo "CMAKE_AVIF_FLAGS=\"-DAVIF_LIBYUV=OFF\"" >> $GITHUB_ENV - - name: Cache external dependencies - id: cache-ext - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 - with: - path: ext, build/_deps - key: ${{ runner.os }}-unix-shared-installed-${{ hashFiles('cmake/Modules/*', 'ext/*.cmd', 'ext/*.sh') }} - - name: Setup cmake - if: runner.os == 'Linux' - uses: jwlawson/actions-setup-cmake@802fa1a2c4e212495c05bf94dba2704a92a472be # v2.0.2 - with: - cmake-version: '3.13.x' - - name: Print cmake version - run: cmake --version - - uses: seanmiddleditch/gha-setup-ninja@8b297075da4cd2a5f1fd21fe011b499edf06e9d2 # v4 - - name: Install dependencies (Linux) - if: runner.os == 'Linux' - run: | - echo "deb http://azure.archive.ubuntu.com/ubuntu/ jammy main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list - sudo apt-get update - sudo apt-get install libaom-dev libdav1d-dev libyuv-dev imagemagick - - name: Install dependencies (macOS) - if: runner.os == 'macOS' - run: brew install aom dav1d imagemagick - - name: Print ImageMagick version - run: convert --version # `sudo apt-get install googletest libgtest-dev` leads to the following: # "libgtest.a(gtest-all.cc.o): undefined reference to `std::__throw_bad_array_new_length()'" @@ -75,6 +61,7 @@ jobs: -DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=LOCAL -DAVIF_BUILD_GDK_PIXBUF=ON -DCMAKE_INSTALL_PREFIX=./install -DAVIF_ENABLE_WERROR=ON ${{ env.CMAKE_AVIF_FLAGS }} + - uses: ./.github/actions/cache - name: Build libavif (ninja) working-directory: ./build run: ninja diff --git a/.github/workflows/ci-unix-shared-local.yml b/.github/workflows/ci-unix-shared-local.yml index 34baf261a6..10d25e0484 100644 --- a/.github/workflows/ci-unix-shared-local.yml +++ b/.github/workflows/ci-unix-shared-local.yml @@ -31,34 +31,20 @@ jobs: steps: - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 - - name: Set GCC & G++ compiler (on Linux) + - uses: ./.github/actions/setup-linux if: runner.os == '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: Install dependencies (macOS) + codec-aom: 'LOCAL' + codec-dav1d: 'LOCAL' + codec-rav1e: 'LOCAL' + gcc-version: ${{ matrix.gcc }} + libyuv: ${{ matrix.libyuv }} + - uses: ./.github/actions/setup-macos if: runner.os == 'macOS' - run: brew install imagemagick - - name: Cache external dependencies - id: cache-ext - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 with: - path: ext, build/_deps - key: ${{ runner.os }}-${{ matrix.libyuv }}-unix-shared-local-${{ hashFiles('cmake/Modules/*', 'ext/*.cmd', 'ext/*.sh') }} - - name: Setup cmake - if: runner.os == 'Linux' - uses: jwlawson/actions-setup-cmake@802fa1a2c4e212495c05bf94dba2704a92a472be # v2.0.2 - with: - # CMake version 3.17 is required to build libwebp (which libsharpyuv is part of) on macOS. - cmake-version: '3.17.x' - - name: Print cmake version - run: cmake --version - - uses: ilammy/setup-nasm@13cbeb366c45c4379d3478cdcbadd8295feb5028 # v1.5.1 - - uses: seanmiddleditch/gha-setup-ninja@8b297075da4cd2a5f1fd21fe011b499edf06e9d2 # v4 - - run: pip install meson - - name: Print ImageMagick version - run: convert --version + codec-aom: 'LOCAL' + codec-dav1d: 'LOCAL' + codec-rav1e: 'LOCAL' - name: Prepare libavif (cmake) run: > @@ -72,6 +58,7 @@ jobs: -DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON -DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=LOCAL -DAVIF_ENABLE_WERROR=ON + - uses: ./.github/actions/cache - name: Build libavif (ninja) working-directory: ./build run: ninja diff --git a/.github/workflows/ci-unix-static-av2.yml b/.github/workflows/ci-unix-static-av2.yml index 97b604ce0a..404578ed78 100644 --- a/.github/workflows/ci-unix-static-av2.yml +++ b/.github/workflows/ci-unix-static-av2.yml @@ -30,39 +30,14 @@ jobs: steps: - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 - - name: Set GCC & G++ compiler (on Linux) - if: runner.os == 'Linux' - run: echo "CC=gcc-${{matrix.gcc}}" >> $GITHUB_ENV && echo "CXX=g++-${{matrix.gcc}}" >> $GITHUB_ENV - - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 + - uses: ./.github/actions/setup-linux with: - python-version: '3.x' - - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 - with: - profile: minimal - toolchain: stable - override: true - - name: Install cargo-c - env: - LINK: https://github.com/lu-zero/cargo-c/releases/latest/download - CARGO_C_FILE: cargo-c-x86_64-unknown-linux-musl.tar.gz - run: | - curl -L $LINK/$CARGO_C_FILE | tar xz -C ~/.cargo/bin - - name: Cache external dependencies - id: cache-ext - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 - with: - path: ext, build/_deps - key: ${{ runner.os }}-${{ matrix.also-enable-av1-codec }}-unix-static-av2-${{ hashFiles('cmake/Modules/*', 'ext/*.cmd', 'ext/*.sh') }} - - name: Setup cmake - uses: jwlawson/actions-setup-cmake@802fa1a2c4e212495c05bf94dba2704a92a472be # v2.0.2 - with: - # CMake version 3.17 is required to build libwebp (which libsharpyuv is part of) on macOS. - cmake-version: '3.17.x' - - name: Print cmake version - run: cmake --version - - uses: ilammy/setup-nasm@13cbeb366c45c4379d3478cdcbadd8295feb5028 # v1.5.1 - - uses: seanmiddleditch/gha-setup-ninja@8b297075da4cd2a5f1fd21fe011b499edf06e9d2 # v4 - - run: pip install meson + codec-aom: 'LOCAL' + codec-dav1d: ${{ matrix.also-enable-av1-codecs }} + codec-rav1e: ${{ matrix.also-enable-av1-codecs }} + gcc-version: ${{ matrix.gcc }} + libyuv: 'LOCAL' + recent-cmake: true - name: Prepare libavif (cmake) run: > @@ -79,15 +54,9 @@ jobs: -DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON -DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=LOCAL -DAVIF_ENABLE_WERROR=ON - - name: Cache cargo registry - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 - continue-on-error: true + - uses: ./.github/actions/cache with: - path: ~/.cargo/registry/cache - key: cargo-registry-${{ runner.os }}-${{ hashFiles('ext/rav1e/Cargo.lock') }}-unix-static-av2 - restore-keys: | - cargo-registry-${{ runner.os }}-${{ hashFiles('ext/rav1e/Cargo.lock') }}- - cargo-registry-${{ runner.os }}- + codec-rav1e: 'LOCAL' - name: Build libavif (ninja) working-directory: ./build run: ninja diff --git a/.github/workflows/ci-unix-static-sanitized.yml b/.github/workflows/ci-unix-static-sanitized.yml index dfd42b4dd3..08a1a5aef7 100644 --- a/.github/workflows/ci-unix-static-sanitized.yml +++ b/.github/workflows/ci-unix-static-sanitized.yml @@ -26,25 +26,20 @@ jobs: steps: - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 - - - name: Setup cmake + - uses: ./.github/actions/setup-linux if: runner.os == 'Linux' - uses: jwlawson/actions-setup-cmake@802fa1a2c4e212495c05bf94dba2704a92a472be # v2.0.2 with: - # CMake version 3.17 is required to build libwebp (which libsharpyuv is part of) on macOS. - cmake-version: '3.17.x' - - uses: ilammy/setup-nasm@13cbeb366c45c4379d3478cdcbadd8295feb5028 # v1.5.1 - - uses: seanmiddleditch/gha-setup-ninja@8b297075da4cd2a5f1fd21fe011b499edf06e9d2 # v4 - - run: pip install meson - - name: Install dependencies (macOS) + codec-aom: 'LOCAL' + codec-dav1d: 'LOCAL' + libyuv: 'LOCAL' + recent-cmake: true + - uses: ./.github/actions/setup-macos if: runner.os == 'macOS' - run: brew install aom dav1d imagemagick libpng - - name: Cache external dependencies - id: cache-ext - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 with: - path: ext, build/_deps - key: ${{ runner.os }}-${{ matrix.sanitizer }}-unix-static-sanitized-${{ hashFiles('cmake/Modules/*', 'ext/*.cmd', 'ext/*.sh') }} + codec-aom: 'LOCAL' + codec-dav1d: 'LOCAL' + codec-rav1e: 'OFF' + - name: Build aom if: steps.cache-ext.outputs.cache-hit != 'true' working-directory: ./ext @@ -93,6 +88,7 @@ jobs: CFLAGS: -fsanitize=${{ matrix.sanitizer }} CXXFLAGS: -fsanitize=${{ matrix.sanitizer }} LDFLAGS: -fsanitize=${{ matrix.sanitizer }} + - uses: ./.github/actions/cache - name: Build libavif (ninja) working-directory: ./build run: ninja diff --git a/.github/workflows/ci-unix-static.yml b/.github/workflows/ci-unix-static.yml index e5088624b1..6e86d45c80 100644 --- a/.github/workflows/ci-unix-static.yml +++ b/.github/workflows/ci-unix-static.yml @@ -31,55 +31,23 @@ jobs: steps: - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 - - name: Set GCC & G++ compiler (on Linux) + - uses: ./.github/actions/setup-linux if: runner.os == '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' - - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 - with: - profile: minimal - toolchain: stable - override: true - - name: Install dependencies (macOS) + codec-aom: 'LOCAL' + codec-dav1d: 'LOCAL' + codec-rav1e: 'LOCAL' + gcc-version: ${{ matrix.gcc }} + libxml2: 'LOCAL' + libyuv: 'LOCAL' + recent-cmake: true + - uses: ./.github/actions/setup-macos if: runner.os == 'macOS' - run: brew install imagemagick - - name: Install cargo-c (linux) - if: matrix.os == 'ubuntu-latest' - env: - LINK: https://github.com/lu-zero/cargo-c/releases/latest/download - CARGO_C_FILE: cargo-c-x86_64-unknown-linux-musl.tar.gz - run: | - curl -L $LINK/$CARGO_C_FILE | tar xz -C ~/.cargo/bin - - name: Install cargo-c (mac) - if: matrix.os == 'macos-latest' - env: - LINK: https://github.com/lu-zero/cargo-c/releases/latest/download - CARGO_C_FILE: cargo-c-macos.zip - run: | - curl -sLo $CARGO_C_FILE $LINK/$CARGO_C_FILE - unzip -o $CARGO_C_FILE -d ~/.cargo/bin - rm $CARGO_C_FILE - - name: Cache external dependencies - id: cache-ext - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 with: - path: ext, build/_deps - key: ${{ runner.os }}-${{ matrix.build-type }}-unix-static-${{ hashFiles('cmake/Modules/*', 'ext/*.cmd', 'ext/*.sh') }} - - name: Setup cmake - if: matrix.os == 'ubuntu-latest' - uses: jwlawson/actions-setup-cmake@802fa1a2c4e212495c05bf94dba2704a92a472be # v2.0.2 - with: - # CMake version 3.18 is required to build 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 - - run: pip install meson - - name: Print ImageMagick version - run: convert --version + codec-aom: 'LOCAL' + codec-dav1d: 'LOCAL' + codec-rav1e: 'LOCAL' + - name: Prepare libavif (cmake) run: > mkdir build && cd build @@ -97,15 +65,9 @@ jobs: -DAVIF_ENABLE_EXPERIMENTAL_MINI=ON -DAVIF_ENABLE_EXPERIMENTAL_SAMPLE_TRANSFORM=ON -DAVIF_ENABLE_WERROR=ON - - name: Cache cargo registry - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 - continue-on-error: true + - uses: ./.github/actions/cache with: - path: ~/.cargo/registry/cache - key: cargo-registry-${{ runner.os }}-${{ hashFiles('ext/rav1e/Cargo.lock') }}-unix-static - restore-keys: | - cargo-registry-${{ runner.os }}-${{ hashFiles('ext/rav1e/Cargo.lock') }}- - cargo-registry-${{ runner.os }}- + codec-rav1e: 'LOCAL' - name: Build libavif (ninja) working-directory: ./build run: ninja diff --git a/.github/workflows/ci-windows-artifacts.yml b/.github/workflows/ci-windows-artifacts.yml index ce9d515fd3..cee4aedd7e 100644 --- a/.github/workflows/ci-windows-artifacts.yml +++ b/.github/workflows/ci-windows-artifacts.yml @@ -9,7 +9,7 @@ permissions: contents: write jobs: - build-static: + build-windows-artifacts: runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -21,17 +21,11 @@ jobs: - name: Setup Visual Studio shell if: runner.os == 'Windows' uses: egor-tensin/vs-shell@9a932a62d05192eae18ca370155cf877eecc2202 # v2.1 - - name: Cache external dependencies - id: cache-ext - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 + - uses: ./.github/actions/setup-common with: - path: ext, build/_deps - key: ${{ runner.os }}-${{ hashFiles('cmake/Modules/*', 'ext/*.cmd', 'ext/*.sh') }}-releasedeps - - name: Print cmake version - run: cmake --version - - uses: ilammy/setup-nasm@13cbeb366c45c4379d3478cdcbadd8295feb5028 # v1.5.1 - - uses: seanmiddleditch/gha-setup-ninja@8b297075da4cd2a5f1fd21fe011b499edf06e9d2 # v4 - - run: pip install meson + codec-aom: 'LOCAL' + codec-dav1d: 'LOCAL' + - name: Build aom if: steps.cache-ext.outputs.cache-hit != 'true' working-directory: ./ext @@ -80,6 +74,7 @@ jobs: -DAVIF_JPEG=LOCAL -DAVIF_ZLIBPNG=LOCAL -DAVIF_BUILD_EXAMPLES=OFF -DAVIF_BUILD_APPS=ON -DAVIF_BUILD_TESTS=OFF -DAVIF_ENABLE_WERROR=ON + - uses: ./.github/actions/cache - name: Build libavif (ninja) working-directory: ./build run: ninja diff --git a/.github/workflows/ci-windows-installed.yml b/.github/workflows/ci-windows-installed.yml index 7bfdd95ca1..ea1cb9f04b 100644 --- a/.github/workflows/ci-windows-installed.yml +++ b/.github/workflows/ci-windows-installed.yml @@ -25,11 +25,12 @@ jobs: - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 - name: Setup Visual Studio shell uses: egor-tensin/vs-shell@9a932a62d05192eae18ca370155cf877eecc2202 # v2.1 - - name: Print CMake version - run: cmake --version - - uses: seanmiddleditch/gha-setup-ninja@8b297075da4cd2a5f1fd21fe011b499edf06e9d2 # v4 - - name: Print ImageMagick version - run: magick --version + - uses: ./.github/actions/setup-common + with: + codec-aom: 'SYSTEM' + codec-dav1d: 'SYSTEM' + codec-rav1e: 'SYSTEM' + - name: vcpkg build uses: johnwason/vcpkg-action@v6 id: vcpkg @@ -66,6 +67,7 @@ jobs: -DAVIF_ENABLE_EXPERIMENTAL_AVIR=ON -DAVIF_ENABLE_EXPERIMENTAL_SAMPLE_TRANSFORM=ON -DAVIF_ENABLE_WERROR=ON + - uses: ./.github/actions/cache - name: Build libavif (ninja) working-directory: ./build run: ninja diff --git a/.github/workflows/ci-windows.yml b/.github/workflows/ci-windows.yml index 0dba89eaa4..06f1720b35 100644 --- a/.github/workflows/ci-windows.yml +++ b/.github/workflows/ci-windows.yml @@ -41,34 +41,12 @@ jobs: - name: Setup Visual Studio shell if: runner.os == 'Windows' uses: egor-tensin/vs-shell@9a932a62d05192eae18ca370155cf877eecc2202 # v2.1 - - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 + - uses: ./.github/actions/setup-common with: - python-version: '3.x' - - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 - with: - profile: minimal - toolchain: stable - override: true + codec-aom: 'LOCAL' + codec-dav1d: 'LOCAL' + codec-rav1e: 'LOCAL' - - name: Cache external dependencies - id: cache-ext - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 - with: - path: ext, build/_deps - key: ${{ runner.os }}-${{ hashFiles('cmake/Modules/*', 'ext/*.cmd', 'ext/*.sh') }}-alldeps - - name: Install cargo-c - run: | - $LINK = "https://github.com/lu-zero/cargo-c/releases/latest/download" - $CARGO_C_FILE = "cargo-c-windows-msvc" - curl -LO "$LINK/$CARGO_C_FILE.zip" - 7z e -y "$CARGO_C_FILE.zip" -o"${env:USERPROFILE}\.cargo\bin" - - name: Print cmake version - run: cmake --version - - uses: ilammy/setup-nasm@13cbeb366c45c4379d3478cdcbadd8295feb5028 # v1.5.1 - - uses: seanmiddleditch/gha-setup-ninja@8b297075da4cd2a5f1fd21fe011b499edf06e9d2 # v4 - - run: pip install meson - - name: Print ImageMagick version - run: magick --version - name: Build aom if: steps.cache-ext.outputs.cache-hit != 'true' working-directory: ./ext @@ -107,14 +85,9 @@ jobs: -DAVIF_ENABLE_EXPERIMENTAL_MINI=ON -DAVIF_ENABLE_EXPERIMENTAL_SAMPLE_TRANSFORM=ON -DAVIF_ENABLE_WERROR=ON - - name: Cache cargo registry - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 - continue-on-error: true + - uses: ./.github/actions/cache with: - path: ~/.cargo/registry/cache - key: cargo-registry-${{ runner.os }}-${{ hashFiles('ext/rav1e/Cargo.lock') }}- - restore-keys: | - cargo-registry-${{ runner.os }}- + codec-rav1e: 'LOCAL' - name: Build libavif (ninja) working-directory: ./build run: ninja