Repository navigation
117 lines (99 loc) · 3.99 KB
/
Copy pathci.yml
File metadata and controls
117 lines (99 loc) · 3.99 KB
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
name: CI
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
workflow_call:
inputs:
ref:
description: Git ref to check out and verify
required: false
type: string
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ inputs.ref || github.ref }}
cancel-in-progress: ${{ inputs.ref == '' }}
env:
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
CARGO_TARGET_DIR: ${{ github.workspace }}/target
NGINX_CORE_VERSION: "1.31.4"
NGINX_CORE_TARBALL_SHA256: "e6f20b644a17a643f059ae6467a1971fe2811587d025e071068753a1f1e3b3c3"
NGINX_SOURCE_DIR: ${{ github.workspace }}/.ci/nginx-1.31.4
NGINX_BUILD_DIR: ${{ github.workspace }}/.ci/nginx-1.31.4/objs
NGX_RUSTSCRIPT_NGINX: ${{ github.workspace }}/.ci/nginx-1.31.4/objs/nginx
NGX_RUSTSCRIPT_TASK_TMP: ${{ github.workspace }}/.ci/tmp
TMPDIR: ${{ github.workspace }}/.ci/tmp
jobs:
test:
name: Rust and NGINX acceptance
runs-on: ubuntu-24.04
timeout-minutes: 60
steps:
- name: Check out source
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
fetch-depth: 0
ref: ${{ inputs.ref || github.ref }}
- name: Install native build dependencies
run: |
sudo apt-get update
sudo apt-get install --yes --no-install-recommends \
build-essential ca-certificates clang curl dpkg-dev file libclang-dev \
libpcre2-dev libssl-dev python3-yaml zlib1g-dev
- name: Install Rust toolchain
run: |
rustup toolchain install stable --profile minimal --component clippy,rustfmt
rustup default stable
rustc --version
cargo --version
- name: Cache Cargo dependencies
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: |
~/.cargo/git
~/.cargo/registry
key: cargo-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('Cargo.lock') }}
restore-keys: |
cargo-${{ runner.os }}-${{ runner.arch }}-
- name: Configure pinned NGINX
run: |
mkdir -p .ci/download "$NGX_RUSTSCRIPT_TASK_TMP"
curl --fail --location --retry 3 \
--output ".ci/download/nginx-${NGINX_CORE_VERSION}.tar.gz" \
"https://nginx.org/download/nginx-${NGINX_CORE_VERSION}.tar.gz"
printf '%s %s\n' "$NGINX_CORE_TARBALL_SHA256" ".ci/download/nginx-${NGINX_CORE_VERSION}.tar.gz" \
| sha256sum --check --strict
tar -C .ci -xzf ".ci/download/nginx-${NGINX_CORE_VERSION}.tar.gz"
unset CFLAGS CPPFLAGS BINDGEN_EXTRA_CLANG_ARGS
cd "$NGINX_SOURCE_DIR"
./configure --with-compat --with-http_ssl_module
make -j"$(nproc)"
REPORT="$("$NGX_RUSTSCRIPT_NGINX" -V 2>&1)"
[[ "$REPORT" == *"nginx/$NGINX_CORE_VERSION"* ]]
[[ "$REPORT" == *"--with-compat"* ]]
[[ "$REPORT" == *"--with-http_ssl_module"* ]]
test -f "$NGINX_BUILD_DIR/ngx_auto_config.h"
printf 'CFLAGS=-I%s\n' "$NGINX_BUILD_DIR" >> "$GITHUB_ENV"
printf 'BINDGEN_EXTRA_CLANG_ARGS=-I%s\n' "$NGINX_BUILD_DIR" >> "$GITHUB_ENV"
- name: Check release packaging contracts
run: python3 -m unittest -v tests/test_release_packaging.py
- name: Check formatting
run: cargo fmt --all -- --check
- name: Check compilation
run: cargo check --locked
- name: Run Clippy
run: cargo clippy --locked --all-targets -- -D warnings
- name: Build debug module
run: cargo build --locked --lib
- name: Run complete test suite
run: cargo test --locked --all-targets -- --test-threads=1
- name: Build release module
run: cargo build --locked --release --lib
- name: Run real NGINX integration
run: |
python3 tests/nginx_integration.py \
--nginx "$NGX_RUSTSCRIPT_NGINX" \
--module "$CARGO_TARGET_DIR/debug/libngx_rustscript.so"