-
Notifications
You must be signed in to change notification settings - Fork 23
112 lines (96 loc) · 3.26 KB
/
ci.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
name: Continuous Integration
on:
push:
branches:
- main
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
pull_request:
branches:
- main
schedule:
- cron: "0 5 * * *" # runs every day at 5am UTC
defaults:
run:
shell: bash
concurrency:
group: ${{ github.ref_name }}-ci
cancel-in-progress: true
permissions:
contents: read
jobs:
unit-test:
name: Unit Test
runs-on: ubuntu-22.04
permissions:
contents: read
strategy:
fail-fast: false
matrix:
go-version: ["1.21", stable]
steps:
- name: Checkout Repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Setup Golang Environment
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: ${{ matrix.go-version }}
- name: Run Unit Tests
run: make unit-test
build:
name: Build Client
runs-on: ubuntu-22.04
permissions:
contents: write
if: ${{ github.event.repository.fork == false }}
steps:
- name: Checkout Repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Switch Repository (Nightly)
if: (github.event_name == 'schedule')
run: |
sed -i 's|pkgs.nginx.com|pkgs-test.nginx.com|g' docker/Dockerfile
sed -i '16d' docker/Dockerfile
sed -i "17i sed -i 's|pkgs|pkgs-test|g' /etc/apt/apt.conf.d/90pkgs-nginx" docker/Dockerfile
sed -i 's|deb https|deb [trusted=yes] https|g' docker/Dockerfile
sed -i 's|\${NGINX_PLUS_VERSION}/||g' docker/Dockerfile
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4fd812986e6c8c2a69e18311145f9371337f27d4 # v3.4.0
- name: Build Plus Docker Image
uses: docker/build-push-action@1a162644f9a7e87d8f4b053101d1d9a712edc18c # v6.3.0
with:
file: docker/Dockerfile
tags: nginx-plus
cache-from: type=gha
cache-to: type=gha,mode=max
load: true
secrets: |
"nginx-repo.crt=${{ secrets.NGINX_CRT }}"
"nginx-repo.key=${{ secrets.NGINX_KEY }}"
- name: Test Client
run: docker compose up test --exit-code-from test
- name: Test Client No Stream
run: docker compose up test-no-stream --exit-code-from test-no-stream
- name: Create/Update Draft
uses: lucacome/draft-release@8a63d32c79a171ae6048e614a8988f0ac3ed56d4 # v1.1.0
id: release-notes
with:
minor-label: "enhancement"
major-label: "change"
publish: ${{ github.ref_type == 'tag' }}
collapse-after: 50
if: ${{ github.event_name == 'push' }}
- name: Setup Golang Environment
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: stable
if: ${{ github.ref_type == 'tag' }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_COMMUNITY }}
if: ${{ github.ref_type == 'tag' }}