-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run conformance tests nightly on main branch (#884)
In order to ensure we are staying ahead of Gateway API changes, we'll now run conformance tests off of the main branch on a nightly schedule. Devs can also run from the main branch locally by setting the GW_API_VERSION variable.
- Loading branch information
Showing
6 changed files
with
202 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
name: Conformance Testing | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- release-* | ||
pull_request: | ||
branches: | ||
- main | ||
- release-* | ||
types: | ||
- opened | ||
- reopened | ||
- synchronize | ||
schedule: | ||
- cron: '0 4 * * *' | ||
|
||
concurrency: | ||
group: ${{ github.ref_name }}-conformance | ||
cancel-in-progress: true | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
conformance-tests: | ||
name: Gateway Conformance Tests | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | ||
|
||
- name: Setup Golang Environment | ||
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 | ||
with: | ||
go-version-file: go.mod | ||
|
||
- name: Set GOPATH | ||
run: echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV | ||
|
||
- name: Docker Buildx | ||
uses: docker/setup-buildx-action@4c0219f9ac95b02789c1075625400b2acbff50b1 # v2.9.1 | ||
|
||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@818d4b7b91585d195f67373fd9cb0332e31a7175 # v4.6.0 | ||
with: | ||
images: | | ||
name=ghcr.io/nginxinc/nginx-kubernetes-gateway | ||
tags: | | ||
type=semver,pattern={{version}} | ||
type=edge | ||
type=ref,event=pr | ||
type=ref,event=branch,suffix=-rc,enable=${{ startsWith(github.ref, 'refs/heads/release') }} | ||
- name: Prepare NKG files | ||
run: | | ||
nkg_prefix=$(echo ${{ steps.meta.outputs.tags }} | cut -d ":" -f 1) | ||
nkg_tag=$(echo ${{ steps.meta.outputs.tags }} | cut -d ":" -f 2) | ||
make update-nkg-manifest NKG_PREFIX=${nkg_prefix} NKG_TAG=${nkg_tag} | ||
working-directory: ./conformance | ||
|
||
- name: Build binary | ||
uses: goreleaser/goreleaser-action@336e29918d653399e599bfca99fadc1d7ffbc9f7 # v4.3.0 | ||
with: | ||
version: latest | ||
args: build --snapshot --clean | ||
|
||
- name: Build Docker Image | ||
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 # v4.1.1 | ||
with: | ||
file: build/Dockerfile | ||
tags: ${{ steps.meta.outputs.tags }} | ||
context: "." | ||
target: goreleaser | ||
load: true | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
pull: true | ||
|
||
- name: Update Go Modules | ||
if: ${{ github.event_name == 'schedule' }} | ||
run: make update-go-modules | ||
working-directory: ./conformance | ||
|
||
- name: Build Test Docker Image | ||
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 # v4.1.1 | ||
with: | ||
file: conformance/tests/Dockerfile | ||
tags: conformance-test-runner:${{ github.sha }} | ||
context: "." | ||
load: true | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
pull: true | ||
|
||
- name: Deploy Kubernetes | ||
id: k8s | ||
run: | | ||
make create-kind-cluster KIND_KUBE_CONFIG=${{ github.workspace }}/kube-${{ github.run_id }} | ||
echo "KUBECONFIG=${{ github.workspace }}/kube-${{ github.run_id }}" >> "$GITHUB_ENV" | ||
working-directory: ./conformance | ||
|
||
- name: Setup conformance tests | ||
run: | | ||
nkg_prefix=$(echo ${{ steps.meta.outputs.tags }} | cut -d ":" -f 1) | ||
nkg_tag=$(echo ${{ steps.meta.outputs.tags }} | cut -d ":" -f 2) | ||
if [ ${{ github.event_name }} == "schedule" ]; then | ||
export GW_API_VERSION=main | ||
fi | ||
make install-nkg-local-no-build NKG_PREFIX=${nkg_prefix} NKG_TAG=${nkg_tag} | ||
working-directory: ./conformance | ||
|
||
- name: Run conformance tests | ||
run: make run-conformance-tests TAG=${{ github.sha }} | ||
working-directory: ./conformance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
if [ -z $1 ]; then | ||
echo "gateway API version argument not set; exiting" | ||
exit 1 | ||
fi | ||
|
||
if [ $1 == "main" ]; then | ||
temp_dir=$(mktemp -d) | ||
cd ${temp_dir} | ||
curl -s https://codeload.github.com/kubernetes-sigs/gateway-api/tar.gz/main | tar -xz --strip=2 gateway-api-main/config | ||
kubectl apply -f webhook | ||
kubectl apply -f crd/standard | ||
rm -rf ${temp_dir} | ||
else | ||
kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v$1/standard-install.yaml | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
if [ -z $1 ]; then | ||
echo "gatway API version argument not set; exiting" | ||
exit 1 | ||
fi | ||
|
||
if [ $1 == "main" ]; then | ||
temp_dir=$(mktemp -d) | ||
cd ${temp_dir} | ||
curl -s https://codeload.github.com/kubernetes-sigs/gateway-api/tar.gz/main | tar -xz --strip=2 gateway-api-main/config | ||
kubectl delete -f webhook | ||
kubectl delete -f crd/standard | ||
rm -rf ${temp_dir} | ||
else | ||
kubectl delete -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v$1/standard-install.yaml | ||
fi |