-
Notifications
You must be signed in to change notification settings - Fork 5
138 lines (117 loc) · 4.32 KB
/
Copy pathci-pr.yml
File metadata and controls
138 lines (117 loc) · 4.32 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: ci pr
# PR verification: format + build/test matrix.
# Main push uses ci-main.yml which adds publish/release/notify.
on:
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
checks: write
jobs:
check-format:
runs-on: ubuntu-latest
container: debian:trixie
steps:
- name: Install tools
run: apt-get update && apt-get install -y --no-install-recommends ca-certificates git clang-format
- uses: actions/checkout@v4
- name: Check formatting
run: bash scripts/format.sh --check
# TEMPORARY: test Docker multi-stage build in PR CI (remove after validation)
docker-test:
runs-on: ubuntu-22.04
steps:
- name: Generate app token
id: app-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ secrets.OMOQ_APP_ID }}
private-key: ${{ secrets.OMOQ_APP_PRIV_KEY }}
- uses: actions/checkout@v4
with:
submodules: true
- name: Download bookworm moxygen tarball
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
ORLY_PLATFORM: bookworm-amd64
run: bash scripts/setup-deps-tarball.sh
- name: Stage tarball for Docker build
run: |
mkdir -p .docker-deps
cp -a .scratch/moxygen-install .docker-deps/moxygen
- name: Build Docker image
run: docker build -f docker/Dockerfile -t orly-test .
- name: Smoke test
run: |
echo "==> ldd check"
docker run --rm --entrypoint ldd orly-test /usr/local/bin/o-rly
if docker run --rm --entrypoint ldd orly-test /usr/local/bin/o-rly 2>&1 | grep -q "not found"; then
echo "ERROR: missing shared libraries"; exit 1
fi
echo "==> Start container"
docker run -d --name orly-smoke --network host \
-v "$PWD/tests/test.config.yaml:/etc/o-rly/config.yaml:ro" \
orly-test --config=/etc/o-rly/config.yaml
echo "==> Wait for admin /info"
for i in $(seq 1 50); do
if curl -sf http://[::1]:9669/info >/dev/null 2>&1; then break; fi
sleep 0.1
if [ "$i" -eq 50 ]; then
echo "ERROR: admin server did not start"; docker logs orly-smoke; exit 1
fi
done
RESP=$(curl -sf http://[::1]:9669/info)
echo "Response: $RESP"
echo "$RESP" | grep -q '"service":"o-rly"' || { echo "FAIL: bad /info response"; exit 1; }
docker stop orly-smoke && docker rm orly-smoke
echo "==> Smoke test passed"
build:
strategy:
fail-fast: false
matrix:
include:
- name: linux
preset: default
build_dir: build
runner: ubuntu-22.04
- name: asan debug
preset: san
build_dir: build-san
runner: ubuntu-22.04
name: ${{ matrix.name }}
runs-on: ${{ matrix.runner }}
steps:
- name: Generate app token
id: app-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ secrets.OMOQ_APP_ID }}
private-key: ${{ secrets.OMOQ_APP_PRIV_KEY }}
- uses: actions/checkout@v4
with:
submodules: true
- name: Install system dependencies
run: bash deps/moxygen/standalone/install-system-deps.sh
- name: Download moxygen artifacts
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: bash scripts/setup-deps-tarball.sh
- name: Configure
run: bash scripts/configure.sh ${{ matrix.build_dir }} ${{ matrix.preset }}
- name: Build
run: cmake --build ${{ matrix.build_dir }} -j$(getconf _NPROCESSORS_ONLN)
- name: Test
env:
ASAN_OPTIONS: ${{ matrix.name == 'asan debug' && 'detect_leaks=1:abort_on_error=1' || '' }}
run: ctest --test-dir ${{ matrix.build_dir }} --output-on-failure --output-junit test-results.xml
- name: Publish test results
uses: dorny/test-reporter@v1.9.1
if: success() || failure()
with:
name: "test (${{ matrix.name }})"
path: ${{ matrix.build_dir }}/test-results.xml
reporter: java-junit
fail-on-empty: ${{ job.status == 'success' && 'true' || 'false' }}