From 9fefc6e2ee0133224400ed906b76946fdecac829 Mon Sep 17 00:00:00 2001 From: Stefan Ranoszek Date: Thu, 26 Sep 2024 11:11:07 +0100 Subject: [PATCH] feat: revert maven/docker workflow changes --- .github/workflows/cd.yaml | 12 +----------- .github/workflows/docker.yaml | 7 ------- .github/workflows/maven.yaml | 24 +++++++----------------- run.sh | 22 +++++----------------- 4 files changed, 13 insertions(+), 52 deletions(-) diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index c3dca4067..536b10447 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -7,7 +7,6 @@ on: permissions: contents: read - packages: write jobs: release-please: @@ -26,14 +25,6 @@ jobs: release-type: maven target-branch: ${{ github.ref_name }} - build-maven: - name: Build with Maven - uses: ./.github/workflows/maven.yaml - with: - maven-goal: package -DskipTests - needs: - - release-please - docker: name: Docker if: ${{needs.release-please.outputs.release_created}} @@ -47,5 +38,4 @@ jobs: contents: read id-token: write packages: write - needs: - - build-maven \ No newline at end of file + needs: release-please diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index a0666d3c8..9237d130b 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -44,12 +44,6 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Download JAR artifact - uses: actions/download-artifact@v3 - with: - name: test-artifact - path: build_artifact/test-artifact.jar - - uses: whelk-io/maven-settings-xml-action@v22 name: generate settings xml with: @@ -115,7 +109,6 @@ jobs: labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max - - name: Setup Notation CLI diff --git a/.github/workflows/maven.yaml b/.github/workflows/maven.yaml index 9a4d8d685..c79dc932a 100644 --- a/.github/workflows/maven.yaml +++ b/.github/workflows/maven.yaml @@ -31,22 +31,12 @@ jobs: servers: '[{ "id":"dvsa-github-packages", "configuration": { "httpHeaders": { "property": { "name":"Authorization", "value":"Bearer ${{ secrets.GITHUB_TOKEN }}"} } } },{ "id":"github-publish", "configuration": { "httpHeaders": { "property": { "name":"Authorization", "value":"Bearer ${{ secrets.GITHUB_TOKEN }}"} } } } ]' - name: Build with Maven - run: mvn -B -P github ${{ inputs.maven-goal}} -U -Dmaven.repo.local=$HOME/.m2/repository + run: mvn -B -P github ${{ inputs.maven-goal}} -Dmaven.repo.local=$HOME/.m2/repository - - name: Create directory - run: mkdir -p build_artifact - - - name: Save test artifact - run: | - cp target/*.jar build_artifact/test-artifact.jar - shell: bash - - - - name: Upload Artifact - uses: actions/upload-artifact@v3 + - name: Cache Maven packages + uses: actions/cache@v3 with: - name: test-artifact - path: build_artifact/test-artifact.jar - if-no-files-found: warn - include-hidden-files: false - + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- \ No newline at end of file diff --git a/run.sh b/run.sh index 80d90351d..5161f577b 100644 --- a/run.sh +++ b/run.sh @@ -1,5 +1,3 @@ -#!/bin/bash - # Description: This script is used to run the tests in the docker container # In environments some values are passed as environment variables to the container from the job definition @@ -56,14 +54,14 @@ check_environment_variables() { check_environment_variables || exit 1 -if [ ! -f "/app/test-artifact.jar" ]; then - # Echo the command to be captured in logs - echo "Now running [ mvn --batch-mode clean verify $mavenOptions -U -Dwdm.proxy=${proxyHost}:${proxyPort} -Dhttps.proxyHost=${proxyHost} -Dhttps.proxyPort=${proxyPort} -Dhttp.proxyHost=${proxyHost} -Dhttp.proxyPort=${proxyPort} -Dhttp.nonProxyHosts=${noProxyJava} -Denv=${platformEnv} -Dbrowser=${browserName} -DbrowserVersion=${browserVersion} -Dplatform=${platform} -DgridURL=_hidden_ -Dtag.name=\"(not ${exclude_tags})\" -Dcucumber.filter.tags=${cucumberTags} ] .." +# Echo the command to be captured in logs +echo "Now running [ mvn --batch-mode clean verify $mavenOptions -U -Dwdm.proxy=${proxyHost}:${proxyPort} -Dhttps.proxyHost=${proxyHost} -Dhttps.proxyPort=${proxyPort} -Dhttp.proxyHost=${proxyHost} -Dhttp.proxyPort=${proxyPort} -Dhttp.nonProxyHosts=${noProxyJava} -Denv=${platformEnv} -Dbrowser=${browserName} -DbrowserVersion=${browserVersion} -Dplatform=${platform} -DgridURL=_hidden_ -Dtag.name=\"(not ${exclude_tags})\" -Dcucumber.filter.tags=${cucumberTags} ] .." +if [ $? -eq 0 ]; then if [ -z "${mavenOptions}" ]; then - mvn --batch-mode clean verify $mavenOptions -fae -Dwdm.proxy=${proxyHost}:${proxyPort} -Dhttps.proxyHost=${proxyHost} -Dhttps.proxyPort=${proxyPort} -Dhttp.proxyHost=${proxyHost} -Dhttp.proxyPort=${proxyPort} -Dhttp.nonProxyHosts=${noProxyJava} -Denv=${platformEnv} -Dbrowser=${browserName} -DbrowserVersion=${browserVersion} -Dplatform=${platform} -DgridURL=${gridURL} -Dtag.name="(not ${exclude_tags})" -Dcucumber.filter.tags=${cucumberTags} + mvn --batch-mode clean verify $mavenOptions -fae -U -Dwdm.proxy=${proxyHost}:${proxyPort} -Dhttps.proxyHost=${proxyHost} -Dhttps.proxyPort=${proxyPort} -Dhttp.proxyHost=${proxyHost} -Dhttp.proxyPort=${proxyPort} -Dhttp.nonProxyHosts=${noProxyJava} -Denv=${platformEnv} -Dbrowser=${browserName} -DbrowserVersion=${browserVersion} -Dplatform=${platform} -DgridURL=${gridURL} -Dtag.name="(not ${exclude_tags})" -Dcucumber.filter.tags=${cucumberTags} else - mvn --batch-mode clean verify -fae -Dwdm.proxy=${proxyHost}:${proxyPort} -Dhttps.proxyHost=${proxyHost} -Dhttps.proxyPort=${proxyPort} -Dhttp.proxyHost=${proxyHost} -Dhttp.proxyPort=${proxyPort} -Dhttp.nonProxyHosts=${noProxyJava} -Denv=${platformEnv} -Dbrowser=${browserName} -DbrowserVersion=${browserVersion} -Dplatform=${platform} -DgridURL=${gridURL} -Dtag.name="(not ${exclude_tags})" -Dcucumber.filter.tags=${cucumberTags} -Dcucumber.options="-- io.qameta.allure.cucumber7jvm.AllureCucumber7Jvm" + mvn --batch-mode clean verify -fae -U -Dwdm.proxy=${proxyHost}:${proxyPort} -Dhttps.proxyHost=${proxyHost} -Dhttps.proxyPort=${proxyPort} -Dhttp.proxyHost=${proxyHost} -Dhttp.proxyPort=${proxyPort} -Dhttp.nonProxyHosts=${noProxyJava} -Denv=${platformEnv} -Dbrowser=${browserName} -DbrowserVersion=${browserVersion} -Dplatform=${platform} -DgridURL=${gridURL} -Dtag.name="(not ${exclude_tags})" -Dcucumber.filter.tags=${cucumberTags} -Dcucumber.options="-- io.qameta.allure.cucumber7jvm.AllureCucumber7Jvm" fi mvn allure:report @@ -74,14 +72,4 @@ if [ ! -f "/app/test-artifact.jar" ]; then aws s3 cp ../allure.zip s3://${resultsTargetBucket}/${resultsTargetBucketPath}/${buildId}/ else echo "Maven command failed!" -fi - -# Run the JAR file -echo "Now running [ java -jar /app/test-artifact.jar ] .." -java -jar /app/test-artifact.jar -if [ $? -ne 0 ]; then - echo "Error: vol functional tests exited with status $?" - exit 1 -else - echo "vol functional tests executed successfully." fi \ No newline at end of file