From c69135e0e5f826bb248cb7e533284515fb9ad9bc Mon Sep 17 00:00:00 2001 From: Andrei Kvapil Date: Thu, 29 May 2025 17:10:06 +0200 Subject: [PATCH] [ci] separate build and testing jobs Signed-off-by: Andrei Kvapil --- .github/workflows/pull-requests-release.yaml | 2 +- .github/workflows/pull-requests.yaml | 32 ++++++++++++++++++-- packages/core/testing/Makefile | 3 +- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pull-requests-release.yaml b/.github/workflows/pull-requests-release.yaml index 5614f893e..070877dbe 100644 --- a/.github/workflows/pull-requests-release.yaml +++ b/.github/workflows/pull-requests-release.yaml @@ -36,7 +36,7 @@ jobs: registry: ghcr.io - name: Run tests - run: make test + run: make manifests && make test finalize: name: Finalize Release diff --git a/.github/workflows/pull-requests.yaml b/.github/workflows/pull-requests.yaml index 2f3b35421..b6b0cfc00 100644 --- a/.github/workflows/pull-requests.yaml +++ b/.github/workflows/pull-requests.yaml @@ -9,8 +9,8 @@ concurrency: cancel-in-progress: true jobs: - e2e: - name: Build and Test + build: + name: Build runs-on: [self-hosted] permissions: contents: read @@ -37,5 +37,33 @@ jobs: - name: Build run: make build + - name: Upload installer artifact + uses: actions/upload-artifact@v4 + with: + name: cozystack-installer + path: _out/assets/cozystack-installer.yaml + + test: + name: Test + runs-on: [self-hosted] + needs: build + + # Never run when the PR carries the "release" label. + if: | + !contains(github.event.pull_request.labels.*.name, 'release') + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true + + - name: Download installer artifact + uses: actions/download-artifact@v4 + with: + name: cozystack-installer + path: _out/assets/ + - name: Test run: make test diff --git a/packages/core/testing/Makefile b/packages/core/testing/Makefile index f3a97eee5..71eaf5ee7 100755 --- a/packages/core/testing/Makefile +++ b/packages/core/testing/Makefile @@ -33,7 +33,8 @@ image-e2e-sandbox: test: test-cluster test-apps ## Run the end-to-end tests in existing sandbox test-cluster: ## Run the end-to-end for creating a cluster - docker exec "${SANDBOX_NAME}" sh -c 'cd /workspace && export COZYSTACK_INSTALLER_YAML=$$(helm template -n cozy-system installer ./packages/core/installer) && hack/cozytest.sh hack/e2e-cluster.bats' + docker cp ../../../_out/assets/cozystack-installer.yaml "${SANDBOX_NAME}":/workspace/_out/assets/cozystack-installer.yaml + docker exec "${SANDBOX_NAME}" sh -c 'cd /workspace && export COZYSTACK_INSTALLER_YAML=$$(cat /workspace/_out/assets/cozystack-installer.yaml) && hack/cozytest.sh hack/e2e-cluster.bats' test-apps: ## Run the end-to-end tests for apps docker exec "${SANDBOX_NAME}" sh -c 'cd /workspace && hack/cozytest.sh hack/e2e-apps.bats'