1
1
name : Conformance Testing
2
2
3
3
on :
4
- push :
5
- branches :
6
- - main
7
- - release-*
8
- tags :
9
- - " v[0-9]+.[0-9]+.[0-9]+*"
10
- pull_request :
11
- schedule :
12
- - cron : " 0 4 * * *" # run every day at 4am UTC
4
+ workflow_call :
5
+ inputs :
6
+ image :
7
+ required : true
8
+ type : string
9
+ k8s-version :
10
+ required : true
11
+ type : string
12
+ enable-experimental :
13
+ required : true
14
+ type : boolean
13
15
14
16
defaults :
15
17
run :
16
18
shell : bash
17
19
18
- concurrency :
19
- group : ${{ github.ref_name }}-conformance
20
- cancel-in-progress : true
21
-
22
20
permissions :
23
21
contents : read
24
22
25
23
jobs :
26
24
conformance-tests :
27
- name : Gateway Conformance Tests
25
+ name : Run Tests
28
26
runs-on : ubuntu-22.04
29
- strategy :
30
- matrix :
31
- k8s-version : ["1.23.17", "latest"]
32
- nginx-image : [nginx, nginx-plus]
33
- enable-experimental : [true, false]
34
27
permissions :
35
28
contents : write # needed for uploading release artifacts
36
29
steps :
37
30
- name : Checkout Repository
38
31
uses : actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
39
32
40
- - name : Setup Golang Environment
41
- uses : actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5 .0.0
33
+ - name : Fetch Cached Artifacts
34
+ uses : actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4 .0.1
42
35
with :
43
- go-version : stable
44
-
45
- - name : Set GOPATH
46
- run : echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
36
+ path : ${{ github.workspace }}/dist
37
+ key : nginx-gateway-fabric-${{ github.run_id }}-${{ github.run_number }}
47
38
48
39
- name : Docker Buildx
49
40
uses : docker/setup-buildx-action@2b51285047da1547ffb1b2203d8be4c0af6b1f20 # v3.2.0
57
48
tags : |
58
49
type=semver,pattern={{version}}
59
50
type=edge
51
+ type=schedule
60
52
type=ref,event=pr
61
53
type=ref,event=branch,suffix=-rc,enable=${{ startsWith(github.ref, 'refs/heads/release') }}
62
54
@@ -65,29 +57,21 @@ jobs:
65
57
uses : docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
66
58
with :
67
59
images : |
68
- name=ghcr.io/nginxinc/nginx-gateway-fabric/${{ matrix. nginx-image }}
60
+ name=ghcr.io/nginxinc/nginx-gateway-fabric/${{ inputs.image == 'plus' && ' nginx-plus' || inputs. image }}
69
61
tags : |
70
62
type=semver,pattern={{version}}
71
63
type=edge
64
+ type=schedule
72
65
type=ref,event=pr
73
66
type=ref,event=branch,suffix=-rc,enable=${{ startsWith(github.ref, 'refs/heads/release') }}
74
67
75
68
- name : Prepare NGF files
76
69
run : |
77
70
ngf_prefix=ghcr.io/nginxinc/nginx-gateway-fabric
78
71
ngf_tag=${{ steps.ngf-meta.outputs.version }}
79
- make update-ngf-manifest${{ matrix.nginx- image == 'nginx- plus' && '-with-plus' || ''}} PREFIX=${ngf_prefix} TAG=${ngf_tag}
72
+ make update-ngf-manifest${{ inputs. image == 'plus' && '-with-plus' || ''}} PREFIX=${ngf_prefix} TAG=${ngf_tag}
80
73
working-directory : ./conformance
81
74
82
- - name : Build binary
83
- uses : goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0
84
- with :
85
- version : latest
86
- args : build --snapshot --clean
87
- env :
88
- TELEMETRY_ENDPOINT : " " # disables sending telemetry
89
- TELEMETRY_ENDPOINT_INSECURE : " false"
90
-
91
75
- name : Build NGF Docker Image
92
76
uses : docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
93
77
with :
@@ -97,18 +81,16 @@ jobs:
97
81
target : goreleaser
98
82
load : true
99
83
cache-from : type=gha,scope=ngf
100
- cache-to : type=gha,scope=ngf,mode=max
101
84
pull : true
102
85
103
86
- name : Build NGINX Docker Image
104
87
uses : docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
105
88
with :
106
- file : build/Dockerfile${{ matrix.nginx- image == 'nginx' && '.nginx' || '' }}${{ matrix.nginx- image == 'nginx- plus' && '.nginxplus' || ''}}
89
+ file : build/Dockerfile${{ inputs. image == 'nginx' && '.nginx' || '' }}${{ inputs. image == 'plus' && '.nginxplus' || ''}}
107
90
tags : ${{ steps.nginx-meta.outputs.tags }}
108
91
context : " ."
109
92
load : true
110
- cache-from : type=gha,scope=${{ matrix.nginx-image }}
111
- cache-to : type=gha,scope=${{ matrix.nginx-image }},mode=max
93
+ cache-from : type=gha,scope=${{ inputs.image }}
112
94
pull : true
113
95
build-args : |
114
96
NJS_DIR=internal/mode/static/nginx/modules/src
@@ -134,26 +116,19 @@ jobs:
134
116
- name : Deploy Kubernetes
135
117
id : k8s
136
118
run : |
137
- k8s_version=${{ matrix .k8s-version }}
138
- make create-kind-cluster KIND_KUBE_CONFIG=${{ github.workspace }}/kube-${{ github.run_id }} ${{ ! contains(matrix .k8s-version, 'latest') && 'KIND_IMAGE=kindest/node:v${k8s_version}' || '' }}
119
+ k8s_version=${{ inputs .k8s-version }}
120
+ make create-kind-cluster KIND_KUBE_CONFIG=${{ github.workspace }}/kube-${{ github.run_id }} ${{ ! contains(inputs .k8s-version, 'latest') && 'KIND_IMAGE=kindest/node:v${k8s_version}' || '' }}
139
121
echo "KUBECONFIG=${{ github.workspace }}/kube-${{ github.run_id }}" >> "$GITHUB_ENV"
140
122
working-directory : ./conformance
141
123
142
- - name : Wait for release to exist
143
- if : startsWith(github.ref, 'refs/tags/')
144
- run : |
145
- REF=${{ github.ref_name }}
146
- until docker pull ghcr.io/nginxinc/nginx-gateway-fabric:${REF#v}; do sleep 5; done
147
- until docker pull ghcr.io/nginxinc/nginx-gateway-fabric/nginx:${REF#v}; do sleep 5; done
148
-
149
124
- name : Setup conformance tests
150
125
run : |
151
126
ngf_prefix=ghcr.io/nginxinc/nginx-gateway-fabric
152
127
ngf_tag=${{ steps.ngf-meta.outputs.version }}
153
128
if [ ${{ github.event_name }} == "schedule" ]; then export GW_API_VERSION=main; fi
154
- if [ ${{ startsWith(matrix .k8s-version, '1.23') || startsWith(matrix .k8s-version, '1.24') }} == "true" ]; then export INSTALL_WEBHOOK=true; fi
155
- if [ ${{ matrix .enable-experimental }} == "true" ]; then export ENABLE_EXPERIMENTAL=true; fi
156
- make install-ngf-local-no-build${{ matrix.nginx- image == 'nginx- plus' && '-with-plus' || ''}} PREFIX=${ngf_prefix} TAG=${ngf_tag}
129
+ if [ ${{ startsWith(inputs .k8s-version, '1.23') || startsWith(inputs .k8s-version, '1.24') }} == "true" ]; then export INSTALL_WEBHOOK=true; fi
130
+ if [ ${{ inputs .enable-experimental }} == "true" ]; then export ENABLE_EXPERIMENTAL=true; fi
131
+ make install-ngf-local-no-build${{ inputs. image == 'plus' && '-with-plus' || ''}} PREFIX=${ngf_prefix} TAG=${ngf_tag}
157
132
working-directory : ./conformance
158
133
159
134
- name : Run conformance tests
@@ -165,7 +140,7 @@ jobs:
165
140
working-directory : ./conformance
166
141
167
142
- name : Upload profile to release
168
- if : ${{ matrix .k8s-version == 'latest' && startsWith(github.ref, 'refs/tags/') }}
143
+ if : ${{ inputs .k8s-version == 'latest' && startsWith(github.ref, 'refs/tags/') }}
169
144
env :
170
145
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
171
146
run : gh release upload ${{ github.ref_name }} conformance-profile.yaml
0 commit comments