libjxl

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

build_test_wasm.yml (4036B)


      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 and running tests.
      7 
      8 name: Build/Test WASM
      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 concurrency:
     22   group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
     23   cancel-in-progress: ${{ github.event_name == 'pull_request' }}
     24 
     25 jobs:
     26   build_test:
     27     name: WASM wasm32/${{ matrix.variant }}
     28     runs-on: ubuntu-latest
     29     env:
     30       CCACHE_DIR: ${{ github.workspace }}/.ccache
     31       BUILD_TARGET: wasm32
     32       EM_VERSION: 3.1.51
     33       NODE_VERSION: 21
     34 
     35     strategy:
     36       matrix:
     37         include:
     38           - variant: scalar
     39           - variant: simd-128
     40           - variant: simd-256
     41 
     42     steps:
     43     - name: Harden Runner
     44       uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
     45       with:
     46         egress-policy: audit
     47 
     48     - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
     49       with:
     50         submodules: true
     51         fetch-depth: 1
     52     - name: Install build deps
     53       shell: bash
     54       run: |
     55         set -x
     56         sudo rm -f /var/lib/man-db/auto-update
     57         sudo apt update
     58         pkgs=(
     59           # Build dependencies
     60           ccache
     61           cmake
     62           doxygen
     63           graphviz
     64           ninja-build
     65           pkg-config
     66         )
     67         DEBIAN_FRONTEND=noninteractive sudo apt install -y "${pkgs[@]}"
     68 
     69     - name: Git environment
     70       id: git-env
     71       run: |
     72         echo "parent=$(git rev-parse ${{ github.sha }}^)" >> $GITHUB_OUTPUT
     73       shell: bash
     74     - name: ccache
     75       uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
     76       with:
     77         path: ${{ env.CCACHE_DIR }}
     78         key: build-wasm-${{ runner.os }}-${{ github.sha }}-${{ matrix.variant }}
     79         restore-keys: |
     80           build-wasm-${{ runner.os }}-${{ steps.git-env.outputs.parent }}-${{ matrix.variant }}
     81 
     82     - name: Install node
     83       uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
     84       with:
     85         node-version: ${{env.NODE_VERSION}}
     86 
     87     - name: Get non-EMSDK node path
     88       run: which node >> $HOME/.base_node_path
     89 
     90     - name: Install emsdk
     91       uses: mymindstorm/setup-emsdk@6ab9eb1bda2574c4ddb79809fc9247783eaf9021 # v14
     92       # TODO(deymo): We could cache this action but it doesn't work when running
     93       # in a matrix.
     94       with:
     95         version: ${{env.EM_VERSION}}
     96         no-cache: true
     97 
     98     - name: Set EMSDK node version
     99       run: |
    100         echo "NODE_JS='$(cat $HOME/.base_node_path)'" >> $EMSDK/.emscripten
    101         emsdk construct_env
    102 
    103     # TODO(deymo): Build and install other dependencies like libpng, libjpeg,
    104     # etc.
    105     - name: Build
    106       run: |
    107         mkdir -p ${CCACHE_DIR}
    108         echo "max_size = 200M" > ${CCACHE_DIR}/ccache.conf
    109         if [[ "${{ matrix.variant }}" == "simd-128" ]]; then
    110           export ENABLE_WASM_SIMD=1
    111         fi
    112         if [[ "${{ matrix.variant }}" == "simd-256" ]]; then
    113           export ENABLE_WASM_SIMD=2
    114         fi
    115         ./ci.sh release \
    116           -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
    117           -DCMAKE_C_COMPILER_LAUNCHER=ccache \
    118           -DJPEGXL_ENABLE_BENCHMARK=OFF \
    119           -DJPEGXL_ENABLE_DEVTOOLS=OFF \
    120           -DJPEGXL_ENABLE_DOXYGEN=OFF \
    121           -DJPEGXL_ENABLE_EXAMPLES=OFF \
    122           -DJPEGXL_ENABLE_JNI=OFF \
    123           -DJPEGXL_ENABLE_MANPAGES=OFF \
    124           -DJPEGXL_ENABLE_PLUGINS=OFF \
    125           -DJPEGXL_ENABLE_TOOLS=OFF \
    126           -DJPEGXL_ENABLE_VIEWERS=OFF
    127       env:
    128         SKIP_TEST: 1
    129         TARGETS: all
    130     - name: ccache stats
    131       run: ccache --show-stats
    132 
    133     - name: Test
    134       if: |
    135         github.event_name == 'push' ||
    136         (github.event_name == 'pull_request' &&
    137          contains(github.event.pull_request.labels.*.name, 'CI:full'))
    138       run: |
    139         ./ci.sh test