diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9c9f36e42a..1dd56a54f5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,9 +38,9 @@ jobs: restore-keys: | ${{ runner.os }}-maven- - name: "Clean cache" - run: bash ./scripts/travis/cleanup_cache.sh + run: bash ./scripts/ci/cleanup_cache.sh - name: "Prepare environment" - run: bash ./scripts/travis/prepare.sh + run: bash ./scripts/ci/prepare.sh veracode: name: "Source Clear Scan (SCA)" @@ -132,7 +132,7 @@ jobs: run: | echo "TRANSFORMERS_TAG=$(mvn help:evaluate -Dexpression=dependency.alfresco-transform-core.version -q -DforceStdout)" >> $GITHUB_ENV - name: "Set up the environment" - run: docker-compose -f ./scripts/gh-actions/docker-compose/docker-compose.yaml --profile with-transform-core-aio up -d + run: docker-compose -f ./scripts/ci/docker-compose/docker-compose.yaml --profile with-transform-core-aio up -d - name: "Run tests" run: mvn -B test -pl repository -am -Dtest=AppContext01TestSuite -DfailIfNoTests=false -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco @@ -166,7 +166,7 @@ jobs: java-version: ${{ env.JAVA_VERSION }} distribution: "temurin" - name: "Set up the environment" - run: docker-compose -f ./scripts/gh-actions/docker-compose/docker-compose.yaml up -d + run: docker-compose -f ./scripts/ci/docker-compose/docker-compose.yaml up -d - name: "Set HOST_IP" run: | mkdir -p "${HOME}/tmp" @@ -207,7 +207,7 @@ jobs: java-version: ${{ env.JAVA_VERSION }} distribution: "temurin" - name: "Set up the environment" - run: docker-compose -f ./scripts/gh-actions/docker-compose/docker-compose.yaml up -d + run: docker-compose -f ./scripts/ci/docker-compose/docker-compose.yaml up -d - name: "Run tests" run: mvn -B test -pl repository -am -Dtest=SearchTestSuite -DfailIfNoTests=false -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco -Dindex.subsystem.name=solr6 @@ -243,7 +243,7 @@ jobs: java-version: ${{ env.JAVA_VERSION }} distribution: "temurin" - name: "Set up the environment" - run: docker-compose -f ./scripts/gh-actions/docker-compose/docker-compose-db.yaml --profile mariadb up -d + run: docker-compose -f ./scripts/ci/docker-compose/docker-compose-db.yaml --profile mariadb up -d env: MARIADB_VERSION: 10.2.18 - name: "Run tests" @@ -283,10 +283,10 @@ jobs: - name: "Build" timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }} run: | - bash ./scripts/travis/init.sh - bash ./scripts/travis/build.sh + bash ./scripts/ci/init.sh + bash ./scripts/ci/build.sh - name: "Set up the environment" - run: docker-compose -f ./scripts/gh-actions/docker-compose/docker-compose.yaml up -d + run: docker-compose -f ./scripts/ci/docker-compose/docker-compose.yaml up -d - name: "Run tests" run: mvn -B test -pl remote-api -Dtest=AppContext01TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco @@ -325,10 +325,10 @@ jobs: timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }} run: | echo "TRANSFORMERS_TAG=$(mvn help:evaluate -Dexpression=dependency.alfresco-transform-core.version -q -DforceStdout)" >> $GITHUB_ENV - bash ./scripts/travis/init.sh - bash ./scripts/travis/build.sh + bash ./scripts/ci/init.sh + bash ./scripts/ci/build.sh - name: "Set up the environment" - run: docker-compose -f ./scripts/gh-actions/docker-compose/docker-compose.yaml --profile with-transform-core-aio up -d + run: docker-compose -f ./scripts/ci/docker-compose/docker-compose.yaml --profile with-transform-core-aio up -d - name: "Run tests" run: mvn -B test -pl remote-api -Dtest=AppContext02TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco @@ -368,8 +368,8 @@ jobs: - name: "Build" timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }} run: | - bash ./scripts/travis/init.sh - bash ./scripts/travis/build.sh + bash ./scripts/ci/init.sh + bash ./scripts/ci/build.sh - name: "Set up the environment" run: | ${{ env.TAS_SCRIPTS }}/start-compose.sh ${{ env.TAS_ENVIRONMENT }}/docker-compose-minimal+transforms.yml @@ -414,8 +414,8 @@ jobs: - name: "Build" timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }} run: | - bash ./scripts/travis/init.sh - bash ./scripts/travis/build.sh + bash ./scripts/ci/init.sh + bash ./scripts/ci/build.sh - name: "Verify" timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }} run: mvn --file amps/ags/pom.xml -B verify -Dmaven.javadoc.skip=true -Dmaven.source.skip=true -Pags -Pstart-postgres -PagsAllTestSuitePt1 ${{ env.LOG_WARN }} @@ -425,10 +425,14 @@ jobs: runs-on: ubuntu-latest needs: - prepare +# if: > +# ((github.ref_name == 'master' || contains(github.ref_name, '[release]') || github.event_name == 'pull_request' ) && +# ! contains(github.event.head_commit.message, '[skip ags]')) || +# contains(github.event.head_commit.message, '[ags]') && +# ! contains(github.event.head_commit.message, '[skip tests]') && +# ! contains(github.event.head_commit.message, '[force]') if: > - ((github.ref_name == 'master' || contains(github.ref_name, '[release]') || github.event_name == 'pull_request' ) && - ! contains(github.event.head_commit.message, '[skip ags]')) || - contains(github.event.head_commit.message, '[ags]') && + ! contains(github.event.head_commit.message, '[skip repo]') && ! contains(github.event.head_commit.message, '[skip tests]') && ! contains(github.event.head_commit.message, '[force]') steps: @@ -458,7 +462,7 @@ jobs: distribution: "temurin" - name: "build" timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }} - run: bash ./scripts/travis/build.sh + run: bash ./scripts/ci/build.sh env: REQUIRES_LOCAL_IMAGES: true - name: "Set up the environment" @@ -468,7 +472,7 @@ jobs: - name: "test" timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }} run: mvn -B test -pl :alfresco-governance-services-automation-community-rest-api -am -DfailIfNoTests=false -Dskip.automationtests=false -Pags - - run: bash amps/ags/travis/scripts/getLogs.sh + - run: bash amps/ags/ci/scripts/getLogs.sh if: ${{ always() }} - shell: bash if: ${{ always() }} diff --git a/scripts/travis/build.sh b/scripts/ci/build.sh similarity index 100% rename from scripts/travis/build.sh rename to scripts/ci/build.sh diff --git a/scripts/gh-actions/build_functions.sh b/scripts/ci/build_functions.sh similarity index 100% rename from scripts/gh-actions/build_functions.sh rename to scripts/ci/build_functions.sh diff --git a/scripts/travis/cleanup_cache.sh b/scripts/ci/cleanup_cache.sh similarity index 100% rename from scripts/travis/cleanup_cache.sh rename to scripts/ci/cleanup_cache.sh diff --git a/scripts/gh-actions/docker-compose/docker-compose-db.yaml b/scripts/ci/docker-compose/docker-compose-db.yaml similarity index 100% rename from scripts/gh-actions/docker-compose/docker-compose-db.yaml rename to scripts/ci/docker-compose/docker-compose-db.yaml diff --git a/scripts/gh-actions/docker-compose/docker-compose.yaml b/scripts/ci/docker-compose/docker-compose.yaml similarity index 100% rename from scripts/gh-actions/docker-compose/docker-compose.yaml rename to scripts/ci/docker-compose/docker-compose.yaml diff --git a/scripts/travis/init.sh b/scripts/ci/init.sh similarity index 100% rename from scripts/travis/init.sh rename to scripts/ci/init.sh diff --git a/scripts/gh-actions/maven_release.sh b/scripts/ci/maven_release.sh similarity index 100% rename from scripts/gh-actions/maven_release.sh rename to scripts/ci/maven_release.sh diff --git a/scripts/travis/prepare.sh b/scripts/ci/prepare.sh similarity index 100% rename from scripts/travis/prepare.sh rename to scripts/ci/prepare.sh diff --git a/scripts/travis/source_clear.sh b/scripts/ci/source_clear.sh similarity index 100% rename from scripts/travis/source_clear.sh rename to scripts/ci/source_clear.sh diff --git a/scripts/gh-actions/update_downstream.sh b/scripts/ci/update_downstream.sh similarity index 100% rename from scripts/gh-actions/update_downstream.sh rename to scripts/ci/update_downstream.sh diff --git a/scripts/travis/verify_release_tag.sh b/scripts/ci/verify_release_tag.sh similarity index 100% rename from scripts/travis/verify_release_tag.sh rename to scripts/ci/verify_release_tag.sh diff --git a/scripts/travis/build_functions.sh b/scripts/travis/build_functions.sh deleted file mode 100644 index be8247265f..0000000000 --- a/scripts/travis/build_functions.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/usr/bin/env bash -set +vx - -function isPullRequestBuild() { - test "${TRAVIS_PULL_REQUEST}" != "false" -} - -function isBranchBuild() { - test "${TRAVIS_PULL_REQUEST}" = "false" -} - -function cloneRepo() { - local REPO="${1}" - local TAG_OR_BRANCH="${2}" - - printf "Clonning \"%s\" on %s\n" "${TAG_OR_BRANCH}" "${REPO}" - - # clone the repository branch/tag - pushd "$(dirname "${BASH_SOURCE[0]}")/../../../" >/dev/null - - rm -rf "$(basename "${REPO%.git}")" - - git clone -b "${TAG_OR_BRANCH}" --depth=1 "https://${GIT_USERNAME}:${GIT_PASSWORD}@${REPO}" - - popd >/dev/null -} - -function retrievePomParentVersion() { - local REPO="${1}" - - if [ -z "${REPO}" ]; then - pushd "$(dirname "${BASH_SOURCE[0]}")/../../" >/dev/null - else - pushd "$(dirname "${BASH_SOURCE[0]}")/../../../$(basename "${REPO%.git}")" >/dev/null - fi - - sed -n '//,/<\/parent>/p' pom.xml \ - | sed -n '//,/<\/version>/p' \ - | tr -d '\n' \ - | grep -oP '(?<=).*(?=)' \ - | xargs - - popd >/dev/null -} - -function retrievePomProperty() { - local KEY="${1}" - local REPO="${2}" - - if [ -z "${REPO}" ]; then - pushd "$(dirname "${BASH_SOURCE[0]}")/../../" >/dev/null - else - pushd "$(dirname "${BASH_SOURCE[0]}")/../../../$(basename "${REPO%.git}")" >/dev/null - fi - - sed -n '//,/<\/properties>/p' pom.xml \ - | sed -n "/<${KEY}>/,/<\/${KEY}>/p" \ - | tr -d '\n' \ - | grep -oP "(?<=<${KEY}>).*(?=)" \ - | xargs - - popd >/dev/null -} - -function evaluatePomProperty() { - local KEY="${1}" - - pushd "$(dirname "${BASH_SOURCE[0]}")/../../" >/dev/null - - mvn -B -q help:evaluate -Dexpression="${KEY}" -DforceStdout - - popd >/dev/null -} - -function remoteBranchExists() { - local REMOTE_REPO="${1}" - local BRANCH="${2}" - - git ls-remote --exit-code --heads "https://${GIT_USERNAME}:${GIT_PASSWORD}@${REMOTE_REPO}" "${BRANCH}" &>/dev/null -} - -function identifyUpstreamSourceBranch() { - local UPSTREAM_REPO="${1}" - - # if it's a pull request, use the source branch name (if it exists) - if isPullRequestBuild && remoteBranchExists "${UPSTREAM_REPO}" "${TRAVIS_PULL_REQUEST_BRANCH}" ; then - echo "${TRAVIS_PULL_REQUEST_BRANCH}" - exit 0 - fi - - # otherwise use the current branch name (or in case of PRs, the target branch name) - if remoteBranchExists "${UPSTREAM_REPO}" "${TRAVIS_BRANCH}" ; then - echo "${TRAVIS_BRANCH}" - exit 0 - fi - - # if none of the previous exists, use the "master" branch - echo "master" -} - -function pullUpstreamTag() { - local UPSTREAM_REPO="${1}" - local TAG="${2}" - - cloneRepo "${UPSTREAM_REPO}" "${TAG}" -} - -function pullSameBranch() { - local UPSTREAM_REPO="${1}" - - local SOURCE_BRANCH="$(identifyUpstreamSourceBranch "${UPSTREAM_REPO}")" - - cloneRepo "${UPSTREAM_REPO}" "${SOURCE_BRANCH}" -} - -function buildUpstreamTag() { - local UPSTREAM_REPO="${1}" - local TAG="${2}" - local EXTRA_BUILD_ARGUMENTS="${3}" - - pushd "$(dirname "${BASH_SOURCE[0]}")/../../../" - - cd "$(basename "${UPSTREAM_REPO%.git}")" - - mvn -B -V clean package -DskipTests -Dmaven.javadoc.skip=true "-Dimage.tag=${TAG}" ${EXTRA_BUILD_ARGUMENTS} - - popd -} - -function buildSameBranchOnUpstream() { - local UPSTREAM_REPO="${1}" - local EXTRA_BUILD_ARGUMENTS="${2}" - - pushd "$(dirname "${BASH_SOURCE[0]}")/../../../" - - cd "$(basename "${UPSTREAM_REPO%.git}")" - - mvn -B -V -q clean install -DskipTests -Dmaven.javadoc.skip=true ${EXTRA_BUILD_ARGUMENTS} - mvn -B -V -q install -DskipTests -f packaging/tests/pom.xml - - popd -} - -function pullUpstreamTagAndBuildDockerImage() { - local UPSTREAM_REPO="${1}" - local TAG="${2}" - local EXTRA_BUILD_ARGUMENTS="${3}" - - cloneRepo "${UPSTREAM_REPO}" "${TAG}" - - pushd "$(dirname "${BASH_SOURCE[0]}")/../../../" - - cd "$(basename "${UPSTREAM_REPO%.git}")" - - mvn -B -V clean package -DskipTests -Dmaven.javadoc.skip=true "-Dimage.tag=${TAG}" ${EXTRA_BUILD_ARGUMENTS} - - popd -} - -function pullAndBuildSameBranchOnUpstream() { - local UPSTREAM_REPO="${1}" - local EXTRA_BUILD_ARGUMENTS="${2}" - - local SOURCE_BRANCH="$(identifyUpstreamSourceBranch "${UPSTREAM_REPO}")" - - cloneRepo "${UPSTREAM_REPO}" "${SOURCE_BRANCH}" - - pushd "$(dirname "${BASH_SOURCE[0]}")/../../../" - - cd "$(basename "${UPSTREAM_REPO%.git}")" - - mvn -B -V -q clean install -DskipTests -Dmaven.javadoc.skip=true ${EXTRA_BUILD_ARGUMENTS} - mvn -B -V -q install -DskipTests -f packaging/tests/pom.xml - - popd -} - -function retieveLatestTag() { - local REPO="${1}" - local BRANCH="${2}" - - local LOCAL_PATH="/tmp/$(basename "${REPO%.git}")" - - git clone -q -b "${BRANCH}" "https://${GIT_USERNAME}:${GIT_PASSWORD}@${REPO}" "${LOCAL_PATH}" - - pushd "${LOCAL_PATH}" >/dev/null - git describe --abbrev=0 --tags - popd >/dev/null - - rm -rf "${LOCAL_PATH}" -} - -set -vx diff --git a/scripts/travis/maven_release.sh b/scripts/travis/maven_release.sh deleted file mode 100755 index d4db16324f..0000000000 --- a/scripts/travis/maven_release.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env bash -echo "=========================== Starting Release Script ===========================" -PS4="\[\e[35m\]+ \[\e[m\]" -set -vex -pushd "$(dirname "${BASH_SOURCE[0]}")/../../" - - -# Use full history for release -git checkout -B "${TRAVIS_BRANCH}" -# Add email to link commits to user -git config user.email "${GIT_EMAIL}" - -# Run the release plugin - with "[skip ci]" in the release commit message -mvn -B \ - -Pall-tas-tests \ - -Pags \ - "-Darguments=-Pall-tas-tests -Pags -DskipTests -Dbuild-number=${TRAVIS_BUILD_NUMBER}" \ - release:clean release:prepare release:perform \ - -DscmCommentPrefix="[maven-release-plugin][skip ci] " \ - -Dusername="${GIT_USERNAME}" \ - -Dpassword="${GIT_PASSWORD}" - - -popd -set +vex -echo "=========================== Finishing Release Script ==========================" - diff --git a/scripts/travis/update_downstream.sh b/scripts/travis/update_downstream.sh deleted file mode 100644 index b4316a0307..0000000000 --- a/scripts/travis/update_downstream.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env bash -echo "=========================== Starting Update Downstream Script ===========================" -PS4="\[\e[35m\]+ \[\e[m\]" -set -vex -pushd "$(dirname "${BASH_SOURCE[0]}")/../../" - -source "$(dirname "${BASH_SOURCE[0]}")/build_functions.sh" - -#Fetch the latest changes, as Travis will only checkout the PR commit -git fetch origin "${TRAVIS_BRANCH}" -git checkout "${TRAVIS_BRANCH}" -git pull - -# Retrieve the current Community version - latest tag on the current branch -VERSION="$(git describe --abbrev=0 --tags)" - -DOWNSTREAM_REPO="github.com/Alfresco/alfresco-enterprise-repo.git" - -cloneRepo "${DOWNSTREAM_REPO}" "${TRAVIS_BRANCH}" - -cd "$(dirname "${BASH_SOURCE[0]}")/../../../$(basename "${DOWNSTREAM_REPO%.git}")" - -# Update parent version -mvn -B versions:update-parent versions:commit "-DparentVersion=[${VERSION}]" - -# Update dependency version -mvn -B versions:set-property versions:commit \ - -Dproperty=dependency.alfresco-community-repo.version \ - "-DnewVersion=${VERSION}" - -# Commit changes -git status -git --no-pager diff pom.xml -git add pom.xml - -if [[ "${TRAVIS_COMMIT_MESSAGE}" =~ \[force[^\]]*\] ]]; then - FORCE_TOKEN=$(echo "${TRAVIS_COMMIT_MESSAGE}" | sed "s|^.*\(\[force[^]]*\]\).*$|\1|g") - git commit --allow-empty -m "${FORCE_TOKEN} Update upstream version to ${VERSION}" - git push -elif git status --untracked-files=no --porcelain | grep -q '^' ; then - git commit -m "Update upstream version to ${VERSION}" - git push -else - echo "Dependencies are already up to date." - git status -fi - - -popd -set +vex -echo "=========================== Finishing Update Downstream Script ==========================" -