-
Notifications
You must be signed in to change notification settings - Fork 148
121 lines (120 loc) · 4.09 KB
/
nginx.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
name: nginx instrumentation CI
on:
workflow_dispatch:
push:
branches: "*"
paths:
- 'instrumentation/nginx/**'
- '.github/workflows/nginx.yml'
tags:
- 'nginx/*'
pull_request:
branches: [main]
paths:
- 'instrumentation/nginx/**'
- '.github/workflows/nginx.yml'
jobs:
create-release:
if: startsWith(github.ref, 'refs/tags/nginx')
runs-on: ubuntu-latest
steps:
- name: Release
uses: softprops/action-gh-release@v2
upload-release-artifacts:
if: startsWith(github.ref, 'refs/tags/nginx')
runs-on: ubuntu-latest
needs: [nginx-build-test, create-release]
steps:
- name: Create directory
run: |
mkdir artifacts
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Upload release artifacts
uses: softprops/action-gh-release@v2
with:
fail_on_unmatched_files: true
files: ./artifacts/*
nginx-build-test:
name: nginx
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
image: ["ubuntu:24.04", "debian:11", "alpine:3.20", "amazonlinux:2", "amazonlinux:2023"]
nginx: ["1.27.3", "1.27.2", "1.27.1", "1.26.2", "1.24.0", "1.22.1"]
steps:
- name: checkout otel nginx
uses: actions/checkout@v4
- name: setup
run: |
sudo ./instrumentation/nginx/ci/setup_environment.sh
- name: setup buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
install: true
- name: build express backend docker
run: |
cd instrumentation/nginx
docker build -t otel-nginx-test/express-backend \
-f test/backend/simple_express/Dockerfile \
--cache-from type=local,src=/tmp/buildx-cache/express \
--cache-to type=local,dest=/tmp/buildx-cache/express-new \
--load \
test/backend/simple_express
- name: Choose Dockerfile
run: |
if [[ "${{ matrix.image }}" == "alpine"* ]]; then
echo "dockerfile=Dockerfile_alpine" >> $GITHUB_ENV
elif [[ "${{ matrix.image }}" == "amazonlinux"* ]]; then
echo "dockerfile=Dockerfile_amazonlinux" >> $GITHUB_ENV
else
echo "dockerfile=Dockerfile" >> $GITHUB_ENV
fi
- name: build nginx docker
run: |
cd instrumentation/nginx
docker build -t otel-nginx-test/nginx \
--build-arg image=${{ matrix.image }} \
--build-arg nginx_version=${{ matrix.nginx }} \
-f test/${{ env.dockerfile }} \
--cache-from type=local,src=/tmp/buildx-cache/nginx \
--cache-to type=local,dest=/tmp/buildx-cache/nginx-new \
--load \
.
- name: update cache
run: |
rm -rf /tmp/buildx-cache/express
rm -rf /tmp/buildx-cache/nginx
mv /tmp/buildx-cache/express-new /tmp/buildx-cache/express
mv /tmp/buildx-cache/nginx-new /tmp/buildx-cache/nginx
- name: run tests
run: |
cd instrumentation/nginx/test/instrumentation
mix local.hex --force --if-missing
mix local.rebar --force --if-missing
mix deps.get
mix test
- name: copy artifacts
id: artifacts
run: |
cd instrumentation/nginx
mkdir -p /tmp/otel_ngx/
docker build -f test/${{ env.dockerfile }} \
--build-arg image=${{ matrix.image }} \
--build-arg nginx_version=${{ matrix.nginx }} \
--target export \
--output type=local,dest=/tmp/otel_ngx .
echo "artifactName=otel_ngx_module-$(echo ${{ matrix.image }} | sed s/:/-/)-${{ matrix.nginx }}.so" >> $GITHUB_ENV
- name: rename artifact
run: |
mv /tmp/otel_ngx/otel_ngx_module.so /tmp/otel_ngx/${{ env.artifactName }}
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.artifactName }}
path: /tmp/otel_ngx/${{ env.artifactName }}