diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 2d2e5af7d..1065690d6 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -33,7 +33,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: hadolint/hadolint-action@v3.1.0 with: dockerfile: ${{ env.WORKING_DIR }}/Dockerfile @@ -44,31 +43,30 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Cache Maven Dependencies - uses : actions/cache@v3 + - name: Download JAR artifact + uses: actions/download-artifact@v3 with: - path: ~/.m2 - key: ${{ runner.os }}-maven${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- + name: test-jar - uses: whelk-io/maven-settings-xml-action@v22 - name: generate settings xml + name: Generate settings.xml with: servers: ${{ inputs.push && env.BATCH_SETTINGS || env.RUNNER_SETTINGS }} proxies: '[{ "id":"dvsa-ci-proxy", "active": "true", "protocol": "http", "host": "${{vars.CI_PROXY}}", "port": "${{vars.CI_PROXYPORT}}" }]' repositories: '[ { "id":"dvsa-github-packages", "name":"dvsa-github-packages", "url":"https://maven.pkg.github.com/dvsa/*", "releases": { "enabled": "true" }, "snapshots": { "enabled": "true" } }]' output_file: ./settings.xml - - - name: view settings.xml + + - name: View settings.xml run: cat ./settings.xml + - name: Copy settings.xml + run: cp ./settings.xml $GITHUB_WORKSPACE/$WORKING_DIR + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Extract Docker metadata id: meta - uses: docker/metadata-action@v5 with: images: | @@ -104,12 +102,13 @@ jobs: if: ${{ inputs.push }} run: | aws ecr batch-delete-image --repository-name vol-qa/vft --image-ids imageTag=latest - + + - name: Build ${{ inputs.push && 'and push ' || '' }}Docker image id: build-and-push uses: docker/build-push-action@v5 with: - context: . + context: . file: infra/docker/batch/Dockerfile platforms: linux/amd64,linux/arm64 push: ${{ inputs.push }} @@ -117,7 +116,6 @@ jobs: labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max - - name: Setup Notation CLI if: ${{ inputs.push }} diff --git a/.github/workflows/maven.yaml b/.github/workflows/maven.yaml index 0bc7dc33d..af353b741 100644 --- a/.github/workflows/maven.yaml +++ b/.github/workflows/maven.yaml @@ -1,4 +1,4 @@ -name: Maven +name: Maven Build on: workflow_call: @@ -8,20 +8,50 @@ on: required: true default: 'package' type: string - + permissions: contents: read packages: write jobs: - build: - name: build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: whelk-io/maven-settings-xml-action@v22 - with: + build: + name: Maven Build + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '11' + + - name: Cache Maven dependencies + uses: actions/cache@v3 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + + - name: Generate Maven settings.xml + uses: whelk-io/maven-settings-xml-action@v22 + with: 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 }}"} } } } ]' - - - run: mvn -B -P github ${{ inputs.maven-goal}} - \ No newline at end of file + + - name: Build with Maven + run: mvn -B -P github ${{ inputs.maven-goal }} + + - name: Cache built JAR + uses: actions/cache@v3 + with: + path: target/*.jar + key: ${{ runner.os }}-artifact-${{ hashFiles('**/pom.xml') }} + + - name: Upload JAR Artifact + uses: actions/upload-artifact@v3 + with: + name: test-jar + path: target/*.jar \ No newline at end of file diff --git a/run.sh b/run.sh index 5fe37a7c1..227f4c3c4 100644 --- a/run.sh +++ b/run.sh @@ -21,7 +21,6 @@ # - noProxyJava # - mavenOptions -REBUILD_DEPENDENCIES=${REBUILD_DEPENDENCIES:-false} # check if all the environment variables are set check_environment_variables() { @@ -54,17 +53,6 @@ check_environment_variables() { check_environment_variables || exit 1 -if [ "$REBUILD_DEPENDENCIES" = "true" ]; then - echo "Rebuilding Maven dependencies as requested." - mvn --batch-mode clean install -U -else - if [ -d ~/.m2/repository ]; then - echo "Using maven cached dependencies" - else - echo "No cache found, downloading dependencies" - mvn --batch-mode dependency:go-offline - fi -fi # 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} ] .."