libjxl

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

release.yaml (11982B)


      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 building the release binaries.
      7 #
      8 # This workflow runs as a post-submit step, when pushing to main or the release
      9 # branches (v*.*.x), and when creating a release in GitHub.
     10 #
     11 # In the GitHub release case, in addition to build the release binaries it also
     12 # uploads the binaries to the given release automatically.
     13 
     14 name: Release build / deploy
     15 on:
     16   merge_group:
     17   push:
     18     branches:
     19       - main
     20       - v*.*.x
     21   pull_request:
     22     types: [opened, reopened, labeled, synchronize]
     23     paths-ignore:
     24       - '**.md'
     25       - 'AUTHORS'
     26   release:
     27     types: [ published ]
     28   workflow_dispatch:
     29 
     30 permissions:
     31   contents: write
     32 
     33 concurrency:
     34   group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
     35   cancel-in-progress: ${{ github.event_name == 'pull_request' }}
     36 
     37 jobs:
     38   ubuntu_static_x86_64:
     39     name: Release linux x86_64 static
     40     runs-on: [ubuntu-latest]
     41     steps:
     42     - name: Harden Runner
     43       uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
     44       with:
     45         egress-policy: audit
     46 
     47     - name: Install build deps
     48       run: |
     49         sudo rm -f /var/lib/man-db/auto-update
     50         sudo apt update
     51         sudo apt install -y \
     52           asciidoc \
     53           clang \
     54           cmake \
     55           doxygen \
     56           graphviz \
     57           libbrotli-dev \
     58           libgdk-pixbuf2.0-dev \
     59           libgif-dev \
     60           libgtest-dev \
     61           libgtk2.0-dev  \
     62           libjpeg-dev \
     63           libopenexr-dev \
     64           libpng-dev \
     65           libwebp-dev \
     66           ninja-build \
     67           pkg-config \
     68         #
     69         echo "CC=clang" >> $GITHUB_ENV
     70         echo "CXX=clang++" >> $GITHUB_ENV
     71 
     72     - name: Checkout the source
     73       uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
     74       with:
     75         submodules: true
     76         fetch-depth: 1
     77 
     78     - name: Build
     79       env:
     80         SKIP_TEST: 1
     81       run: |
     82         ./ci.sh release \
     83           -DJPEGXL_DEP_LICENSE_DIR=/usr/share/doc \
     84           -DJPEGXL_STATIC=ON \
     85           -DBUILD_TESTING=OFF \
     86           -DJPEGXL_ENABLE_JPEGLI_LIBJPEG=OFF \
     87           -DJPEGXL_ENABLE_VIEWERS=OFF \
     88           -DJPEGXL_ENABLE_PLUGINS=OFF \
     89           -DJPEGXL_ENABLE_OPENEXR=OFF \
     90           -DJPEGXL_ENABLE_DEVTOOLS=ON \
     91 
     92     - name: Package release tarball
     93       run: |
     94         cd build
     95         tar -zcvf ${{ runner.workspace }}/release_file.tar.gz \
     96           LICENSE* tools/{cjxl,djxl,benchmark_xl,cjpegli,djpegli,jxlinfo,butteraugli_main,ssimulacra2}
     97         ln -s ${{ runner.workspace }}/release_file.tar.gz \
     98           ${{ runner.workspace }}/jxl-linux-x86_64-static-${{ github.event.release.tag_name }}.tar.gz
     99 
    100     - name: Upload artifacts
    101       uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
    102       with:
    103         name: jxl-linux-x86_64-static
    104         path: ${{ runner.workspace }}/release_file.tar.gz
    105 
    106     - name: Upload binaries to release
    107       if: github.event_name == 'release'
    108       uses: AButler/upload-release-assets@c94805dc72e4b20745f543da0f62eaee7722df7a # v2.0.2
    109       with:
    110         files: ${{ runner.workspace }}/jxl-linux-x86_64-static-${{ github.event.release.tag_name }}.tar.gz
    111         repo-token: ${{ secrets.GITHUB_TOKEN }}
    112 
    113 
    114   # Build .deb packages Ubuntu/Debian
    115   release_ubuntu_pkg:
    116     name: .deb packages / ${{ matrix.os }}
    117     runs-on: ubuntu-latest
    118     strategy:
    119       fail-fast: false
    120       matrix:
    121         os:
    122         - ubuntu:22.04
    123         - ubuntu:20.04
    124         - debian:bullseye
    125         - debian:bookworm
    126         # GIMP package is removed: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1078402
    127         # - debian:trixie
    128         - debian:sid
    129 
    130     container:
    131       image: ${{ matrix.os }}
    132 
    133     steps:
    134     - name: Harden Runner
    135       uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
    136       with:
    137         egress-policy: audit
    138 
    139     - name: Set env
    140       shell: 'bash'
    141       id: 'env'
    142       run: |
    143         artifact_name="jxl-debs-amd64-${matrix_os/:/-}"
    144         echo ${artifact_name}
    145         echo "artifact_name=${artifact_name}" >> $GITHUB_OUTPUT
    146       env:
    147         matrix_os: ${{ matrix.os }}
    148 
    149     - name: Install build deps
    150       run: |
    151         rm -f /var/lib/man-db/auto-update
    152         apt update
    153         DEBIAN_FRONTEND=noninteractive apt install -y \
    154           build-essential \
    155           devscripts \
    156         #
    157 
    158     - name: Set git safe dir
    159       run: |
    160         export GIT_CEILING_DIRECTORIES=/__w # only work before git v2.35.2
    161         git config --global --add safe.directory /__w/libjxl/libjxl
    162 
    163     - name: Checkout the source
    164       uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
    165       with:
    166         submodules: true
    167         fetch-depth: 1
    168 
    169     - name: Stamp non-release versions
    170       # Stamps the built package with the commit date as part of the version
    171       # after the version number so newer release candidates can override older
    172       # ones.
    173       if: github.event_name != 'release'
    174       shell: 'bash'
    175       run: |
    176         # Committer timestamp.
    177         set -x
    178         commit_timestamp=$(git show -s --format=%ct)
    179         commit_datetime=$(date --utc "--date=@${commit_timestamp}" '+%Y%m%d%H%M%S')
    180         commit_ref=$(git rev-parse --short HEAD)
    181         sem_version=$(dpkg-parsechangelog --show-field Version)
    182         sem_version="${sem_version%%-*}"
    183         deb_version="${sem_version}~alpha${commit_datetime}-0+git${commit_ref}"
    184         dch -M --distribution unstable -b --newversion "${deb_version}" \
    185           "Stamping build with version ${deb_version}"
    186 
    187     - name: Stamp release versions
    188       # Mark the version as released
    189       if: github.event_name == 'release'
    190       shell: 'bash'
    191       run: |
    192         if head -n1 debian/changelog | grep UNRELEASED; then
    193           dch -M --distribution unstable --release ''
    194         fi
    195 
    196     - name: Install gmock-dev (debian:sid)
    197       # gtest-dev cmake depends on gmock-dev, but it is not installed by the
    198       # package.
    199       if: matrix.os == 'debian:sid'
    200       run: |
    201         apt install -y libgmock-dev
    202 
    203     - name: Configure hwy
    204       if: ${{ github.event_name == 'schedule' || github.event_name == 'release' || contains(github.event.pull_request.labels.*.name, 'CI:full') }}
    205       run: |
    206         echo "HWY_PKG_OPTIONS=" >> $GITHUB_ENV
    207 
    208     - name: Build hwy
    209       run: |
    210         apt build-dep -y ./third_party/highway
    211         ./ci.sh debian_build highway
    212         dpkg -i build/debs/libhwy-dev_*_amd64.deb
    213 
    214     - name: Build libjxl
    215       run: |
    216         apt build-dep -y .
    217         ./ci.sh debian_build jpeg-xl
    218 
    219     - name: Stats
    220       run: |
    221         ./ci.sh debian_stats
    222 
    223     - name: Upload artifacts
    224       uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
    225       with:
    226         name: ${{ steps.env.outputs.artifact_name }}
    227         path: |
    228           build/debs/*jxl*.*
    229 
    230     - name: Package release tarball
    231       if: github.event_name == 'release'
    232       run: |
    233         (cd build/debs/; find -maxdepth 1 -name '*jxl*.*') | \
    234         tar -zcvf release_file.tar.gz -C build/debs/ -T -
    235         ln -s release_file.tar.gz \
    236           ${{ steps.env.outputs.artifact_name }}-${{ github.event.release.tag_name }}.tar.gz
    237 
    238     - name: Upload binaries to release
    239       if: github.event_name == 'release'
    240       uses: AButler/upload-release-assets@c94805dc72e4b20745f543da0f62eaee7722df7a # v2.0.2
    241       with:
    242         files: ${{ steps.env.outputs.artifact_name }}-${{ github.event.release.tag_name }}.tar.gz
    243         repo-token: ${{ secrets.GITHUB_TOKEN }}
    244 
    245 
    246   windows_build:
    247     name: Windows Build (vcpkg / ${{ matrix.triplet }})
    248     runs-on: [windows-2019]
    249     strategy:
    250       fail-fast: false
    251       matrix:
    252         include:
    253           - triplet: x86-windows-static
    254             arch: '-A Win32'
    255           - triplet: x64-windows-static
    256             arch: '-A x64'
    257           - triplet: x86-windows
    258             arch: '-A Win32'
    259             static: 'OFF'
    260             tools: 'OFF'
    261           - triplet: x64-windows
    262             arch: '-A x64'
    263             static: 'OFF'
    264             tools: 'OFF'
    265 
    266     env:
    267       VCPKG_VERSION: '2023.12.12'
    268       VCPKG_ROOT: vcpkg
    269       VCPKG_DISABLE_METRICS: 1
    270 
    271     steps:
    272     - name: Harden Runner
    273       uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
    274       with:
    275         egress-policy: audit
    276 
    277     - name: Checkout the source
    278       uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
    279       with:
    280         submodules: true
    281         fetch-depth: 2
    282 
    283     - uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
    284       id: cache-vcpkg
    285       with:
    286         path: vcpkg
    287         key: release-${{ runner.os }}-vcpkg-${{ env.VCPKG_VERSION }}-${{ matrix.triplet }}
    288 
    289     - name: Download vcpkg
    290       if: steps.cache-vcpkg.outputs.cache-hit != 'true'
    291       # wget doesn't seem to work under bash.
    292       shell: 'powershell'
    293       run: |
    294         C:\msys64\usr\bin\wget.exe -nv `
    295            https://github.com/microsoft/vcpkg/archive/refs/tags/${{ env.VCPKG_VERSION }}.zip `
    296           -O vcpkg.zip
    297     - name: Bootstrap vcpkg
    298       if: steps.cache-vcpkg.outputs.cache-hit != 'true'
    299       shell: 'bash'
    300       run: |
    301         set -x
    302         unzip -q vcpkg.zip
    303         rm -rf ${VCPKG_ROOT}
    304         mv vcpkg-${VCPKG_VERSION} ${VCPKG_ROOT}
    305         ${VCPKG_ROOT}/bootstrap-vcpkg.sh
    306 
    307     - name: Install libraries with vcpkg
    308       shell: 'bash'
    309       run: |
    310         set -x
    311         ${VCPKG_ROOT}/vcpkg --triplet ${{ matrix.triplet }} install \
    312           giflib \
    313           libjpeg-turbo \
    314           libpng \
    315           libwebp \
    316         #
    317 
    318     - name: Configure
    319       shell: 'bash'
    320       run: |
    321         set -x
    322         mkdir build
    323         cmake -Bbuild -H. ${{ matrix.arch }} \
    324           -DJPEGXL_STATIC=${{ matrix.static || 'ON'}} \
    325           -DJPEGXL_ENABLE_TOOLS=${{ matrix.tools || 'ON'}} \
    326           -DBUILD_TESTING=OFF \
    327           -DCMAKE_BUILD_TYPE=Release \
    328           -DCMAKE_INSTALL_PREFIX=`pwd`/prefix \
    329           -DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake \
    330           -DJPEGXL_ENABLE_JPEGLI_LIBJPEG=OFF \
    331           -DJPEGXL_ENABLE_OPENEXR=OFF \
    332           -DJPEGXL_ENABLE_PLUGINS=OFF \
    333           -DJPEGXL_ENABLE_TCMALLOC=OFF \
    334           -DJPEGXL_ENABLE_VIEWERS=OFF \
    335           -DJPEGXL_ENABLE_DEVTOOLS=${{ matrix.tools || 'ON'}} \
    336           -DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} \
    337         #
    338     - name: Build
    339       shell: 'bash'
    340       run: |
    341         set -x
    342         cmake --build build --config Release
    343     - name: Install
    344       shell: 'bash'
    345       run: |
    346         set -x
    347         cmake --build build --config Release --target install
    348         for pkg in giflib libjpeg-turbo libpng libwebp zlib; do
    349           cp vcpkg/installed/${{matrix.triplet}}/share/${pkg}/copyright \
    350             prefix/bin/LICENSE.${pkg}
    351         done
    352         cp third_party/sjpeg/COPYING prefix/bin/LICENSE.sjpeg
    353         cp third_party/skcms/LICENSE prefix/bin/LICENSE.skcms
    354         cp third_party/highway/LICENSE prefix/bin/LICENSE.highway
    355         cp third_party/brotli/LICENSE prefix/bin/LICENSE.brotli
    356         cp LICENSE prefix/bin/LICENSE.libjxl
    357     - name: Upload artifacts
    358       uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
    359       with:
    360         name: jxl-${{matrix.triplet}}
    361         path: |
    362           prefix/bin/*
    363           prefix/lib/*
    364 
    365     - name: Package release zip
    366       if: github.event_name == 'release'
    367       shell: 'powershell'
    368       run: |
    369         Compress-Archive -Path prefix\bin\*, prefix\lib\* `
    370           -DestinationPath jxl-${{matrix.triplet}}.zip
    371 
    372     - name: Upload binaries to release
    373       if: github.event_name == 'release'
    374       uses: AButler/upload-release-assets@c94805dc72e4b20745f543da0f62eaee7722df7a # v2.0.2
    375       with:
    376         files: jxl-${{matrix.triplet}}.zip
    377         repo-token: ${{ secrets.GITHUB_TOKEN }}