Format code according to clang-format #92
This file contains 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
name: CI | |
on: | |
# Only trigger this workflow for the 5.x branch | |
push: | |
branches: [ '5.x' ] | |
tags: [ 'v*.*.*' ] | |
pull_request: | |
branches: [ '5.x' ] | |
permissions: {} | |
jobs: | |
CI: | |
runs-on: ${{ matrix.os }} | |
permissions: | |
contents: read | |
strategy: | |
fail-fast: true | |
matrix: | |
include: | |
- os: ubuntu-24.04 | |
libvips-version: 8.16.0 | |
coverage: true | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Cache libvips | |
id: cache-libvips | |
uses: actions/cache@v4 | |
with: | |
path: ~/vips | |
key: ${{ matrix.libvips-version }} | |
- name: Install dependencies | |
run: | | |
# for Test::Nginx | |
curl -fsSL https://openresty.org/package/pubkey.gpg | sudo gpg --dearmor -o /usr/share/keyrings/openresty.gpg | |
echo "deb [signed-by=/usr/share/keyrings/openresty.gpg] https://openresty.org/package/ubuntu $(lsb_release -sc) main" | \ | |
sudo tee /etc/apt/sources.list.d/openresty.list > /dev/null | |
# install dependencies | |
sudo apt-get update | |
sudo apt-get install --no-install-recommends \ | |
catch2 meson \ | |
libtest-nginx-perl \ | |
libcgif-dev libexif-dev libexpat1-dev \ | |
libheif-dev libheif-plugin-aomenc libheif-plugin-x265 \ | |
libhwy-dev libimagequant-dev libjxl-dev \ | |
liblcms2-dev libmagickcore-dev libopenjp2-7-dev \ | |
libpango1.0-dev libpoppler-glib-dev librsvg2-dev \ | |
libspng-dev libtiff5-dev libwebp-dev | |
- name: Install libvips | |
if: steps.cache-libvips.outputs.cache-hit != 'true' | |
env: | |
VIPS_VERSION: ${{ matrix.libvips-version }} | |
working-directory: ${{ runner.temp }} | |
run: | | |
mkdir vips | |
curl -Ls https://github.com/libvips/libvips/releases/download/v$VIPS_VERSION/vips-$VIPS_VERSION.tar.xz | \ | |
tar xJC vips --strip-components=1 | |
cd vips | |
meson setup build --prefix=$HOME/vips --libdir=lib -Ddeprecated=false -Dintrospection=disabled | |
meson compile -C build | |
meson install -C build | |
- name: Prepare environment | |
run: | | |
echo "$HOME/vips/bin" >> $GITHUB_PATH | |
echo "$HOME/nginx/sbin" >> $GITHUB_PATH | |
echo "LD_LIBRARY_PATH=$HOME/vips/lib" >> $GITHUB_ENV | |
echo "PKG_CONFIG_PATH=$HOME/vips/lib/pkgconfig" >> $GITHUB_ENV | |
- name: Build | |
run: | | |
cmake -S . -B build \ | |
-DCMAKE_BUILD_TYPE=Debug \ | |
-DCUSTOM_NGX_FLAGS="--prefix=$HOME/nginx" \ | |
-DENABLE_COVERAGE=$([ "${{ matrix.coverage }}" = true ] && echo "ON" || echo "OFF") \ | |
-DBUILD_TESTS=ON | |
cmake --build build -- -j$(nproc) | |
- name: Run unit tests | |
env: | |
VIPS_WARNING: 0 | |
run: ctest --test-dir build -j $(nproc) --output-on-failure | |
- name: Run integration tests | |
env: | |
TEST_NGINX_SERVROOT: ${{ github.workspace }}/servroot | |
run: prove -r test/nginx | |
- name: Upload coverage to Codecov | |
if: matrix.coverage | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
docker-publish: | |
needs: CI | |
runs-on: ubuntu-24.04 | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/${{ github.repository }} | |
# Add git branch, tag and short SHA as Docker tag | |
tags: | | |
type=ref,event=branch | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=sha | |
# Disable latest tag convention on push tag event | |
flavor: | | |
latest=false | |
# Overwrite some generated OCI labels | |
labels: | | |
[email protected] | |
org.opencontainers.image.documentation=https://github.com/weserv/images/tree/5.x/docker | |
org.opencontainers.image.description=weserv/images | |
org.opencontainers.image.vendor=wsrv.nl | |
- name: Login to GitHub Container Registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ./docker/Dockerfile | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |