Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace recent-cmake action variable with oldest-cmake #2413

Merged
merged 2 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions .github/actions/setup-common/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ inputs:
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'
oldest-cmake:
vrabaud marked this conversation as resolved.
Show resolved Hide resolved
description: 'Can take the values: true, false. Only useful on Linux to force using the minimum required CMake'
default: 'false'
runs:
using: "composite"
Expand All @@ -20,19 +20,12 @@ runs:
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: '3.x'
- name: Set up CMake < 3.21
if: ${{ runner.os == 'Linux' && inputs.recent-cmake == 'false' }}
- name: Set up CMake 3.13
if: ${{ runner.os == 'Linux' && inputs.oldest-cmake == 'true' }}
uses: jwlawson/actions-setup-cmake@802fa1a2c4e212495c05bf94dba2704a92a472be # v2.0.2
with:
# Use the minimum required version of cmake.
cmake-version: '3.13.x'
- name: Set up CMake >= 3.25
if: ${{ runner.os == 'Linux' && inputs.recent-cmake == 'true' }}
uses: jwlawson/actions-setup-cmake@802fa1a2c4e212495c05bf94dba2704a92a472be # v2.0.2
with:
# Need cmake 3.21 to set CMAKE_C_STANDARD to 23 for [[nodiscard]].
# Need cmake 3.25 for fuzztest
cmake-version: '3.25.x'
- name: Print CMake version
run: cmake --version
shell: bash
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/setup-linux/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ inputs:
libyuv:
description: 'Can take the values: OFF, LOCAL, SYSTEM'
default: 'OFF'
recent-cmake:
oldest-cmake:
description: 'Can take the values: true, false'
default: 'false'
outputs:
Expand Down Expand Up @@ -80,7 +80,7 @@ runs:
codec-aom: ${{ inputs.codec-aom }}
codec-dav1d: ${{ inputs.codec-dav1d }}
codec-rav1e: ${{ inputs.codec-rav1e }}
recent-cmake: ${{ inputs.recent-cmake }}
oldest-cmake: ${{ inputs.oldest-cmake }}
- uses: ./.github/actions/cache
id: cache
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-android-emulator-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
with:
codec-dav1d: 'LOCAL'
libyuv: 'LOCAL'
oldest-cmake: true
- name: Setup JDK
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
with:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/ci-android-jni.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ jobs:
with:
codec-aom: 'LOCAL'
codec-dav1d: 'LOCAL'
recent-cmake: 'true'
- name: Setup JDK
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
with:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/ci-disable-gtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ jobs:
codec-rav1e: 'LOCAL'
gcc-version: ${{ matrix.gcc }}
libyuv: 'LOCAL'
recent-cmake: 'true'

- name: Prepare libavif (cmake)
run: >
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/ci-fuzztest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ jobs:
codec-dav1d: 'LOCAL'
libxml2: 'LOCAL'
libyuv: ${{ matrix.libyuv }}
recent-cmake: 'true'
- name: Build fuzztest
if: steps.setup.outputs.ext-cache-hit != 'true'
working-directory: ./ext
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/ci-linux-golden-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ jobs:
gcc-version: ${{ matrix.gcc }}
libxml2: 'LOCAL'
libyuv: 'LOCAL'
recent-cmake: 'true'
- name: Build mp4box
if: steps.setup.outputs.ext-cache-hit != 'true'
working-directory: ./ext
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/ci-linux-static-old-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ jobs:
gcc-version: ${{ matrix.gcc }}
libxml2: 'LOCAL'
libyuv: 'LOCAL'
recent-cmake: 'true'
- name: Prepare libavif (cmake)
run: >
cmake .. -G Ninja -S . -B build
Expand Down
19 changes: 15 additions & 4 deletions .github/workflows/ci-unix-shared-installed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,24 @@ concurrency:

jobs:
build-shared-installed:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
# Generate the configurations:
# Ubuntu with gcc 14 with oldest-cmake set to true or false
# OSX with default gcc and CMake (oldest-cmake is unused on OSX)
matrix:
os: [ubuntu-24.04, macos-latest]
oldest-cmake: [false, true]
include:
- runs-on: ubuntu-24.04
# Add a gcc version on Ubuntu only
- os: ubuntu-24.04
compiler: gcc
gcc: 14
exclude:
# Do not use the oldest CMake on OSX
- os: macos-latest
oldest-cmake: true
vrabaud marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
Expand All @@ -34,8 +43,7 @@ jobs:
gcc-version: ${{ matrix.gcc }}
gtest: 'SYSTEM'
libyuv: 'SYSTEM'
# Need cmake 3.21 to force C23 for [[nodiscard]].
recent-cmake: 'true'
oldest-cmake: ${{ matrix.oldest-cmake }}
- uses: ./.github/actions/setup-macos
if: runner.os == 'macOS'
with:
Expand Down Expand Up @@ -84,6 +92,8 @@ jobs:

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'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: This is a comment, not a request for change.

Here is an example where a cmake-version option would be better. We may be able to check if cmake-version is >= 3.21. The current check of runner.oldest-cmake == 'false' will become incorrect if our minimum required version is bumped to 3.21.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, I just removed one CMake version in .github/actions/setup-common/action.yml. Imposing a version in the condition means we need to install two CMake for the same job and dynamically choose one or the other. Or we split the job. I believe I chose the least confusing solution that is easy for future maintenance: when we bump the minimum CMake version, we might delete oldest-cmake altogether (but as you mention, we will indeed to check all usages of oldest-cmake in the scripts).

run: >
cmake -G Ninja -S . -B build_nodiscard
-DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON
Expand All @@ -95,5 +105,6 @@ jobs:
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=LOCAL
-DAVIF_BUILD_GDK_PIXBUF=ON ${{ env.CMAKE_AVIF_FLAGS }}
- name: Build libavif with [[nodiscard]] (ninja)
if: runner.oldest-cmake == 'false'
working-directory: ./build_nodiscard
run: ninja
1 change: 0 additions & 1 deletion .github/workflows/ci-unix-shared-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ jobs:
gcc-version: ${{ matrix.gcc }}
libxml2: 'LOCAL'
libyuv: ${{ matrix.libyuv }}
recent-cmake: 'true'
- uses: ./.github/actions/setup-macos
if: runner.os == 'macOS'
with:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/ci-unix-static-av2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ jobs:
extra-cache-key: ${{ matrix.also-enable-av1-codecs }}
gcc-version: ${{ matrix.gcc }}
libyuv: 'LOCAL'
recent-cmake: 'true'

- name: Prepare libavif (cmake)
run: >
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/ci-unix-static-sanitized.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ jobs:
codec-aom: 'LOCAL'
codec-dav1d: 'LOCAL'
libyuv: 'LOCAL'
recent-cmake: 'true'
extra-cache-key: ${{ matrix.sanitizer }}
- uses: ./.github/actions/setup-macos
if: runner.os == 'macOS'
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/ci-unix-static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ jobs:
gcc-version: ${{ matrix.gcc }}
libxml2: 'LOCAL'
libyuv: 'LOCAL'
recent-cmake: 'true'
- uses: ./.github/actions/setup-macos
if: runner.os == 'macOS'
with:
Expand Down
Loading