Skip to content

Commit 3d27ae0

Browse files
committed
fix tests
1 parent 2425def commit 3d27ae0

File tree

1 file changed

+132
-218
lines changed

1 file changed

+132
-218
lines changed

.github/workflows/ci.yml

Lines changed: 132 additions & 218 deletions
Original file line numberDiff line numberDiff line change
@@ -19,49 +19,19 @@ env:
1919
NFPM_VERSION: 'v2.35.3'
2020

2121
jobs:
22-
# lint:
23-
# name: Lint
24-
# runs-on: ubuntu-22.04
25-
# steps:
26-
# - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
27-
# - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
28-
# with:
29-
# go-version-file: 'go.mod'
30-
# cache: false
31-
# - name: run install-tools
32-
# run: make install-tools
33-
# - name: run lint
34-
# run: make lint
35-
# unit-test:
36-
# name: Unit Tests
37-
# runs-on: ubuntu-22.04
38-
# steps:
39-
# - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
40-
# - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
41-
# with:
42-
# go-version-file: 'go.mod'
43-
# cache: false
44-
# - name: Run Unit Tests
45-
# run: make unit-test
46-
# - name: Check Coverage
47-
# uses: vladopajic/go-test-coverage@dd4b1f21c4e48db0425e1187d2845404b1206919
48-
# with:
49-
# config: ./.testcoverage.yaml
50-
# ## when token is not specified (value '') this feature is turned off
51-
# git-token: ${{ github.ref_name == 'v3' && secrets.GITHUB_TOKEN || '' }}
52-
# ## name of orphaned branch where badges are stored
53-
# git-branch: badges
54-
# race-condition-test:
55-
# name: Unit tests with race condition detection
56-
# runs-on: ubuntu-22.04
57-
# steps:
58-
# - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
59-
# - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
60-
# with:
61-
# go-version-file: 'go.mod'
62-
# cache: false
63-
# - name: Run unit tests with race condition detection
64-
# run: make race-condition-test
22+
lint:
23+
name: Lint
24+
runs-on: ubuntu-22.04
25+
steps:
26+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
27+
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
28+
with:
29+
go-version-file: 'go.mod'
30+
cache: false
31+
- name: run install-tools
32+
run: make install-tools
33+
- name: run lint
34+
run: make lint
6535
build-unsigned-snapshot:
6636
name: Build Unsigned Snapshot
6737
runs-on: ubuntu-22.04
@@ -83,36 +53,6 @@ jobs:
8353
path: build
8454
retention-days: 1
8555

86-
integration-tests:
87-
name: Integration Tests
88-
needs: build-unsigned-snapshot
89-
runs-on: ubuntu-22.04
90-
strategy:
91-
matrix:
92-
container:
93-
- image: "ubuntu"
94-
version: "22.04"
95-
- image: "redhatenterprise"
96-
version: "9"
97-
- image: "alpine"
98-
version: "3.19"
99-
steps:
100-
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
101-
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
102-
with:
103-
go-version-file: 'go.mod'
104-
cache: false
105-
- name: Download Packages
106-
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2
107-
with:
108-
name: nginx-agent-unsigned-snapshots
109-
path: build
110-
- name: Run Integration Tests
111-
run: |
112-
go install github.com/goreleaser/nfpm/v2/cmd/nfpm@${{ env.NFPM_VERSION }}
113-
OS_RELEASE="${{ matrix.container.image }}" OS_VERSION="${{ matrix.container.version }}" \
114-
make integration-test
115-
11656
official-oss-image-integration-tests:
11757
name: Integration Tests - Official OSS Images
11858
needs: build-unsigned-snapshot
@@ -124,15 +64,6 @@ jobs:
12464
- image: "bookworm"
12565
version: "stable"
12666
release: "debian"
127-
- image: "bookworm"
128-
version: "mainline"
129-
release: "debian"
130-
- image: "alpine"
131-
version: "stable"
132-
release: "alpine"
133-
- image: "alpine"
134-
version: "mainline"
135-
release: "alpine"
13667
steps:
13768
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
13869
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
@@ -160,22 +91,6 @@ jobs:
16091
strategy:
16192
matrix:
16293
container:
163-
- image: "alpine"
164-
version: "3.20"
165-
plus: "r32"
166-
release: "alpine"
167-
path: "/nginx-plus/agent"
168-
- image: "alpine"
169-
version: "3.19"
170-
plus: "r31"
171-
release: "alpine"
172-
path: "/nginx-plus/agent"
173-
- image: "debian"
174-
version: "bookworm"
175-
plus: "r32"
176-
release: "debian"
177-
path: "/nginx-plus/agent"
178-
- image: "debian"
17994
version: "bookworm"
18095
plus: "r31"
18196
release: "debian"
@@ -205,124 +120,123 @@ jobs:
205120
OS_RELEASE="${{ matrix.container.release }}" OS_VERSION="${{ matrix.container.version }}" IMAGE_PATH="${{ matrix.container.path }}" \
206121
make official-image-integration-test
207122
208-
# performance-tests:
209-
# name: Performance Tests
210-
# runs-on: ubuntu-22.04
211-
# permissions:
212-
# contents: write
213-
# steps:
214-
# - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
215-
# - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
216-
# with:
217-
# go-version-file: 'go.mod'
218-
# cache: false
219-
# - name: Run Performance Tests
220-
# run: |
221-
# make performance-test
222-
# - name: Store benchmark result
223-
# uses: benchmark-action/github-action-benchmark@4de1bed97a47495fc4c5404952da0499e31f5c29 # v1.20.3
224-
# with:
225-
# name: Compare Benchmark Results
226-
# tool: 'go'
227-
# output-file-path: ./build/test/benchmark.txt
228-
# benchmark-data-dir-path: ""
229-
# # Set auto-push to false since GitHub API token is not given
230-
# auto-push: false
231-
# alert-threshold: '125%'
232-
# gh-pages-branch: "benchmark-results"
233-
# fail-on-alert: true
234-
# - name: Push benchmark result
235-
# if: ${{ success() && github.ref_name == 'v3'}}
236-
# run: git push 'https://github-actions:${{ secrets.GITHUB_TOKEN }}@github.com/nginx/agent.git' benchmark-results:benchmark-results
237-
# load-tests:
238-
# name: Load Tests
239-
# if: ${{ !github.event.pull_request.head.repo.fork && !startsWith(github.ref_name, 'dependabot/') }}
240-
# runs-on: ubuntu-22.04
241-
# needs: build-unsigned-snapshot
242-
#
243-
# steps:
244-
# - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
245-
# - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
246-
# with:
247-
# go-version-file: 'go.mod'
248-
# cache: false
249-
#
250-
# - name: Download Packages
251-
# uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2
252-
# with:
253-
# name: nginx-agent-unsigned-snapshots
254-
# path: build
255-
#
256-
# - name: Set up Docker Build
257-
# uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
258-
#
259-
# - name: Set env
260-
# run: echo "GO_VERSION=$(cat go.mod | grep toolchain | sed 's/toolchain //; s/go//')" >> $GITHUB_ENV
261-
#
262-
# - name: Build Docker Image
263-
# uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
264-
# env:
265-
# GO_VERSION: ${{ env.GO_VERSION }}
266-
# with:
267-
# file: test/docker/load/Dockerfile
268-
# tags: nginx-agent-load-test:1.0.0
269-
# context: '.'
270-
# push: false
271-
# load: true
272-
# no-cache: true
273-
# secrets: |
274-
# "nginx-crt=${{ secrets.NGINX_CRT }}"
275-
# "nginx-key=${{ secrets.NGINX_KEY }}"
276-
# build-args: |
277-
# OSARCH=amd64
278-
# GO_VERSION=${{ env.GO_VERSION }}
279-
#
280-
# - name: Run Load Tests
281-
# run: |
282-
# results=$(docker run --rm nginx-agent-load-test:1.0.0)
283-
# echo "$results" > benchmarks.json
284-
# echo "$results"
285-
#
286-
# - name: Upload Load Test Results
287-
# uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
288-
# with:
289-
# name: load-test-results
290-
# path: benchmarks.json
291-
# if-no-files-found: error
292-
#
293-
# - name: Store benchmark result
294-
# uses: benchmark-action/github-action-benchmark@4de1bed97a47495fc4c5404952da0499e31f5c29 # v1.20.3
295-
# with:
296-
# name: Compare Benchmark Results
297-
# tool: 'customSmallerIsBetter'
298-
# output-file-path: benchmarks.json
299-
# benchmark-data-dir-path: ""
300-
# # Set auto-push to false since GitHub API token is not given
301-
# auto-push: false
302-
# alert-threshold: '175%'
303-
# gh-pages-branch: "benchmark-results"
304-
# fail-on-alert: true
305-
#
306-
# - name: Push load test result
307-
# if: ${{ success() && github.ref_name == 'v3'}}
308-
# run: git push 'https://github-actions:${{ secrets.GITHUB_TOKEN }}@github.com/nginx/agent.git' benchmark-results:benchmark-results
123+
performance-tests:
124+
name: Performance Tests
125+
runs-on: ubuntu-22.04
126+
permissions:
127+
contents: write
128+
steps:
129+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
130+
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
131+
with:
132+
go-version-file: 'go.mod'
133+
cache: false
134+
- name: Run Performance Tests
135+
run: |
136+
make performance-test
137+
- name: Store benchmark result
138+
uses: benchmark-action/github-action-benchmark@4de1bed97a47495fc4c5404952da0499e31f5c29 # v1.20.3
139+
with:
140+
name: Compare Benchmark Results
141+
tool: 'go'
142+
output-file-path: ./build/test/benchmark.txt
143+
benchmark-data-dir-path: ""
144+
# Set auto-push to false since GitHub API token is not given
145+
auto-push: false
146+
alert-threshold: '125%'
147+
gh-pages-branch: "benchmark-results"
148+
fail-on-alert: true
149+
- name: Push benchmark result
150+
if: ${{ success() && github.ref_name == 'v3'}}
151+
run: git push 'https://github-actions:${{ secrets.GITHUB_TOKEN }}@github.com/nginx/agent.git' benchmark-results:benchmark-results
152+
load-tests:
153+
name: Load Tests
154+
if: ${{ !github.event.pull_request.head.repo.fork && !startsWith(github.ref_name, 'dependabot/') }}
155+
runs-on: ubuntu-22.04
156+
needs: build-unsigned-snapshot
157+
158+
steps:
159+
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
160+
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
161+
with:
162+
go-version-file: 'go.mod'
163+
cache: false
164+
165+
- name: Download Packages
166+
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2
167+
with:
168+
name: nginx-agent-unsigned-snapshots
169+
path: build
170+
171+
- name: Set up Docker Build
172+
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
173+
174+
- name: Set env
175+
run: echo "GO_VERSION=$(cat go.mod | grep toolchain | sed 's/toolchain //; s/go//')" >> $GITHUB_ENV
176+
177+
- name: Build Docker Image
178+
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
179+
env:
180+
GO_VERSION: ${{ env.GO_VERSION }}
181+
with:
182+
file: test/docker/load/Dockerfile
183+
tags: nginx-agent-load-test:1.0.0
184+
context: '.'
185+
push: false
186+
load: true
187+
no-cache: true
188+
secrets: |
189+
"nginx-crt=${{ secrets.NGINX_CRT }}"
190+
"nginx-key=${{ secrets.NGINX_KEY }}"
191+
build-args: |
192+
OSARCH=amd64
193+
GO_VERSION=${{ env.GO_VERSION }}
194+
195+
- name: Run Load Tests
196+
run: |
197+
results=$(docker run --rm nginx-agent-load-test:1.0.0)
198+
echo "$results" > benchmarks.json
199+
echo "$results"
200+
201+
- name: Upload Load Test Results
202+
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
203+
with:
204+
name: load-test-results
205+
path: benchmarks.json
206+
if-no-files-found: error
207+
208+
- name: Store benchmark result
209+
uses: benchmark-action/github-action-benchmark@4de1bed97a47495fc4c5404952da0499e31f5c29 # v1.20.3
210+
with:
211+
name: Compare Benchmark Results
212+
tool: 'customSmallerIsBetter'
213+
output-file-path: benchmarks.json
214+
benchmark-data-dir-path: ""
215+
# Set auto-push to false since GitHub API token is not given
216+
auto-push: false
217+
alert-threshold: '175%'
218+
gh-pages-branch: "benchmark-results"
219+
fail-on-alert: true
220+
221+
- name: Push load test result
222+
if: ${{ success() && github.ref_name == 'v3'}}
223+
run: git push 'https://github-actions:${{ secrets.GITHUB_TOKEN }}@github.com/nginx/agent.git' benchmark-results:benchmark-results
309224

310-
# publish-packages:
311-
# name: Publish NGINX Agent v3 packages
312-
# if: ${{ github.ref_name == 'v3' &&
313-
# !github.event.pull_request.head.repo.fork }}
314-
# needs: [ lint, unit-test, performance-tests,
315-
# load-tests, official-oss-image-integration-tests,
316-
# official-plus-image-integration-tests,
317-
# race-condition-test, integration-tests ]
318-
# uses: ./.github/workflows/release-branch.yml
319-
# secrets: inherit
320-
# permissions:
321-
# id-token: write
322-
# contents: read
323-
# with:
324-
# packageVersion: "3.0.0"
325-
# packageBuildNo: "${{ github.run_number }}"
326-
# uploadAzure: true
327-
# publishPackages: true
328-
# releaseBranch: "v3"
225+
publish-packages:
226+
name: Publish NGINX Agent v3 packages
227+
if: ${{ github.ref_name == 'v3' &&
228+
!github.event.pull_request.head.repo.fork }}
229+
needs: [ lint, performance-tests,
230+
load-tests, official-oss-image-integration-tests,
231+
official-plus-image-integration-tests ]
232+
uses: ./.github/workflows/release-branch.yml
233+
secrets: inherit
234+
permissions:
235+
id-token: write
236+
contents: read
237+
with:
238+
packageVersion: "3.0.0"
239+
packageBuildNo: "${{ github.run_number }}"
240+
uploadAzure: true
241+
publishPackages: true
242+
releaseBranch: "v3"

0 commit comments

Comments
 (0)