mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
ACS-3841 Migrate to GHA (#1631)
* ACS-3841 Use configure-git-author, rename steps, remove always from maven cache clean step * ACS-3841 Fix PostgreSQL 13.7 tests step name * ACS-3841 Fix update_downstream job * ACS-3841 Set global option for configure-git-author action * ACS-3841 Update license header * ACS-3841 Update configure-git-author version + improve uploading artifacts * ACS-3841 Improve uploading artifacts * ACS-3841 Fix uploading artifacts * ACS-3841 Rename jobs names + revert removed functions * ACS-3841 Fix step condition * ACS-3841 Update to latest alfresco-build-tools Co-authored-by: mikolajbrzezinski <mikolaj.brzezinski@hyland.com>
This commit is contained in:
@@ -2,18 +2,18 @@
|
||||
set +vx
|
||||
|
||||
function isPullRequestBuild() {
|
||||
test "${TRAVIS_PULL_REQUEST}" != "false"
|
||||
test "${PULL_REQUEST}" != "false"
|
||||
}
|
||||
|
||||
function isBranchBuild() {
|
||||
test "${TRAVIS_PULL_REQUEST}" = "false"
|
||||
test "${PULL_REQUEST}" = "false"
|
||||
}
|
||||
|
||||
function cloneRepo() {
|
||||
local REPO="${1}"
|
||||
local TAG_OR_BRANCH="${2}"
|
||||
|
||||
printf "Clonning \"%s\" on %s\n" "${TAG_OR_BRANCH}" "${REPO}"
|
||||
printf "Cloning \"%s\" on %s\n" "${TAG_OR_BRANCH}" "${REPO}"
|
||||
|
||||
# clone the repository branch/tag
|
||||
pushd "$(dirname "${BASH_SOURCE[0]}")/../../../" >/dev/null
|
||||
@@ -82,15 +82,9 @@ function remoteBranchExists() {
|
||||
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}"
|
||||
if remoteBranchExists "${UPSTREAM_REPO}" "${BRANCH_NAME}" ; then
|
||||
echo "${BRANCH_NAME}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@@ -190,4 +184,4 @@ function retieveLatestTag() {
|
||||
rm -rf "${LOCAL_PATH}"
|
||||
}
|
||||
|
||||
set -vx
|
||||
set -vx
|
40
scripts/ci/docker-compose/docker-compose-db.yaml
Normal file
40
scripts/ci/docker-compose/docker-compose-db.yaml
Normal file
@@ -0,0 +1,40 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
postgres:
|
||||
profiles: ["postgres"]
|
||||
image: postgres:${POSTGRES_VERSION}
|
||||
environment:
|
||||
- POSTGRES_PASSWORD=alfresco
|
||||
- POSTGRES_USER=alfresco
|
||||
- POSTGRES_DB=alfresco
|
||||
command: postgres -c max_connections=300
|
||||
ports:
|
||||
- "5433:5432"
|
||||
mariadb:
|
||||
profiles: ["mariadb"]
|
||||
image: mariadb:${MARIADB_VERSION}
|
||||
command: --transaction-isolation=READ-COMMITTED --max-connections=300 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=alfresco
|
||||
- MYSQL_USER=alfresco
|
||||
- MYSQL_DATABASE=alfresco
|
||||
- MYSQL_PASSWORD=alfresco
|
||||
ports:
|
||||
- "3307:3306"
|
||||
mysql:
|
||||
profiles: ["mysql"]
|
||||
image: mysql:${MYSQL_VERSION}
|
||||
command: --transaction-isolation='READ-COMMITTED'
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=alfresco
|
||||
- MYSQL_USER=alfresco
|
||||
- MYSQL_DATABASE=alfresco
|
||||
- MYSQL_PASSWORD=alfresco
|
||||
ports:
|
||||
- "3307:3306"
|
||||
activemq:
|
||||
image: alfresco/alfresco-activemq:5.17.1-jre11-rockylinux8
|
||||
ports:
|
||||
- "5672:5672" # AMQP
|
||||
- "61616:61616" # OpenWire
|
26
scripts/ci/docker-compose/docker-compose.yaml
Normal file
26
scripts/ci/docker-compose/docker-compose.yaml
Normal file
@@ -0,0 +1,26 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
transform-core-aio:
|
||||
profiles: ["with-transform-core-aio"]
|
||||
image: alfresco/alfresco-transform-core-aio:${TRANSFORMERS_TAG}
|
||||
environment:
|
||||
JAVA_OPTS: " -Xms256m -Xmx256m"
|
||||
ports:
|
||||
- "8090:8090"
|
||||
postgres:
|
||||
image: postgres:14.4
|
||||
profiles: ["default", "with-transform-core-aio", "postgres"]
|
||||
environment:
|
||||
- POSTGRES_PASSWORD=alfresco
|
||||
- POSTGRES_USER=alfresco
|
||||
- POSTGRES_DB=alfresco
|
||||
command: postgres -c max_connections=300
|
||||
ports:
|
||||
- "5433:5432"
|
||||
activemq:
|
||||
profiles: ["default", "with-transform-core-aio", "activemq"]
|
||||
image: alfresco/alfresco-activemq:5.17.1-jre11-rockylinux8
|
||||
ports:
|
||||
- "5672:5672" # AMQP
|
||||
- "61616:61616" # OpenWire
|
@@ -5,7 +5,7 @@ set -vex
|
||||
pushd "$(dirname "${BASH_SOURCE[0]}")/../../"
|
||||
|
||||
# Maven Setup
|
||||
mkdir -p "${HOME}/.m2" && cp -f .travis.settings.xml "${HOME}/.m2/settings.xml"
|
||||
mkdir -p "${HOME}/.m2" && cp -f .github/.ci.settings.xml "${HOME}/.m2/settings.xml"
|
||||
find "${HOME}/.m2/repository/" -type d -name "*-SNAPSHOT*" | xargs -r -l rm -rf
|
||||
|
||||
# Docker Logins
|
@@ -4,23 +4,19 @@ 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}"
|
||||
git checkout -B "${BRANCH_NAME}"
|
||||
|
||||
# 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}" \
|
||||
"-Darguments=-Pall-tas-tests -Pags -DskipTests -Dbuild-number=${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 =========================="
|
15
scripts/ci/tests/AppContext05TestSuite-setup.sh
Normal file
15
scripts/ci/tests/AppContext05TestSuite-setup.sh
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
echo "=========================== Starting AppContext05TestSuite setup ==========================="
|
||||
PS4="\[\e[35m\]+ \[\e[m\]"
|
||||
set -vex
|
||||
pushd "$(dirname "${BASH_SOURCE[0]}")/../../../"
|
||||
|
||||
mkdir -p "${HOME}/tmp"
|
||||
cp repository/src/test/resources/realms/alfresco-realm.json "${HOME}/tmp"
|
||||
echo "HOST_IP=$(hostname -I | cut -f1 -d' ')" >> $GITHUB_ENV
|
||||
docker run -d -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=admin -e DB_VENDOR=h2 -p 8999:8080 -e KEYCLOAK_IMPORT=/tmp/alfresco-realm.json -v $HOME/tmp/alfresco-realm.json:/tmp/alfresco-realm.json alfresco/alfresco-identity-service:1.2
|
||||
|
||||
popd
|
||||
set +vex
|
||||
echo "=========================== Finishing AppContext05TestSuite setup =========================="
|
@@ -6,9 +6,9 @@ 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}"
|
||||
#Fetch the latest changes, as GHA will only checkout the PR commit
|
||||
git fetch origin "${BRANCH_NAME}"
|
||||
git checkout "${BRANCH_NAME}"
|
||||
git pull
|
||||
|
||||
# Retrieve the current Community version - latest tag on the current branch
|
||||
@@ -16,7 +16,7 @@ VERSION="$(git describe --abbrev=0 --tags)"
|
||||
|
||||
DOWNSTREAM_REPO="github.com/Alfresco/alfresco-enterprise-repo.git"
|
||||
|
||||
cloneRepo "${DOWNSTREAM_REPO}" "${TRAVIS_BRANCH}"
|
||||
cloneRepo "${DOWNSTREAM_REPO}" "${BRANCH_NAME}"
|
||||
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")/../../../$(basename "${DOWNSTREAM_REPO%.git}")"
|
||||
|
||||
@@ -33,8 +33,8 @@ 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")
|
||||
if [[ "${COMMIT_MESSAGE}" =~ \[force[^\]]*\] ]]; then
|
||||
FORCE_TOKEN=$(echo "${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
|
@@ -1,26 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
echo "=========================== Starting SourceClear Script ==========================="
|
||||
PS4="\[\e[35m\]+ \[\e[m\]"
|
||||
set +e -v -x
|
||||
pushd "$(dirname "${BASH_SOURCE[0]}")/../../"
|
||||
|
||||
mvn -B -q clean install \
|
||||
-DskipTests \
|
||||
-Dmaven.javadoc.skip=true \
|
||||
com.srcclr:srcclr-maven-plugin:scan \
|
||||
-Dcom.srcclr.apiToken=${SRCCLR_API_TOKEN} > scan.log
|
||||
|
||||
SUCCESS=$? # this will read exit code of the previous command
|
||||
|
||||
if [ -z "$VERACODE_FAILS_BUILD" ] || [ "$VERACODE_FAILS_BUILD" = false ] ; then
|
||||
SUCCESS=0
|
||||
fi
|
||||
|
||||
cat scan.log | grep -e 'Full Report Details' -e 'Failed'
|
||||
|
||||
popd
|
||||
set +vex
|
||||
echo "=========================== Finishing SourceClear Script =========================="
|
||||
|
||||
exit ${SUCCESS}
|
Reference in New Issue
Block a user