-
Notifications
You must be signed in to change notification settings - Fork 118
Automate functional test in the pipeline #1634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
478d1ab
automate functional tests in pipeline
salonichf5 1338ab2
remove wait time
salonichf5 abba358
update scope
salonichf5 d3a5626
remove scope for docker images
salonichf5 e9f0dda
scope update
salonichf5 448a0b0
update readme
salonichf5 67d29a7
add scope to cache
salonichf5 edee698
update based on reviews
salonichf5 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,124 @@ | ||
name: Functional Testing | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- release-* | ||
tags: | ||
- "v[0-9]+.[0-9]+.[0-9]+*" | ||
pull_request: | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
concurrency: | ||
group: ${{ github.ref_name }}-functional | ||
cancel-in-progress: true | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
functional-tests: | ||
name: Gateway Functional Tests | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
matrix: | ||
k8s-version: ["1.23.17", "latest"] | ||
nginx-image: [nginx, nginx-plus] | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
|
||
- name: Setup Golang Environment | ||
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | ||
with: | ||
go-version: stable | ||
|
||
- name: Set GOPATH | ||
run: echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV | ||
|
||
- name: Docker Buildx | ||
uses: docker/setup-buildx-action@0d103c3126aa41d772a8362f6aa67afac040f80c # v3.1.0 | ||
|
||
|
||
salonichf5 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- name: NGF Docker meta | ||
id: ngf-meta | ||
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1 | ||
with: | ||
images: | | ||
name=ghcr.io/nginxinc/nginx-gateway-fabric | ||
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: NGINX Docker meta | ||
id: nginx-meta | ||
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1 | ||
with: | ||
images: | | ||
name=ghcr.io/nginxinc/nginx-gateway-fabric/${{ matrix.nginx-image }} | ||
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: Build binary | ||
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0 | ||
with: | ||
version: latest | ||
args: build --snapshot --clean | ||
|
||
- name: Build NGF Docker Image | ||
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0 | ||
with: | ||
file: build/Dockerfile | ||
tags: ${{ steps.ngf-meta.outputs.tags }} | ||
context: "." | ||
load: true | ||
cache-from: type=gha,scope=ngf | ||
cache-to: type=gha,scope=ngf,mode=max | ||
pull: true | ||
target: goreleaser | ||
|
||
- name: Build NGINX Docker Image | ||
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0 | ||
with: | ||
file: build/Dockerfile${{ matrix.nginx-image == 'nginx' && '.nginx' || '' }}${{ matrix.nginx-image == 'nginx-plus' && '.nginxplus' || ''}} | ||
tags: ${{ steps.nginx-meta.outputs.tags }} | ||
context: "." | ||
load: true | ||
cache-from: type=gha,scope=${{ matrix.nginx-image }} | ||
cache-to: type=gha,scope=${{ matrix.nginx-image }},mode=max | ||
pull: true | ||
build-args: | | ||
NJS_DIR=internal/mode/static/nginx/modules/src | ||
NGINX_CONF_DIR=internal/mode/static/nginx/conf | ||
BUILD_AGENT=gha | ||
|
||
- name: Deploy Kubernetes | ||
id: k8s | ||
run: | | ||
k8s_version=${{ matrix.k8s-version }} | ||
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}' || '' }} | ||
echo "KUBECONFIG=${{ github.workspace }}/kube-${{ github.run_id }}" >> "$GITHUB_ENV" | ||
|
||
salonichf5 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- name: Setup functional tests | ||
id: setup | ||
run: | | ||
ngf_prefix=ghcr.io/nginxinc/nginx-gateway-fabric | ||
ngf_tag=${{ steps.ngf-meta.outputs.version }} | ||
make load-images${{ matrix.nginx-image == 'nginx-plus' && '-with-plus' || ''}} PREFIX=${ngf_prefix} TAG=${ngf_tag} | ||
working-directory: ./tests | ||
|
||
- name: Run functional tests | ||
run: | | ||
ngf_prefix=ghcr.io/nginxinc/nginx-gateway-fabric | ||
ngf_tag=${{ steps.ngf-meta.outputs.version }} | ||
make test${{ matrix.nginx-image == 'nginx-plus' && '-with-plus' || ''}} PREFIX=${ngf_prefix} TAG=${ngf_tag} | ||
working-directory: ./tests |
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.