Reorganize the CI for more flexibility (#2747)
- split vcpk installation
- have a CI for C conformance
diff --git a/.github/actions/setup-windows/action.yml b/.github/actions/setup-windows/action.yml
index 2e15044..cacc7c1 100644
--- a/.github/actions/setup-windows/action.yml
+++ b/.github/actions/setup-windows/action.yml
@@ -13,9 +13,17 @@
extra-cache-key:
description: "Extra cache key to use in the cache name. Useful when several caches are used in one workflow."
default: ""
+ libxml2:
+ description: "Can take the values: OFF, LOCAL, SYSTEM"
+ default: "OFF"
+ libyuv:
+ description: "Can take the values: OFF, LOCAL, SYSTEM"
+ default: "OFF"
outputs:
ext-cache-hit:
value: ${{ steps.cache.outputs.ext-cache-hit }}
+ vcpkg-cmake-config:
+ value: ${{ steps.vcpkg.outputs.vcpkg-cmake-config }}
runs:
using: "composite"
steps:
@@ -26,6 +34,37 @@
run: pip install meson
shell: bash
+ - name: Install libaom library
+ id: aom
+ if: ${{ inputs.codec-aom == 'SYSTEM' }}
+ run: echo "WIN_LIBRARIES=aom" >> "$GITHUB_OUTPUT"
+ shell: bash
+ - name: Install libdav1d library
+ id: dav1d
+ if: ${{ inputs.codec-dav1d == 'SYSTEM' }}
+ run: echo "WIN_LIBRARIES=dav1d" >> "$GITHUB_OUTPUT"
+ shell: bash
+ - name: Install libxml2 library
+ id: libxml2
+ if: ${{ inputs.libxml2 == 'SYSTEM' }}
+ run: echo "WIN_LIBRARIES=libxml2" >> "$GITHUB_OUTPUT"
+ shell: bash
+ - name: Install libyuv library
+ id: libyuv
+ if: ${{ inputs.libyuv == 'SYSTEM' }}
+ run: echo "WIN_LIBRARIES=libyuv" >> "$GITHUB_OUTPUT"
+ shell: bash
+
+ - name: Install libraries
+ uses: johnwason/vcpkg-action@v6
+ id: vcpkg
+ with:
+ pkgs: libjpeg-turbo libpng zlib ${{ steps.aom.outputs.WIN_LIBRARIES }} ${{ steps.dav1d.outputs.WIN_LIBRARIES }} ${{ steps.libxml2.outputs.WIN_LIBRARIES }} ${{ steps.libyuv.outputs.WIN_LIBRARIES }}
+ triplet: x64-windows-release
+ token: ${{ github.token }}
+ github-binarycache: true
+ cache-key: ${{ hashFiles('cmake/Modules/*', 'ext/*.cmd', 'ext/*.sh') }}
+
- uses: ./.github/actions/setup-common
with:
codec-aom: ${{ inputs.codec-aom }}
diff --git a/.github/workflows/ci-c-warnings.yml b/.github/workflows/ci-c-warnings.yml
new file mode 100644
index 0000000..8138056
--- /dev/null
+++ b/.github/workflows/ci-c-warnings.yml
@@ -0,0 +1,73 @@
+# This is a copy of ci-unix-shared-installed.yml for finding bugs when adding warnings.
+
+name: CI C conformance
+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-installed:
+ strategy:
+ fail-fast: false
+ # Generate the configurations:
+ # case 0: nodiscard
+ matrix:
+ os: [ubuntu-latest, windows-latest]
+ case: [0]
+
+ runs-on: ${{ matrix.os }}
+
+ steps:
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
+ - uses: ./.github/actions/setup-linux
+ if: runner.os == 'Linux'
+ with:
+ codec-aom: "SYSTEM"
+ codec-dav1d: "SYSTEM"
+ libyuv: "SYSTEM"
+ - uses: ./.github/actions/setup-windows
+ id: windows_setup
+ if: runner.os == 'Windows'
+ with:
+ codec-aom: "SYSTEM"
+ codec-dav1d: "SYSTEM"
+ libyuv: "SYSTEM"
+
+ - name: Set clang as compiler on Linux
+ if: runner.os == 'Linux'
+ run: |
+ echo "AVIF_CMAKE_C_COMPILER=-DCMAKE_C_COMPILER=clang" >> $GITHUB_ENV
+ echo "AVIF_CMAKE_CXX_COMPILER=-DCMAKE_CXX_COMPILER=clang++" >> $GITHUB_ENV
+ - name: Leave compiler as MSVC on Windows
+ if: runner.os == 'Windows'
+ run: |
+ echo "AVIF_CMAKE_C_COMPILER=" >> $env:GITHUB_ENV
+ echo "AVIF_CMAKE_CXX_COMPILER=" >> $env:GITHUB_ENV
+
+ - name: Enable nodiscard
+ if: ${{ matrix.case == 0}}
+ run: echo "CMAKE_AVIF_FLAGS=\"-DAVIF_ENABLE_NODISCARD=ON\"" >> $GITHUB_ENV
+
+ - name: Prepare libavif (cmake)
+ run: >
+ cmake ${{ steps.windows_setup.outputs.vcpkg-cmake-config }} -G Ninja -S . -B build
+ -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON
+ -DAVIF_CODEC_AOM=SYSTEM
+ -DAVIF_CODEC_AOM_DECODE=OFF -DAVIF_CODEC_AOM_ENCODE=ON
+ -DAVIF_CODEC_DAV1D=SYSTEM
+ -DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON
+ -DAVIF_BUILD_TESTS=ON -DAVIF_GTEST=LOCAL
+ -DAVIF_BUILD_GDK_PIXBUF=ON -DCMAKE_INSTALL_PREFIX=./build/install
+ -DAVIF_ENABLE_WERROR=ON ${{ env.AVIF_CMAKE_C_COMPILER}} ${{ env.AVIF_CMAKE_CXX_COMPILER }}
+ ${{ env.CMAKE_AVIF_FLAGS }}
+ - name: Build libavif
+ run: cmake --build build --config Release --parallel 4
+ - name: Run AVIF Tests
+ working-directory: ./build
+ run: ctest -j $(getconf _NPROCESSORS_ONLN) --output-on-failure
diff --git a/.github/workflows/ci-unix-shared-installed.yml b/.github/workflows/ci-unix-shared-installed.yml
index 64bd140..a9c19ea 100644
--- a/.github/workflows/ci-unix-shared-installed.yml
+++ b/.github/workflows/ci-unix-shared-installed.yml
@@ -90,19 +90,3 @@
endif()" >> CMakeLists.txt
cmake . -DCMAKE_PREFIX_PATH=../install
- - name: Prepare libavif with [[nodiscard]] (cmake)
- # CMake 3.21 is needed to force C23 for [[nodiscard]].
- if: runner.oldest-cmake == 'false'
- run: >
- cmake -G Ninja -S . -B build_nodiscard
- -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON
- -DAVIF_CODEC_AOM=SYSTEM
- -DAVIF_CODEC_AOM_DECODE=OFF -DAVIF_CODEC_AOM_ENCODE=ON
- -DAVIF_CODEC_DAV1D=SYSTEM
- -DAVIF_ENABLE_NODISCARD=ON -DAVIF_ENABLE_WERROR=ON
- -DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON
- -DAVIF_BUILD_TESTS=ON -DAVIF_GTEST=LOCAL
- -DAVIF_BUILD_GDK_PIXBUF=ON ${{ env.CMAKE_AVIF_FLAGS }}
- - name: Build libavif with [[nodiscard]]
- if: runner.oldest-cmake == 'false'
- run: cmake --build build_nodiscard --config Release --parallel 4
diff --git a/.github/workflows/ci-windows-installed.yml b/.github/workflows/ci-windows-installed.yml
index e89b734..48b765e 100644
--- a/.github/workflows/ci-windows-installed.yml
+++ b/.github/workflows/ci-windows-installed.yml
@@ -26,11 +26,14 @@
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: ./.github/actions/setup-windows
+ id: setup
with:
codec-aom: "SYSTEM"
codec-dav1d: "SYSTEM"
codec-rav1e: "SYSTEM"
extra-cache-key: ${{ matrix.compiler }}
+ libxml2: "SYSTEM"
+ libyuv: "SYSTEM"
- name: Leave compiler as default
if: matrix.compiler == 'msvc'
run: |
@@ -42,15 +45,6 @@
echo "AVIF_CMAKE_C_COMPILER=-DCMAKE_C_COMPILER=clang-cl" >> $env:GITHUB_ENV
echo "AVIF_CMAKE_CXX_COMPILER=-DCMAKE_CXX_COMPILER=clang-cl" >> $env:GITHUB_ENV
- - name: vcpkg build
- uses: johnwason/vcpkg-action@v6
- id: vcpkg
- with:
- pkgs: aom dav1d libjpeg-turbo libpng libxml2 libyuv zlib
- triplet: x64-windows-release
- token: ${{ github.token }}
- github-binarycache: true
- cache-key: ${{ hashFiles('cmake/Modules/*', 'ext/*.cmd', 'ext/*.sh') }}
- name: Install rav1e
run: |
$LINK = "https://github.com/xiph/rav1e/releases/download/v0.7.1"
@@ -65,7 +59,7 @@
mv ${{ github.workspace }}\tmp\rav1e-windows-msvc-sdk\lib\pkgconfig\* ${{ github.workspace }}\vcpkg\installed\x64-windows-release\lib\pkgconfig
- name: Prepare libavif (cmake)
run: >
- cmake ${{ steps.vcpkg.outputs.vcpkg-cmake-config }} -G Ninja -S . -B build
+ cmake ${{ steps.setup.outputs.vcpkg-cmake-config }} -G Ninja -S . -B build
-DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF
-DAVIF_CODEC_AOM=SYSTEM -DAVIF_CODEC_DAV1D=SYSTEM
-DAVIF_CODEC_RAV1E=SYSTEM