Skip to content

Commit

Permalink
Merge pull request #867 from dvsa/revertCI/CD
Browse files Browse the repository at this point in the history
feat: revert maven/docker workflow changes
  • Loading branch information
sr4850 authored Sep 26, 2024
2 parents 2ee6b5d + 9fefc6e commit b7af1a3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 52 deletions.
12 changes: 1 addition & 11 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:

permissions:
contents: read
packages: write

jobs:
release-please:
Expand All @@ -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}}
Expand All @@ -47,5 +38,4 @@ jobs:
contents: read
id-token: write
packages: write
needs:
- build-maven
needs: release-please
7 changes: 0 additions & 7 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -115,7 +109,6 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max



- name: Setup Notation CLI
Expand Down
24 changes: 7 additions & 17 deletions .github/workflows/maven.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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-
22 changes: 5 additions & 17 deletions run.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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

0 comments on commit b7af1a3

Please sign in to comment.