|
| 1 | +name: Non Functional Testing |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + test_label: |
| 7 | + description: NFR test to run. Choose between performance, upgrade, or all |
| 8 | + required: true |
| 9 | + default: all |
| 10 | + type: choice |
| 11 | + options: [performance, upgrade, all] |
| 12 | + version: |
| 13 | + description: Version of NGF under test |
| 14 | + required: true |
| 15 | + default: edge |
| 16 | + image_tag: |
| 17 | + description: Tag of the NGF and NGINX Docker images |
| 18 | + required: true |
| 19 | + default: edge |
| 20 | + nginx_plus: |
| 21 | + description: Run tests with NGINX Plus |
| 22 | + required: false |
| 23 | + default: false |
| 24 | + type: boolean |
| 25 | + |
| 26 | +defaults: |
| 27 | + run: |
| 28 | + shell: bash |
| 29 | + |
| 30 | +concurrency: |
| 31 | + group: ${{ github.ref_name }}-nfr |
| 32 | + cancel-in-progress: true |
| 33 | + |
| 34 | +permissions: |
| 35 | + contents: read |
| 36 | + |
| 37 | +jobs: |
| 38 | + setup-and-run-tests: |
| 39 | + name: Setup and Run NFR Tests |
| 40 | + runs-on: ubuntu-22.04 |
| 41 | + permissions: |
| 42 | + contents: write # needed for opening PR with the results files |
| 43 | + pull-requests: write # needed for opening PR with the results files |
| 44 | + id-token: write # needed for authenticating to GCP |
| 45 | + |
| 46 | + steps: |
| 47 | + - name: Checkout Repository |
| 48 | + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 |
| 49 | + |
| 50 | + - name: Setup Golang Environment |
| 51 | + uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 |
| 52 | + with: |
| 53 | + go-version: stable |
| 54 | + |
| 55 | + - name: Set GOPATH |
| 56 | + run: echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV |
| 57 | + |
| 58 | + - name: Docker Buildx |
| 59 | + if: ${{ inputs.nginx_plus == true }} |
| 60 | + uses: docker/setup-buildx-action@0d103c3126aa41d772a8362f6aa67afac040f80c # v3.1.0 |
| 61 | + |
| 62 | + - name: NGINX Docker meta |
| 63 | + id: nginx-meta |
| 64 | + if: ${{ inputs.nginx_plus == true }} |
| 65 | + uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1 |
| 66 | + with: |
| 67 | + images: | |
| 68 | + name=gcr.io/${{ secrets.GCP_PROJECT_ID }}/ngf-nfr/nginx-gateway-fabric/nginx-plus |
| 69 | + tags: | |
| 70 | + type=raw,value=${{ inputs.image_tag }} |
| 71 | +
|
| 72 | + - name: Authenticate to Google Cloud |
| 73 | + id: auth |
| 74 | + uses: google-github-actions/auth@55bd3a7c6e2ae7cf1877fd1ccb9d54c0503c457c # v2.1.2 |
| 75 | + with: |
| 76 | + token_format: access_token |
| 77 | + workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY }} |
| 78 | + service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }} |
| 79 | + |
| 80 | + - name: Set up Cloud SDK |
| 81 | + uses: google-github-actions/setup-gcloud@98ddc00a17442e89a24bbf282954a3b65ce6d200 # v2.1.0 |
| 82 | + with: |
| 83 | + project_id: ${{ secrets.GCP_PROJECT_ID }} |
| 84 | + install_components: kubectl |
| 85 | + |
| 86 | + - name: Login to GCR |
| 87 | + if: ${{ inputs.nginx_plus == true }} |
| 88 | + run: gcloud auth configure-docker gcr.io -q |
| 89 | + |
| 90 | + - name: Build NGINX Plus Docker Image |
| 91 | + if: ${{ inputs.nginx_plus == true }} |
| 92 | + uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0 |
| 93 | + with: |
| 94 | + file: build/Dockerfile.nginxplus |
| 95 | + tags: ${{ steps.nginx-meta.outputs.tags }} |
| 96 | + context: "." |
| 97 | + platforms: linux/amd64 |
| 98 | + provenance: false |
| 99 | + pull: true |
| 100 | + push: true |
| 101 | + build-args: | |
| 102 | + NJS_DIR=internal/mode/static/nginx/modules/src |
| 103 | + NGINX_CONF_DIR=internal/mode/static/nginx/conf |
| 104 | + BUILD_AGENT=gha |
| 105 | + secrets: | |
| 106 | + ${{ format('"nginx-repo.crt={0}"', secrets.NGINX_CRT) }} |
| 107 | + ${{ format('"nginx-repo.key={0}"', secrets.NGINX_KEY) }} |
| 108 | +
|
| 109 | + - name: Setup dotenv file |
| 110 | + working-directory: ./tests/scripts |
| 111 | + run: | |
| 112 | + echo "RESOURCE_NAME=nfr-tests-${{ github.run_id }}" >> vars.env |
| 113 | + echo "TAG=${{ inputs.image_tag }}" >> vars.env |
| 114 | + echo "PREFIX=ghcr.io/nginxinc/nginx-gateway-fabric" >> vars.env |
| 115 | + echo "NGINX_PREFIX=ghcr.io/nginxinc/nginx-gateway-fabric/nginx" >> vars.env |
| 116 | + echo "NGINX_PLUS_PREFIX=gcr.io/${{ secrets.GCP_PROJECT_ID }}/ngf-nfr/nginx-gateway-fabric/nginx-plus" >> vars.env |
| 117 | + echo "GKE_CLUSTER_NAME=nfr-tests-${{ github.run_id }}" >> vars.env |
| 118 | + echo "GKE_CLUSTER_ZONE=us-east1-b" >> vars.env |
| 119 | + echo "GKE_CLUSTER_REGION=us-east1" >> vars.env |
| 120 | + echo "GKE_PROJECT=${{ secrets.GCP_PROJECT_ID }}" >> vars.env |
| 121 | + echo "GKE_SVC_ACCOUNT=${{ secrets.GCP_SERVICE_ACCOUNT }}" >> vars.env |
| 122 | + echo "GKE_NODES_SERVICE_ACCOUNT=${{ secrets.GKE_NODES_SERVICE_ACCOUNT }}" >> vars.env |
| 123 | + echo "IMAGE=projects/debian-cloud/global/images/debian-11-bullseye-v20240213" >> vars.env |
| 124 | + echo "NETWORK_TAGS=nfr-tests-${{ github.run_id }}" >> vars.env |
| 125 | + echo "NGF_REPO=nginxinc" >> vars.env |
| 126 | + echo "NGF_BRANCH=${{ github.ref_name }}" >> vars.env |
| 127 | + echo "SOURCE_IP_RANGE=$(curl -sS -4 icanhazip.com)/32" >> vars.env |
| 128 | + echo "ADD_VM_IP_AUTH_NETWORKS=true" >> vars.env |
| 129 | + echo "PLUS_ENABLED=${{ inputs.nginx_plus }}" >> vars.env |
| 130 | + echo "GINKGO_LABEL=" >> vars.env |
| 131 | + echo "NGF_VERSION=${{ inputs.version }}" >> vars.env |
| 132 | +
|
| 133 | + - name: Create GKE cluster |
| 134 | + working-directory: ./tests |
| 135 | + run: |
| 136 | + make create-gke-cluster CI=true |
| 137 | + |
| 138 | + - name: Create and setup VM |
| 139 | + working-directory: ./tests |
| 140 | + run: |
| 141 | + make create-and-setup-vm |
| 142 | + |
| 143 | + - name: Run Tests |
| 144 | + working-directory: ./tests |
| 145 | + run: | |
| 146 | + if ${{ inputs.test_label != 'all' }}; then |
| 147 | + sed -i '/^GINKGO_LABEL=/s/=.*/="${{ inputs.test_label }}"/' "scripts/vars.env" && make run-tests-on-vm; |
| 148 | + else |
| 149 | + make run-tests-on-vm; |
| 150 | + fi |
| 151 | +
|
| 152 | + - name: Cleanup |
| 153 | + working-directory: ./tests |
| 154 | + if: always() |
| 155 | + run: | |
| 156 | + bash scripts/cleanup-vm.sh true |
| 157 | + make delete-gke-cluster |
| 158 | + rm -rf scripts/vars.env |
| 159 | +
|
| 160 | + - name: Open a PR with the results |
| 161 | + uses: peter-evans/create-pull-request@a4f52f8033a6168103c2538976c07b467e8163bc # v6.0.1 |
| 162 | + with: |
| 163 | + commit-message: NFR Test Results for NGF version ${{ inputs.version }} |
| 164 | + author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com> |
| 165 | + branch: tests/nfr-tests-${{ inputs.version }} |
| 166 | + delete-branch: true |
| 167 | + title: NFR Test Results for NGF version ${{ inputs.version }} |
| 168 | + add-paths: | |
| 169 | + tests/results/ |
| 170 | + body: | |
| 171 | + Update with NFR test results for NGF version ${{ inputs.version }} |
| 172 | + - Auto-generated by the NFR tests workflow run ${{ github.run_id }} |
| 173 | + - Tests ran using Docker image tag ${{ inputs.image_tag }} |
| 174 | + - ${{ inputs.test_label }} test(s) ran |
| 175 | + - NGINX Plus enabled: ${{ inputs.nginx_plus }} |
| 176 | + labels: | |
| 177 | + tests |
| 178 | + assignees: ${{ github.actor }} |
| 179 | + draft: true |
0 commit comments