|
| 1 | +name: E2E tests |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: {} |
| 5 | + |
| 6 | +permissions: |
| 7 | + contents: read |
| 8 | + |
| 9 | +env: |
| 10 | + MISE_VERBOSE: 1 |
| 11 | + MISE_DEBUG: 1 |
| 12 | + |
| 13 | +jobs: |
| 14 | + e2e-tests: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - name: Harden Runner |
| 18 | + uses: step-security/harden-runner@a90bcbc6539c36a85cdfeb73f7e2f433735f215b # v2.15.0 |
| 19 | + with: |
| 20 | + egress-policy: audit |
| 21 | + - name: checkout repository |
| 22 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 23 | + with: |
| 24 | + fetch-depth: 0 |
| 25 | + |
| 26 | + - name: setup golang |
| 27 | + uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0 |
| 28 | + with: |
| 29 | + go-version-file: go.mod |
| 30 | + cache: false |
| 31 | + |
| 32 | + - name: build docker image |
| 33 | + env: |
| 34 | + IMG: kong-operator |
| 35 | + TAG: e2e-${{ github.sha }} |
| 36 | + run: make docker.build |
| 37 | + |
| 38 | + - uses: jdx/mise-action@c1ecc8f748cd28cdeabf76dab3cccde4ce692fe4 # v4.0.0 |
| 39 | + with: |
| 40 | + install: false |
| 41 | + |
| 42 | + - run: echo "GO_MOD_CACHE=$(go env GOMODCACHE)" >> $GITHUB_ENV |
| 43 | + - run: echo "GO_BUILD_CACHE=$(go env GOCACHE)" >> $GITHUB_ENV |
| 44 | + |
| 45 | + - run: echo "GO_CACHE_KEY=go-e2e-${{ runner.os }}-${{ runner.arch }}-go-${{ hashFiles('**/go.mod') }}" >> $GITHUB_ENV |
| 46 | + - run: echo "GO_CACHE_KEY_2=go-e2e-${{ runner.os }}-${{ runner.arch }}-go-" >> $GITHUB_ENV |
| 47 | + |
| 48 | + - name: Go cache main branch |
| 49 | + if: ${{ github.ref == 'refs/heads/main' }} |
| 50 | + uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 |
| 51 | + with: |
| 52 | + path: | |
| 53 | + ${{ env.GO_MOD_CACHE }} |
| 54 | + ${{ env.GO_BUILD_CACHE }} |
| 55 | + key: ${{ env.GO_CACHE_KEY }} |
| 56 | + restore-keys: | |
| 57 | + ${{ env.GO_CACHE_KEY }} |
| 58 | + ${{ env.GO_CACHE_KEY_2 }} |
| 59 | +
|
| 60 | + - name: Go cache (restore only for non-main branches) |
| 61 | + if: ${{ github.ref != 'refs/heads/main' }} |
| 62 | + uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 |
| 63 | + with: |
| 64 | + path: | |
| 65 | + ${{ env.GO_MOD_CACHE }} |
| 66 | + ${{ env.GO_BUILD_CACHE }} |
| 67 | + key: ${{ env.GO_CACHE_KEY }} |
| 68 | + restore-keys: | |
| 69 | + ${{ env.GO_CACHE_KEY }} |
| 70 | + ${{ env.GO_CACHE_KEY_2 }} |
| 71 | +
|
| 72 | + - name: run e2e tests |
| 73 | + run: make test.e2e |
| 74 | + env: |
| 75 | + KONG_TEST_KONG_OPERATOR_IMAGE_LOAD: kong-operator:e2e-${{ github.sha }} |
| 76 | + GOTESTSUM_JUNITFILE: "e2e-tests.xml" |
| 77 | + # This is needed for ktf to find latest releases of addons. |
| 78 | + # This could be changed so that ktf addons have their versions pinned |
| 79 | + # in the test Makefile instead. |
| 80 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 81 | + |
| 82 | + - name: upload diagnostics |
| 83 | + if: always() |
| 84 | + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 |
| 85 | + with: |
| 86 | + name: diagnostics-e2e |
| 87 | + path: /tmp/ktf-diag* |
| 88 | + if-no-files-found: ignore |
| 89 | + |
| 90 | + - name: collect test report |
| 91 | + if: ${{ always() }} |
| 92 | + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 |
| 93 | + with: |
| 94 | + name: tests-report-e2e |
| 95 | + path: e2e-tests.xml |
0 commit comments