From d7edaa5eaf77cad00660cc57c51b17b0e8956682 Mon Sep 17 00:00:00 2001 From: Tom Page Date: Tue, 24 Jan 2023 10:54:47 +0000 Subject: [PATCH] ACS-4464 Always build application when build or prepare are called. If build is called then we definitely should be building the application. When prepare is called then we want to prevent further builds running if the application doesn't compile. --- .github/workflows/ci.yml | 4 ++-- scripts/ci/build.sh | 34 +++++++++++++--------------------- scripts/ci/prepare.sh | 10 ++++------ 3 files changed, 19 insertions(+), 29 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7be18c4010..500c38d3ca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,7 +39,7 @@ jobs: - uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.30.0 - name: "Init" run: bash ./scripts/ci/init.sh - - name: "Prepare environment" + - name: "Prepare maven cache and check compilation" run: bash ./scripts/ci/prepare.sh - name: "Clean Maven cache" run: bash ./scripts/ci/cleanup_cache.sh @@ -528,4 +528,4 @@ jobs: aws s3 cp --acl private solr.log s3://ags-travis-artifacts/community/${{ github.run_number }}/AGS-Community-Rest-API-Tests/solr.log aws s3 cp --acl private ./amps/ags/rm-automation/rm-automation-community-rest-api/target/reports/rm-automation-community-rest-api.log s3://ags-travis-artifacts/community/${{ github.run_number }}/AGS-Community-Rest-API-Tests/rm-automation-community-rest-api.log - name: "Clean Maven cache" - run: bash ./scripts/ci/cleanup_cache.sh \ No newline at end of file + run: bash ./scripts/ci/cleanup_cache.sh diff --git a/scripts/ci/build.sh b/scripts/ci/build.sh index 349c1da7e6..6b25a69374 100644 --- a/scripts/ci/build.sh +++ b/scripts/ci/build.sh @@ -6,29 +6,21 @@ pushd "$(dirname "${BASH_SOURCE[0]}")/../../" source "$(dirname "${BASH_SOURCE[0]}")/build_functions.sh" - -# Build the current project if needed -if [[ -n ${REQUIRES_INSTALLED_ARTIFACTS} ]] || [[ -n ${REQUIRES_LOCAL_IMAGES} ]] || [[ -n ${BUILD_PROFILES} ]]; then - - if [[ -n ${BUILD_PROFILES} ]]; then - PROFILES="${BUILD_PROFILES}" - else - if [[ "${REQUIRES_LOCAL_IMAGES}" == "true" ]]; then - PROFILES="-Pbuild-docker-images -Pags" - else - PROFILES="-Pags" - fi - fi - - if [[ "${REQUIRES_INSTALLED_ARTIFACTS}" == "true" ]]; then - PHASE="install" - else - PHASE="package" - fi - - mvn -B -V $PHASE -DskipTests -Dmaven.javadoc.skip=true $PROFILES $BUILD_OPTIONS +if [[ -n ${BUILD_PROFILES} ]]; then + PROFILES="${BUILD_PROFILES}" +elif [[ "${REQUIRES_LOCAL_IMAGES}" == "true" ]]; then + PROFILES="-Pbuild-docker-images -Pags" +else + PROFILES="-Pags" fi +if [[ "${REQUIRES_INSTALLED_ARTIFACTS}" == "true" ]]; then + PHASE="install" +else + PHASE="package" +fi + +mvn -B -V $PHASE -DskipTests -Dmaven.javadoc.skip=true $PROFILES $BUILD_OPTIONS popd set +vex diff --git a/scripts/ci/prepare.sh b/scripts/ci/prepare.sh index 454151de31..709a570d00 100755 --- a/scripts/ci/prepare.sh +++ b/scripts/ci/prepare.sh @@ -23,9 +23,7 @@ if [ $M2_REPO_EXPIRED -eq 1 ];then rm -rf "$M2_REPO_DIR" fi -if [ $M2_REPO_FILE_COUNT -lt 1000 ] || [ $ORG_ALFRESCO_M2_REPO_EXPIRED -eq 1 ] || [ $M2_REPO_EXPIRED -eq 1 ];then - echo "Populating maven cache." - export BUILD_PROFILES="-Pall-tas-tests,ags" - export BUILD_OPTIONS="-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -Dmaven.artifact.threads=8" - source "$(dirname "${BASH_SOURCE[0]}")/build.sh" -fi +echo "Verifying compilation and ensuring maven cache populated." +export BUILD_PROFILES="-Pall-tas-tests,ags" +export BUILD_OPTIONS="-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -Dmaven.artifact.threads=8" +source "$(dirname "${BASH_SOURCE[0]}")/build.sh"