11name : Conformance Testing
22
33on :
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
1315
1416defaults :
1517 run :
1618 shell : bash
1719
18- concurrency :
19- group : ${{ github.ref_name }}-conformance
20- cancel-in-progress : true
21-
2220permissions :
2321 contents : read
2422
2523jobs :
2624 conformance-tests :
27- name : Gateway Conformance Tests
25+ name : Run Tests
2826 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]
3427 permissions :
3528 contents : write # needed for uploading release artifacts
3629 steps :
3730 - name : Checkout Repository
3831 uses : actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
3932
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
4235 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 }}
4738
4839 - name : Docker Buildx
4940 uses : docker/setup-buildx-action@2b51285047da1547ffb1b2203d8be4c0af6b1f20 # v3.2.0
5748 tags : |
5849 type=semver,pattern={{version}}
5950 type=edge
51+ type=schedule
6052 type=ref,event=pr
6153 type=ref,event=branch,suffix=-rc,enable=${{ startsWith(github.ref, 'refs/heads/release') }}
6254
@@ -65,29 +57,21 @@ jobs:
6557 uses : docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
6658 with :
6759 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 }}
6961 tags : |
7062 type=semver,pattern={{version}}
7163 type=edge
64+ type=schedule
7265 type=ref,event=pr
7366 type=ref,event=branch,suffix=-rc,enable=${{ startsWith(github.ref, 'refs/heads/release') }}
7467
7568 - name : Prepare NGF files
7669 run : |
7770 ngf_prefix=ghcr.io/nginxinc/nginx-gateway-fabric
7871 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}
8073 working-directory : ./conformance
8174
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-
9175 - name : Build NGF Docker Image
9276 uses : docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
9377 with :
@@ -97,18 +81,16 @@ jobs:
9781 target : goreleaser
9882 load : true
9983 cache-from : type=gha,scope=ngf
100- cache-to : type=gha,scope=ngf,mode=max
10184 pull : true
10285
10386 - name : Build NGINX Docker Image
10487 uses : docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
10588 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' || ''}}
10790 tags : ${{ steps.nginx-meta.outputs.tags }}
10891 context : " ."
10992 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 }}
11294 pull : true
11395 build-args : |
11496 NJS_DIR=internal/mode/static/nginx/modules/src
@@ -134,26 +116,19 @@ jobs:
134116 - name : Deploy Kubernetes
135117 id : k8s
136118 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}' || '' }}
139121 echo "KUBECONFIG=${{ github.workspace }}/kube-${{ github.run_id }}" >> "$GITHUB_ENV"
140122 working-directory : ./conformance
141123
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-
149124 - name : Setup conformance tests
150125 run : |
151126 ngf_prefix=ghcr.io/nginxinc/nginx-gateway-fabric
152127 ngf_tag=${{ steps.ngf-meta.outputs.version }}
153128 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}
157132 working-directory : ./conformance
158133
159134 - name : Run conformance tests
@@ -165,7 +140,7 @@ jobs:
165140 working-directory : ./conformance
166141
167142 - 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/') }}
169144 env :
170145 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
171146 run : gh release upload ${{ github.ref_name }} conformance-profile.yaml
0 commit comments