From cb323e48c964e218fd65894ab4ceb5d0fab1dafa Mon Sep 17 00:00:00 2001 From: Jorge Esteban Quilcate Otoya Date: Wed, 23 Aug 2023 00:42:06 +0300 Subject: [PATCH] chore(build): add e2e to ci workflow --- .github/workflows/codeql-analysis.yml | 9 +++- .../main_push_and_pull_request_workflow.yml | 53 ++++++++++++++++++- Makefile | 5 +- 3 files changed, 63 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index bf8cb437b..0c06bad3e 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -74,8 +74,15 @@ jobs: java-version: 11 distribution: temurin + - name: Read version from properties file + id: read-version + run: | + version=$(grep -oP 'version=\K[^[:space:]]+' gradle.properties) + echo "Version found: $version" + echo "VERSION=$version" >> $GITHUB_ENV + - name: Build with Gradle - run: ./gradlew build + run: make build/distributions/tiered-storage-for-apache-kafka-${{ env.VERSION }}.tgz - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/main_push_and_pull_request_workflow.yml b/.github/workflows/main_push_and_pull_request_workflow.yml index 13731a70b..17e1ded0e 100644 --- a/.github/workflows/main_push_and_pull_request_workflow.yml +++ b/.github/workflows/main_push_and_pull_request_workflow.yml @@ -24,13 +24,62 @@ jobs: java-version: ${{ matrix.java-version }} distribution: temurin + - name: Read version from properties file + id: read-version + run: | + version=$(grep -oP 'version=\K[^[:space:]]+' gradle.properties) + echo "Version found: $version" + echo "VERSION=$version" >> $GITHUB_ENV + - name: Build with Gradle - run: ./gradlew build distTar -x integrationTest + run: make build/distributions/tiered-storage-for-apache-kafka-${{ env.VERSION }}.tgz - name: Run integration tests - run: ./gradlew integrationTest + run: make integration_test + + - name: Upload Build Artifacts + uses: actions/upload-artifact@v3 + with: + name: build-${{ matrix.java-version }} + path: build/distributions/*.tgz + if-no-files-found: error + e2e_test: + strategy: + matrix: + java-version: [ 11, 17 ] + runs-on: [ ubuntu-latest ] + name: E2E tests on ${{ matrix.runs-on }} with jdk ${{ matrix.java-version }} + runs-on: ${{ matrix.runs-on }} + needs: + - build + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Read version from properties file + id: read-version + run: | + version=$(grep -oP 'version=\K[^[:space:]]+' gradle.properties) + echo "Version found: $version" + echo "VERSION=$version" >> $GITHUB_ENV + + - name: Download Build Artifacts + uses: actions/download-artifact@v3 + with: + name: build-${{ matrix.java-version }} + path: build/distributions/tiered-storage-for-apache-kafka-${{ env.VERSION }}.tgz + + - name: Display structure of downloaded files + run: ls -R + working-directory: build/distributions - name: Build Docker image run: make docker_image + - name: Run E2E tests + timeout-minutes: 30 + run: make e2e_test + # TODO: publish docker image diff --git a/Makefile b/Makefile index c03cf080e..3ce0330f1 100644 --- a/Makefile +++ b/Makefile @@ -21,11 +21,14 @@ clean: ./gradlew clean build/distributions/tiered-storage-for-apache-kafka-$(VERSION).tgz: - ./gradlew build distTar -x integrationTest + ./gradlew build distTar -x integrationTest -x e2e:test integration_test: build/distributions/tiered-storage-for-apache-kafka-$(VERSION).tgz ./gradlew integrationTest +e2e_test: build/distributions/tiered-storage-for-apache-kafka-$(VERSION).tgz + ./gradlew e2e:test + .PHONY: docker_image docker_image: build/distributions/tiered-storage-for-apache-kafka-$(VERSION).tgz docker build . \