Extract CI deps installation into script #9779
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copyright (c) the JPEG XL Project Authors. All rights reserved. | |
| # | |
| # Use of this source code is governed by a BSD-style | |
| # license that can be found in the LICENSE file. | |
| # Workflow for building and running tests. | |
| name: Build/Test Cross | |
| on: | |
| merge_group: | |
| push: | |
| branches: | |
| - main | |
| - v*.*.x | |
| pull_request: | |
| types: [opened, reopened, labeled, unlabeled, synchronize] | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| jobs: | |
| compile: | |
| name: Cross-compiling ${{ matrix.identifier }} | |
| if: ${{ !contains(github.event.pull_request.labels.*.name, 'CI:none') }} | |
| runs-on: ${{ matrix.os || 'ubuntu-latest' }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| identifier: [armhf, i386] | |
| include: | |
| - arch: armhf | |
| host_arch: arm64 | |
| os: ubuntu-24.04-arm | |
| identifier: armhf | |
| test_in_pr: true | |
| build_target: arm-linux-gnueabihf | |
| - arch: i386 | |
| host_arch: amd64 | |
| identifier: i386 | |
| test_in_pr: true | |
| build_target: i686-linux-gnu | |
| env: | |
| BUILD_DIR: build | |
| WILL_RUN_TESTS: ${{ (github.event_name == 'push' || (github.event_name == 'pull_request' && (matrix.test_in_pr || contains(github.event.pull_request.labels.*.name, 'CI:full')))) }} | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout the source | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| submodules: true | |
| fetch-depth: 1 | |
| - name: Install build deps | |
| run: | | |
| sudo ARCH=${{ matrix.arch }} HOST_ARCH=${{ matrix.host_arch }} BUILD_TARGET=${{ matrix.build_target }} \ | |
| ./tools/scripts/install_deps.sh --cross build extras | |
| echo "CC=gcc-14" >> $GITHUB_ENV | |
| echo "CXX=g++-14" >> $GITHUB_ENV | |
| - name: Build | |
| run: | | |
| CMAKE_FLAGS="${{ matrix.cmake_flags }}" ./ci.sh release \ | |
| -DJPEGXL_FORCE_SYSTEM_BROTLI=ON \ | |
| -DJPEGXL_ENABLE_JNI=OFF \ | |
| ${{ join(matrix.cmake_args, ' ') }} | |
| env: | |
| SKIP_TEST: 1 | |
| BUILD_TARGET: ${{ matrix.build_target }} | |
| TARGETS: ${{ env.WILL_RUN_TESTS == 'true' && 'all_tests cjxl djxl libjxl.so libjxl_dec.so' || 'all' }} | |
| - name: Build stats | |
| run: | | |
| tools/scripts/build_stats.py --save build/stats.json \ | |
| --binutils ${{ matrix.build_target }}- \ | |
| --max-stack ${{ matrix.max_stack || '0' }} \ | |
| cjxl djxl libjxl.so libjxl_dec.so | |
| - name: Prepare artefacts | |
| if: env.WILL_RUN_TESTS == 'true' | |
| run: | | |
| find ./build -regextype egrep -type f -regex '.*\.(a|h|jar|log|o)' | |
| find ./build -type f -executable > executable.lst | |
| - name: Test ranging | |
| if: ${{ !matrix.disable_tests }} | |
| run: | | |
| mkdir -p ./build/Testing/Temporary | |
| unzip ./tools/scripts/test_cost-${{ matrix.identifier }}.zip -d ./build/Testing/Temporary | |
| - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 | |
| if: env.WILL_RUN_TESTS == 'true' | |
| with: | |
| name: cross_binary-${{ matrix.identifier }} | |
| path: | | |
| build/ | |
| ci.sh | |
| executable.lst | |
| testdata/ | |
| retention-days: 1 | |
| test: | |
| name: Testing ${{ matrix.identifier }} shard ${{ matrix.shard_number }} | |
| if: ${{ !contains(github.event.pull_request.labels.*.name, 'CI:none') }} | |
| needs: compile | |
| runs-on: ${{ matrix.os || 'ubuntu-latest' }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| shard_number: [0, 1] | |
| identifier: [armhf, i386] | |
| include: | |
| - arch: armhf | |
| os: ubuntu-24.04-arm | |
| identifier: armhf | |
| test_in_pr: true | |
| last_shard: 2 | |
| - arch: i386 | |
| identifier: i386 | |
| test_in_pr: true | |
| last_shard: 2 | |
| env: | |
| BUILD_DIR: build | |
| UPLOAD_TEST_COST: false | |
| LAST_SHARD: ${{ false && 1 || matrix.last_shard}} | |
| # Run the tests on push and when requested in pull_request. | |
| WILL_RUN_TESTS: ${{ (github.event_name == 'push' || (github.event_name == 'pull_request' && (matrix.test_in_pr || contains(github.event.pull_request.labels.*.name, 'CI:full')))) }} | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 | |
| with: | |
| egress-policy: audit | |
| - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
| if: (matrix.shard_number < env.LAST_SHARD) && (env.WILL_RUN_TESTS == 'true') | |
| with: | |
| name: cross_binary-${{ matrix.identifier }} | |
| - name: Install build deps | |
| if: (matrix.shard_number < env.LAST_SHARD) && (env.WILL_RUN_TESTS == 'true') | |
| run: | | |
| sudo ARCH=${{ matrix.arch }} HOST_ARCH=${{ matrix.host_arch }} BUILD_TARGET=${{ matrix.build_target }} \ | |
| ./tools/scripts/install_deps.sh --cross extras_runtime | |
| - name: Prepare | |
| if: (env.UPLOAD_TEST_COST == 'true') && (matrix.shard_number == 0) && (env.WILL_RUN_TESTS == 'true') | |
| run: | | |
| rm build/Testing/Temporary/CTestCostData.txt | |
| - name: Test | |
| if: (matrix.shard_number < env.LAST_SHARD) && (env.WILL_RUN_TESTS == 'true') | |
| run: | | |
| chmod +x ./ci.sh | |
| chmod +x `cat executable.lst` | |
| ./ci.sh test \ | |
| -I ${{ matrix.shard_number }},,${{ env.LAST_SHARD }} \ | |
| -E '(bash_test|conformance_tooling_test|test_jxl_jni_wrapper|test_jpegli_jni_wrapper)' | |
| - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 | |
| name: Upload test cost | |
| if: (env.UPLOAD_TEST_COST == 'true') && (matrix.shard_number == 0) && (env.WILL_RUN_TESTS == 'true') | |
| with: | |
| name: test_cost-${{ matrix.identifier }} | |
| path: | | |
| build/Testing/Temporary/CTestCostData.txt | |
| retention-days: 1 |