@@ -2,14 +2,18 @@ on: [push, pull_request]
22
33name : build
44
5+ env :
6+ OPENRESTY_VERSION : 1.27.1.2
7+ OPENRESTY_SHA256 : 74f076f7e364b2a99a6c5f9bb531c27610c78985abe956b442b192a2295f7548
8+
59jobs :
610 pingora :
711 strategy :
812 fail-fast : false
913 matrix :
1014 # nightly, msrv, and latest stable
1115 toolchain : [nightly, 1.85.0, 1.97.1]
12- runs-on : ubuntu-latest
16+ runs-on : ubuntu-24.04
1317 # Only run on "pull_request" event for external PRs. This is to avoid
1418 # duplicate builds for PRs created from internal branches.
1519 if : github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
@@ -22,12 +26,43 @@ jobs:
2226 - name : Install build dependencies
2327 run : |
2428 sudo apt update
25- sudo apt install -y cmake libclang-dev wget gnupg ca-certificates lsb-release --no-install-recommends
26- # openresty is used for convenience in tests as a server.
27- wget -O - https://openresty.org/package/pubkey.gpg | sudo gpg --dearmor -o /usr/share/keyrings/openresty.gpg
28- echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/openresty.gpg] http://openresty.org/package/ubuntu $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/openresty.list > /dev/null
29- sudo apt update
30- sudo apt install -y openresty --no-install-recommends
29+ sudo apt install -y cmake libclang-dev ca-certificates curl --no-install-recommends
30+
31+ - name : Cache OpenResty
32+ if : matrix.toolchain != '1.85.0'
33+ id : cache-openresty
34+ uses : actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5
35+ with :
36+ path : ~/.local/openresty
37+ key : openresty-${{ runner.os }}-${{ runner.arch }}-${{ env.OPENRESTY_VERSION }}-${{ env.OPENRESTY_SHA256 }}-v1
38+
39+ - name : Build OpenResty
40+ if : matrix.toolchain != '1.85.0' && steps.cache-openresty.outputs.cache-hit != 'true'
41+ run : |
42+ sudo apt install -y build-essential libpcre2-dev libssl-dev zlib1g-dev --no-install-recommends
43+
44+ archive="$RUNNER_TEMP/openresty-$OPENRESTY_VERSION.tar.gz"
45+ curl --fail --location --proto '=https' --tlsv1.2 \
46+ --retry 5 --retry-all-errors \
47+ "https://github.com/openresty/openresty/releases/download/v$OPENRESTY_VERSION/openresty-$OPENRESTY_VERSION.tar.gz" \
48+ --output "$archive"
49+ printf '%s %s\n' "$OPENRESTY_SHA256" "$archive" | sha256sum --check --strict
50+
51+ tar --extract --gzip --file "$archive" --directory "$RUNNER_TEMP"
52+ cd "$RUNNER_TEMP/openresty-$OPENRESTY_VERSION"
53+ ./configure \
54+ --prefix="$HOME/.local/openresty" \
55+ --with-http_ssl_module \
56+ --with-http_v2_module
57+ make -j"$(nproc)"
58+ make install
59+
60+ - name : Add OpenResty to PATH
61+ if : matrix.toolchain != '1.85.0'
62+ run : |
63+ test -x "$HOME/.local/openresty/bin/openresty"
64+ echo "$HOME/.local/openresty/bin" >> "$GITHUB_PATH"
65+ "$HOME/.local/openresty/bin/openresty" -V
3166
3267 - name : Install toolchain
3368 uses : dtolnay/rust-toolchain@master
0 commit comments