Skip to content

Commit e6c8528

Browse files
committed
CI: added basic set of workflows.
1 parent 23601ea commit e6c8528

File tree

4 files changed

+201
-0
lines changed

4 files changed

+201
-0
lines changed

.github/workflows/cargo-deny.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: cargo-deny
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
8+
jobs:
9+
check:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
checks:
14+
- advisories
15+
- bans licenses sources
16+
17+
# Prevent sudden announcement of a new advisory from failing ci:
18+
continue-on-error: ${{ matrix.checks == 'advisories' }}
19+
20+
steps:
21+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
22+
- uses: EmbarkStudios/cargo-deny-action@34899fc7ba81ca6268d5947a7a16b4649013fea1 # v2.0.11
23+
with:
24+
command: check ${{ matrix.checks }}

.github/workflows/ci.yaml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
env:
10+
CARGO_TERM_COLOR: 'always'
11+
RUST_BACKTRACE: '1'
12+
NGINX_SOURCE_DIR: nginx
13+
14+
jobs:
15+
linux:
16+
runs-on: ubuntu-latest
17+
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
nginx-ref:
22+
- master
23+
- stable-1.28
24+
build:
25+
- debug
26+
- debug-static
27+
- release
28+
29+
steps:
30+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
31+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
32+
with:
33+
ref: ${{ matrix.nginx-ref }}
34+
repository: 'nginx/nginx'
35+
path: 'nginx'
36+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
37+
with:
38+
repository: 'nginx/nginx-tests'
39+
path: 'nginx/tests'
40+
sparse-checkout: |
41+
lib
42+
43+
- uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b
44+
with:
45+
toolchain: stable
46+
47+
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
48+
with:
49+
path: |
50+
~/.cargo/bin/
51+
~/.cargo/registry/index/
52+
~/.cargo/registry/cache/
53+
~/.cargo/git/db/
54+
nginx/objs/**/CACHEDIR.TAG
55+
nginx/objs/**/ngx-debug
56+
nginx/objs/**/ngx-release
57+
key: ${{ runner.os }}-nginx-${{ hashFiles('**/Cargo.lock') }}
58+
restore-keys: ${{ runner.os }}-nginx-
59+
60+
- name: build
61+
id: build
62+
run: make BUILD=${{ matrix.build }} -j $(nproc) build
63+
64+
- name: check
65+
# always run if build succeeds
66+
if: ${{ !cancelled() && steps.build.outcome == 'success' }}
67+
run: make BUILD=${{ matrix.build }} check
68+
69+
- name: run unit-tests
70+
# always run if build succeeds
71+
if: ${{ !cancelled() && steps.build.outcome == 'success' }}
72+
run: make BUILD=${{ matrix.build }} unittest
73+
74+
- name: run tests
75+
# always run if build succeeds
76+
if: ${{ !cancelled() && steps.build.outcome == 'success' }}
77+
run: make BUILD=${{ matrix.build }} TEST_PREREQ= test

.github/workflows/sanitizers.yaml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: sanitizers
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
env:
10+
CARGO_TERM_COLOR: 'always'
11+
RUST_BACKTRACE: '1'
12+
NGINX_SOURCE_DIR: nginx
13+
BUILDREQUIRES: >-
14+
openssl-devel pcre2-devel zlib-devel
15+
cargo rust-src rustfmt
16+
clang compiler-rt llvm
17+
git-core
18+
make patch
19+
perl-FindBin
20+
perl-IO-Socket-SSL
21+
perl-Test-Harness
22+
perl-Test-Simple
23+
perl-lib
24+
25+
jobs:
26+
test:
27+
runs-on: ubuntu-latest
28+
container: ghcr.io/almalinux/almalinux:10
29+
30+
strategy:
31+
fail-fast: false
32+
matrix:
33+
nginx-ref:
34+
# master
35+
- stable-1.28
36+
37+
steps:
38+
- name: Install dependencies
39+
run: dnf install -y ${BUILDREQUIRES}
40+
41+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
42+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
43+
with:
44+
ref: ${{ matrix.nginx-ref }}
45+
repository: 'nginx/nginx'
46+
path: 'nginx'
47+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
48+
with:
49+
repository: 'nginx/nginx-tests'
50+
path: 'nginx/tests'
51+
52+
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
53+
with:
54+
path: |
55+
~/.cargo/bin/
56+
~/.cargo/registry/index/
57+
~/.cargo/registry/cache/
58+
~/.cargo/git/db/
59+
nginx/objs/**/CACHEDIR.TAG
60+
nginx/objs/**/ngx-debug
61+
nginx/objs/**/ngx-release
62+
key: ${{ runner.os }}-cargo-asan-${{ hashFiles('**/Cargo.lock') }}
63+
restore-keys: ${{ runner.os }}-cargo-asan-
64+
65+
- name: Configure and build nginx
66+
run: |
67+
make -j$(nproc) BUILD=sanitize build
68+
69+
- name: Run tests
70+
env:
71+
# `container` job steps are running as root, and thus all the files
72+
# created by the test scripts are owned by root.
73+
# But the worker processes are spawned as "nobody" by default,
74+
# resulting in permission errors.
75+
TEST_NGINX_GLOBALS: >-
76+
user root;
77+
run: |
78+
make -j$(nproc) BUILD=sanitize test

deny.toml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[bans]
2+
multiple-versions = "warn"
3+
4+
[graph]
5+
all-features = true
6+
7+
[licenses]
8+
allow = [
9+
"Apache-2.0",
10+
"BSD-3-Clause",
11+
"ISC",
12+
"MIT",
13+
"Unicode-3.0",
14+
]
15+
confidence-threshold = 0.8
16+
17+
[[licenses.clarify]]
18+
crate = "ring"
19+
expression = "MIT AND ISC AND OpenSSL"
20+
license-files = [
21+
{ path = "LICENSE", hash = 0xbd0eed23 }
22+
]

0 commit comments

Comments
 (0)