-
Notifications
You must be signed in to change notification settings - Fork 207
150 lines (133 loc) · 4.78 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
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: |
org.opencontainers.image.authors=admin@weserv.nl
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 }}