libjxl

FORK: libjxl patches used on blog
git clone https://git.neptards.moe/blog/libjxl.git
Log | Files | Refs | Submodules | README | LICENSE

conformance.yml (7811B)


      1 # Copyright (c) the JPEG XL Project Authors. All rights reserved.
      2 #
      3 # Use of this source code is governed by a BSD-style
      4 # license that can be found in the LICENSE file.
      5 
      6 # Workflow for running conformance tests.
      7 
      8 name: Conformance
      9 on:
     10   merge_group:
     11   push:
     12     branches:
     13       - main
     14       - v*.*.x
     15   pull_request:
     16     types: [opened, reopened, labeled, synchronize]
     17 
     18 permissions:
     19   contents: read
     20 
     21 env:
     22   CONFORMANCE_REPO_HASH: ee6008ef151489a5330cd886b422af8f6ed58881
     23   LIBJXL_VERSION: "0.10.4"
     24   LIBJXL_ABI_VERSION: "0.10"
     25 
     26 concurrency:
     27   group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
     28   cancel-in-progress: ${{ github.event_name == 'pull_request' }}
     29 
     30 jobs:
     31   warmup: # If necessary, fetch files just once, before tests are run.
     32     name: Warmup caches
     33     runs-on: ubuntu-latest
     34     steps:
     35     - name: Harden Runner
     36       uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
     37       with:
     38         egress-policy: audit
     39 
     40     - name: Checkout the conformance source
     41       uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
     42       with:
     43         repository: libjxl/conformance
     44         ref: ${{ env.CONFORMANCE_REPO_HASH }}
     45         path: conformance
     46     - name: Cache
     47       uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
     48       with:
     49         path: ${{ github.workspace }}/conformance/.objects
     50         key: conformance-refs
     51     - name: Download and link conformance files
     52       run: |
     53         ${{ github.workspace }}/conformance/scripts/download_and_symlink.sh
     54 
     55   build:
     56     name: Conformance Build ${{ matrix.name }}
     57     runs-on: ubuntu-latest
     58     strategy:
     59       fail-fast: false
     60       matrix:
     61         include:
     62           - name: AVX3
     63             cflags: -DHWY_DISABLED_TARGETS=HWY_AVX3-1
     64           - name: AVX2
     65             cflags: -DHWY_DISABLED_TARGETS=HWY_AVX2-1
     66           - name: SSE4
     67             cflags: -DHWY_DISABLED_TARGETS=HWY_SSE4-1
     68           - name: SSSE3
     69             cflags: -DHWY_DISABLED_TARGETS=HWY_SSSE3-1
     70           - name: EMU128
     71             cflags: -DHWY_COMPILE_ONLY_EMU128=1
     72           - name: SCALAR
     73             cflags: -DHWY_COMPILE_ONLY_SCALAR=1
     74           - name: SCALAR_ASAN
     75             cflags: -DHWY_COMPILE_ONLY_SCALAR=1
     76             build_type: asan
     77     env:
     78       CCACHE_DIR: ${{ github.workspace }}/.ccache
     79     steps:
     80     - name: Harden Runner
     81       uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
     82       with:
     83         egress-policy: audit
     84 
     85     - name: Install build deps
     86       run: |
     87         sudo rm -f /var/lib/man-db/auto-update
     88         sudo apt update
     89         sudo apt install -y \
     90           ccache \
     91           clang \
     92           cmake \
     93           doxygen \
     94           graphviz \
     95           libbenchmark-dev \
     96           libbenchmark-tools \
     97           libbrotli-dev \
     98           libgdk-pixbuf2.0-dev \
     99           libgif-dev \
    100           libgtest-dev \
    101           libgtk2.0-dev  \
    102           libjpeg-dev \
    103           libopenexr-dev \
    104           libpng-dev \
    105           libwebp-dev \
    106           ninja-build \
    107           pkg-config \
    108           xvfb \
    109           ${{ matrix.apt_pkgs }} \
    110         #
    111         echo "CC=clang" >> $GITHUB_ENV
    112         echo "CXX=clang++" >> $GITHUB_ENV
    113     - name: Checkout the jxl source
    114       uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
    115       with:
    116         submodules: true
    117         fetch-depth: 2
    118     - name: Git environment
    119       id: git-env
    120       run: |
    121         echo "parent=$(git rev-parse ${{ github.sha }}^)" >> $GITHUB_OUTPUT
    122       shell: bash
    123     - name: ccache
    124       uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
    125       with:
    126         path: ${{ env.CCACHE_DIR }}
    127         # When the cache hits the key it is not updated, so if this is a rebuild
    128         # of the same Pull Request it will reuse the cache if still around. For
    129         # either Pull Requests or new pushes to main, this will use the parent
    130         # hash as the starting point from the restore-keys entry.
    131         key: conformance-${{ runner.os }}-${{ github.sha }}-${{ matrix.name }}
    132         restore-keys: |
    133           conformance-${{ runner.os }}-${{ steps.git-env.outputs.parent }}-${{ matrix.name }}
    134     - name: Build
    135       run: |
    136         mkdir -p ${CCACHE_DIR}
    137         echo "max_size = 200M" > ${CCACHE_DIR}/ccache.conf
    138         CMAKE_FLAGS="${{ matrix.cflags }}" \
    139         TARGETS="tools/djxl" \
    140         ./ci.sh ${{ matrix.build_type || 'release' }} -DJPEGXL_FORCE_SYSTEM_BROTLI=ON \
    141           -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
    142           -DCMAKE_C_COMPILER_LAUNCHER=ccache \
    143           -DBUILD_TESTING=OFF
    144         # Flatten the artifacts directory structure
    145         cp tools/conformance/conformance.py build/tools/conformance
    146         cp tools/conformance/lcms2.py build/tools/conformance
    147         cp build/tools/djxl build/tools/conformance
    148         cp build/lib/libjxl.so.${{ env.LIBJXL_VERSION }} build/tools/conformance
    149         cp build/lib/libjxl_cms.so.${{ env.LIBJXL_VERSION }} build/tools/conformance
    150         cp build/lib/libjxl_threads.so.${{ env.LIBJXL_VERSION }} build/tools/conformance
    151         cp build/lib/libjxl_extras_codec.so.${{ env.LIBJXL_VERSION }} build/tools/conformance
    152       env:
    153         SKIP_TEST: 1
    154     - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
    155       with:
    156         name: conformance_binary-${{ matrix.name }}
    157         path: |
    158           build/tools/conformance/conformance.py
    159           build/tools/conformance/lcms2.py
    160           build/tools/conformance/djxl
    161           build/tools/conformance/libjxl.so.${{ env.LIBJXL_VERSION }}
    162           build/tools/conformance/libjxl_cms.so.${{ env.LIBJXL_VERSION }}
    163           build/tools/conformance/libjxl_threads.so.${{ env.LIBJXL_VERSION }}
    164           build/tools/conformance/libjxl_extras_codec.so.${{ env.LIBJXL_VERSION }}
    165     - name: ccache stats
    166       run: ccache --show-stats
    167 
    168   run:
    169     name: Conformance Test ${{ matrix.name }} on ${{ matrix.target }}
    170     needs: [warmup, build]
    171     runs-on: ubuntu-latest
    172     strategy:
    173       fail-fast: false
    174       matrix:
    175         name: [main_level5, main_level10]
    176         target: [AVX3, AVX2, SSE4, SSSE3, EMU128, SCALAR, SCALAR_ASAN]
    177     steps:
    178     - name: Harden Runner
    179       uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
    180       with:
    181         egress-policy: audit
    182 
    183     - name: Install deps
    184       run: |
    185         pip install numpy
    186     - name: Checkout the conformance source
    187       uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
    188       with:
    189         repository: libjxl/conformance
    190         ref: ${{ env.CONFORMANCE_REPO_HASH }}
    191         path: conformance
    192     - name: Cache
    193       uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
    194       with:
    195         path: ${{ github.workspace }}/conformance/.objects
    196         key: conformance-refs
    197     - name: Download and link conformance files
    198       run: |
    199         ${{ github.workspace }}/conformance/scripts/download_and_symlink.sh
    200     - uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2
    201       with:
    202         name: conformance_binary-${{ matrix.target }}
    203     - name: Run conformance tests
    204       run: |
    205         chmod +x djxl
    206         ln -s libjxl.so.${{ env.LIBJXL_VERSION }} libjxl.so.${{ env.LIBJXL_ABI_VERSION }}
    207         ln -s libjxl_cms.so.${{ env.LIBJXL_VERSION }} libjxl_cms.so.${{ env.LIBJXL_ABI_VERSION }}
    208         ln -s libjxl_threads.so.${{ env.LIBJXL_VERSION }} libjxl_threads.so.${{ env.LIBJXL_ABI_VERSION }}
    209         ln -s libjxl_extras_codec.so.${{ env.LIBJXL_VERSION }} libjxl_extras_codec.so.${{ env.LIBJXL_ABI_VERSION }}
    210         export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`
    211         python conformance.py \
    212           --decoder=`pwd`/djxl \
    213           --corpus=`pwd`/conformance/testcases/${{ matrix.name }}.txt