# 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 the release binaries. # # This workflow runs as a post-submit step, when pushing to main or the release # branches (v*.*.x), and when creating a release in GitHub. # # In the GitHub release case, in addition to build the release binaries it also # uploads the binaries to the given release automatically. name: Release build / deploy on: push: branches: - main - v*.*.x release: types: [ published ] jobs: ubuntu_static_x86_64: name: Release linux x86_64 static runs-on: [ubuntu-latest] steps: - name: Install build deps run: | sudo apt update sudo apt install -y \ asciidoc \ clang \ cmake \ doxygen \ libbrotli-dev \ libgdk-pixbuf2.0-dev \ libgif-dev \ libgtest-dev \ libgtk2.0-dev \ libjpeg-dev \ libopenexr-dev \ libpng-dev \ libwebp-dev \ ninja-build \ pkg-config \ # echo "CC=clang" >> $GITHUB_ENV echo "CXX=clang++" >> $GITHUB_ENV - name: Checkout the source uses: actions/checkout@v2 with: submodules: true fetch-depth: 1 - name: Build env: SKIP_TEST: 1 run: | ./ci.sh release \ -DJPEGXL_DEP_LICENSE_DIR=/usr/share/doc \ -DJPEGXL_STATIC=ON \ -DBUILD_TESTING=OFF \ -DJPEGXL_ENABLE_VIEWERS=OFF \ -DJPEGXL_ENABLE_PLUGINS=OFF \ -DJPEGXL_ENABLE_OPENEXR=OFF \ - name: Package release tarball run: | cd build tar -zcvf ${{ runner.workspace }}/release_file.tar.gz \ LICENSE* tools/{cjxl,djxl,benchmark_xl} ln -s ${{ runner.workspace }}/release_file.tar.gz \ ${{ runner.workspace }}/jxl-linux-x86_64-static-${{ github.event.release.tag_name }}.tar.gz - name: Upload artifacts uses: actions/upload-artifact@v2 with: name: jxl-linux-x86_64-static path: ${{ runner.workspace }}/release_file.tar.gz - name: Upload binaries to release if: github.event_name == 'release' uses: AButler/upload-release-assets@v2.0 with: files: ${{ runner.workspace }}/jxl-linux-x86_64-static-${{ github.event.release.tag_name }}.tar.gz repo-token: ${{ secrets.GITHUB_TOKEN }} # Build .deb packages Ubuntu/Debian release_ubuntu_pkg: name: .deb packages / ${{ matrix.os }} runs-on: ubuntu-latest strategy: fail-fast: false matrix: os: - ubuntu:20.04 - ubuntu:18.04 - debian:buster - debian:bullseye - debian:bookworm - debian:sid container: image: ${{ matrix.os }} steps: - name: Set env shell: 'bash' id: 'env' run: | artifact_name="jxl-debs-amd64-${matrix_os/:/-}" echo ${artifact_name} echo "::set-output name=artifact_name::${artifact_name}" env: matrix_os: ${{ matrix.os }} - name: Install build deps run: | apt update DEBIAN_FRONTEND=noninteractive apt install -y \ build-essential \ devscripts \ # - name: Install git (only 18.04) if: matrix.os == 'ubuntu:18.04' # Ubuntu 18.04 ships with git 2.17 but we need 2.18 or newer for # actions/checkout@v2 to work shell: 'bash' run: | apt install -y \ libcurl4-openssl-dev \ libexpat1-dev \ libssl-dev \ wget \ zlib1g-dev \ # git_version="2.32.0" wget -nv \ "https://github.com/git/git/archive/refs/tags/v${git_version}.tar.gz" tar -zxf "v${git_version}.tar.gz" cd "git-${git_version}" make prefix=/usr -j4 install - name: Install gcc-8 (only 18.04) if: matrix.os == 'ubuntu:18.04' # Compiler bug workaround: install and use gcc-8 shell: 'bash' run: | apt install -y \ gcc-8 \ g++-8 \ # update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 100 update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 100 update-alternatives --set g++ /usr/bin/g++-8 update-alternatives --set gcc /usr/bin/gcc-8 - name: Set git safe dir run: | export GIT_CEILING_DIRECTORIES=/__w # only work before git v2.35.2 git config --global --add safe.directory /__w/libjxl/libjxl - name: Checkout the source uses: actions/checkout@v2 with: submodules: true fetch-depth: 1 - name: Stamp non-release versions # Stamps the built package with the commit date as part of the version # after the version number so newer release candidates can override older # ones. if: github.event_name != 'release' shell: 'bash' run: | # Committer timestamp. set -x commit_timestamp=$(git show -s --format=%ct) commit_datetime=$(date --utc "--date=@${commit_timestamp}" '+%Y%m%d%H%M%S') commit_ref=$(git rev-parse --short HEAD) sem_version=$(dpkg-parsechangelog --show-field Version) sem_version="${sem_version%%-*}" deb_version="${sem_version}~alpha${commit_datetime}-0+git${commit_ref}" dch -M --distribution unstable -b --newversion "${deb_version}" \ "Stamping build with version ${deb_version}" - name: Stamp release versions # Mark the version as released if: github.event_name == 'release' shell: 'bash' run: | if head -n1 debian/changelog | grep UNRELEASED; then dch -M --distribution unstable --release '' fi - name: Install gtest (only 18.04) if: matrix.os == 'ubuntu:18.04' # In Ubuntu 18.04 no package installed the libgtest.a. libgtest-dev # installs the source files only. run: | apt install -y libgtest-dev cmake for prj in googletest googlemock; do (cd /usr/src/googletest/${prj}/ && cmake CMakeLists.txt -DCMAKE_INSTALL_PREFIX=/usr && make all install) done # Remove libgmock-dev dependency in Ubuntu 18.04. It doesn't exist there. sed '/libgmock-dev,/d' -i debian/control - name: Install gmock-dev (debian:sid) # gtest-dev cmake depends on gmock-dev, but it is not installed by the # package. if: matrix.os == 'debian:sid' run: | apt install -y libgmock-dev - name: Remove libjxl-gimp-plugin package (only 18.04) if: matrix.os == 'ubuntu:18.04' run: | # Gimp 2.8 is not supported. sed -i '/Package: libjxl-gimp-plugin/,/^$/d' debian/control - name: Build hwy run: | apt build-dep -y ./third_party/highway ./ci.sh debian_build highway dpkg -i build/debs/libhwy-dev_*_amd64.deb - name: Build libjxl run: | apt build-dep -y . ./ci.sh debian_build jpeg-xl - name: Stats run: | ./ci.sh debian_stats - name: Upload artifacts uses: actions/upload-artifact@v2 with: name: ${{ steps.env.outputs.artifact_name }} path: | build/debs/*jxl*.* - name: Package release tarball if: github.event_name == 'release' run: | (cd build/debs/; find -maxdepth 1 -name '*jxl*.*') | \ tar -zcvf release_file.tar.gz -C build/debs/ -T - ln -s release_file.tar.gz \ ${{ steps.env.outputs.artifact_name }}-${{ github.event.release.tag_name }}.tar.gz - name: Upload binaries to release if: github.event_name == 'release' uses: AButler/upload-release-assets@v2.0 with: files: ${{ steps.env.outputs.artifact_name }}-${{ github.event.release.tag_name }}.tar.gz repo-token: ${{ secrets.GITHUB_TOKEN }} windows_build: name: Windows Build (vcpkg / ${{ matrix.triplet }}) runs-on: [windows-2019] strategy: fail-fast: false matrix: include: - triplet: x86-windows-static arch: '-A Win32' - triplet: x64-windows-static arch: '-A x64' env: VCPKG_VERSION: '2022.06.16.1' VCPKG_ROOT: vcpkg VCPKG_DISABLE_METRICS: 1 steps: - name: Checkout the source uses: actions/checkout@v2 with: submodules: true fetch-depth: 2 - uses: actions/cache@v2 id: cache-vcpkg with: path: vcpkg key: release-${{ runner.os }}-vcpkg-${{ env.VCPKG_VERSION }}-${{ matrix.triplet }} - name: Download vcpkg if: steps.cache-vcpkg.outputs.cache-hit != 'true' # wget doesn't seem to work under bash. shell: 'powershell' run: | C:\msys64\usr\bin\wget.exe -nv ` https://github.com/microsoft/vcpkg/archive/refs/tags/${{ env.VCPKG_VERSION }}.zip ` -O vcpkg.zip - name: Bootstrap vcpkg if: steps.cache-vcpkg.outputs.cache-hit != 'true' shell: 'bash' run: | set -x unzip -q vcpkg.zip rm -rf ${VCPKG_ROOT} mv vcpkg-${VCPKG_VERSION} ${VCPKG_ROOT} ${VCPKG_ROOT}/bootstrap-vcpkg.sh - name: Install libraries with vcpkg shell: 'bash' run: | set -x ${VCPKG_ROOT}/vcpkg --triplet ${{ matrix.triplet }} install \ giflib \ libjpeg-turbo \ libpng \ libwebp \ # - name: Configure shell: 'bash' run: | set -x mkdir build cmake -Bbuild -H. ${{ matrix.arch }} \ -DBUILD_TESTING=OFF \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=`pwd`/prefix \ -DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake \ -DJPEGXL_ENABLE_OPENEXR=OFF \ -DJPEGXL_ENABLE_PLUGINS=OFF \ -DJPEGXL_ENABLE_TCMALLOC=OFF \ -DJPEGXL_ENABLE_VIEWERS=OFF \ -DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} \ # - name: Build shell: 'bash' run: | set -x cmake --build build --config Release - name: Install shell: 'bash' run: | set -x cmake --build build --config Release --target install for pkg in giflib libjpeg-turbo libpng libwebp zlib; do cp vcpkg/installed/${{matrix.triplet}}/share/${pkg}/copyright \ prefix/bin/LICENSE.${pkg} done cp third_party/sjpeg/COPYING prefix/bin/LICENSE.sjpeg cp third_party/skcms/LICENSE prefix/bin/LICENSE.skcms cp third_party/highway/LICENSE prefix/bin/LICENSE.highway cp third_party/brotli/LICENSE prefix/bin/LICENSE.brotli cp LICENSE prefix/bin/LICENSE.libjxl - name: Upload artifacts uses: actions/upload-artifact@v2 with: name: jxl-${{matrix.triplet}} path: | prefix/bin/* - name: Package release zip if: github.event_name == 'release' shell: 'powershell' run: | Compress-Archive -Path prefix\bin\* ` -DestinationPath jxl-${{matrix.triplet}}.zip - name: Upload binaries to release if: github.event_name == 'release' uses: AButler/upload-release-assets@v2.0 with: files: jxl-${{matrix.triplet}}.zip repo-token: ${{ secrets.GITHUB_TOKEN }}