Skip to content

Commit

Permalink
ci: run jobs in parallel for e2e testdata samples
Browse files Browse the repository at this point in the history
Change the workflow to run the E2E tests for the samples
to run the jobs in parallel. Also, refine the execution
to only trigger the workflow when changes are made on those samples
  • Loading branch information
camilamacedo86 committed Sep 10, 2024
1 parent 26c4b55 commit f49e667
Showing 1 changed file with 35 additions and 16 deletions.
51 changes: 35 additions & 16 deletions .github/workflows/test-e2e-samples.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
name: Testing E2E Sample
name: E2E Testdata Sample

on:
push:
paths-ignore:
- '**/*.md'
paths:
- 'testdata/project-v4/**'
- 'testdata/project-v4-with-plugins/**'
- '.github/workflows/test-e2e-samples.yml'
pull_request:
paths-ignore:
- '**/*.md'
paths:
- 'testdata/project-v4/**'
- 'testdata/project-v4-with-plugins/**'
- '.github/workflows/test-e2e-samples.yml'

jobs:
e2e-tests:
e2e-tests-project-v4:
runs-on: ubuntu-latest
# Pull requests from the same repository won't trigger this checks as they were already triggered by the push
strategy:
fail-fast: true
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Checkout repository
Expand Down Expand Up @@ -48,8 +53,28 @@ jobs:
run: |
make test-e2e
- name: Teardown kind cluster
run: kind delete cluster
e2e-tests-project-v4-with-plugins:
runs-on: ubuntu-latest
strategy:
fail-fast: true
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '~1.22'

- name: Install the latest version of kind
run: |
curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind
- name: Verify kind installation
run: kind version

- name: Create kind cluster
run: kind create cluster
Expand All @@ -59,21 +84,15 @@ jobs:
KUSTOMIZATION_FILE_PATH="testdata/project-v4-with-plugins/config/default/kustomization.yaml"
sed -i '25s/^#//' $KUSTOMIZATION_FILE_PATH
sed -i '51s/^#//' $KUSTOMIZATION_FILE_PATH
# Uncomment only ValidatingWebhookConfiguration
# from cert-manager replaces
sed -i '55,70s/^#//' $KUSTOMIZATION_FILE_PATH
sed -i '55,70s/^#//' $KUSTOMIZATION_FILE_PATH
sed -i '79,101s/^#//' $KUSTOMIZATION_FILE_PATH
sed -i '110,151s/^#//' $KUSTOMIZATION_FILE_PATH
# Comment the injection for MutatingWebhookConfiguration
# Fixme: We should not scaffold or it should be commented
# by default when only validation webhooks are scaffolded
WEBHOOK_INJECTION_FILE_PATH="testdata/project-v4-with-plugins/config/default/webhookcainjection_patch.yaml"
sed -i '3,11s/^/#/' $WEBHOOK_INJECTION_FILE_PATH
cd testdata/project-v4-with-plugins/
go mod tidy
- name: Testing make test-e2e for project-v4-with-plugins
working-directory: testdata/project-v4-with-plugins
working-directory: testdata/project-v4-with-plugins/
run: |
make test-e2e

0 comments on commit f49e667

Please sign in to comment.