From 9f46347f678abfa8c22d75793693465366107cdb Mon Sep 17 00:00:00 2001 From: Catarina Paralta <46568597+paralta@users.noreply.github.com> Date: Fri, 8 Sep 2023 08:55:11 +0100 Subject: [PATCH] ci(test): add e2e tests to ci pipeline (#602) * ci(test): add e2e tests to ci pipeline * ci(test): use artifacts --- .../workflows/build-and-push-component.yaml | 9 +++- .github/workflows/ci.yml | 42 ++++++++++++++++++- 2 files changed, 48 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-and-push-component.yaml b/.github/workflows/build-and-push-component.yaml index b6dfe2add..d3ae1521b 100644 --- a/.github/workflows/build-and-push-component.yaml +++ b/.github/workflows/build-and-push-component.yaml @@ -29,6 +29,11 @@ on: jobs: build-and-push: runs-on: ubuntu-latest + strategy: + matrix: + platform: + - linux/amd64 + - linux/arm64 steps: - name: Checkout code uses: actions/checkout@v4 @@ -60,7 +65,7 @@ jobs: uses: docker/build-push-action@v4 with: context: . - platforms: linux/amd64,linux/arm64 + platforms: ${{ matrix.platform }} tags: ghcr.io/openclarity/${{ inputs.image_name }}:${{ inputs.image_tag }} file: ${{ inputs.dockerfile }} push: ${{ inputs.push }} @@ -73,7 +78,7 @@ jobs: COMMIT_HASH=${{ github.sha }} - name: Upload artifact - if: ${{ inputs.upload == 'true' }} + if: ${{ inputs.upload == 'true' && matrix.platform == 'linux/amd64'}} uses: actions/upload-artifact@v3 with: name: ${{ inputs.image_name }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 72e615870..854e9a15a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,12 +75,52 @@ jobs: with: image_tag: ${{ github.sha }} push: false - upload: false + upload: true + + test: + needs: build + name: Test + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: ${{ env.GO_VERSION }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Download all artifacts + uses: actions/download-artifact@v3 + + - name: Load Docker images + run: | + ls + docker load --input vmclarity-apiserver/vmclarity-apiserver.tar + docker load --input vmclarity-orchestrator/vmclarity-orchestrator.tar + docker load --input vmclarity-ui-backend/vmclarity-ui-backend.tar + docker load --input vmclarity-ui/vmclarity-ui.tar + docker load --input vmclarity-cli/vmclarity-cli.tar + docker image ls -a + + - name: Run end to end tests + env: + DOCKER_TAG: ${{ github.sha }} + APIServerContainerImage: ghcr.io/openclarity/vmclarity-apiserver:${{ github.sha }} + OrchestratorContainerImage: ghcr.io/openclarity/vmclarity-orchestrator:${{ github.sha }} + UIContainerImage: ghcr.io/openclarity/vmclarity-ui:${{ github.sha }} + UIBackendContainerImage: ghcr.io/openclarity/vmclarity-ui-backend:${{ github.sha }} + ScannerContainerImage: ghcr.io/openclarity/vmclarity-cli:${{ github.sha }} + run: cd e2e && go test -v -failfast -test.v -test.paniconexit0 -timeout 2h -ginkgo.v . success: needs: - build - helm-docs-verification + name: Success runs-on: ubuntu-latest steps: - name: Echo Success