Skip to content

Workflow file for this run

name: Alfresco Connector for Hyland Experience Insight CI
on:
pull_request:
branches:
- feature/**
- fix/**
- master
- release/**
push:
branches:
- feature/**
- fix/**
- master
- release/**
env:
# Both variables are required to be set before the release process starts .
# As the release is triggered by a commit message with "[release]" keyword on a release branch,
# setting these variables to new values can be done in the same commit and will indicate the release and the dev versions in it.
DEVELOPMENT_VERSION: "1.0.0-SNAPSHOT" # The version that will be set in pom files after the release (next dev version)
RELEASE_VERSION: "1.0.0-A5" # The version of the release (tag).
GITHUB_ACTIONS_DEPLOY_TIMEOUT: 60
MAVEN_CLI_OPTS: "-B -e -fae -V -DinstallAtEnd=true -DfailIfNoTests=false -U -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -Pdistribution "
MAVEN_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
MAVEN_USERNAME: ${{ secrets.NEXUS_USERNAME }}
JAVA_VERSION: "17"
S3_BUCKET_REGION: "eu-west-1"
jobs:
pre_commit:
runs-on: ubuntu-latest
steps:
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v5.25.0
- uses: actions/checkout@v4
- id: changed-files
uses: tj-actions/changed-files@d6babd6899969df1a11d14c368283ea4436bca78 # v44.5.2
- name: Store changed files in env
run: echo "GITHUB_MODIFIED_FILES=${{ steps.changed-files.outputs.all_changed_files }}" >> $GITHUB_ENV
- uses: Alfresco/alfresco-build-tools/.github/actions/pre-commit@v5.25.0
veracode:
name: "Veracode - Source Clear Scan (SCA)"
runs-on: ubuntu-latest
needs:
- pre_commit
if: >
(github.ref_name == 'master' || startsWith(github.ref_name, 'release/') || github.event_name == 'pull_request') &&
!contains(github.event.head_commit.message, '[skip build]')
steps:
- uses: actions/checkout@v4
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v5.25.0
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v5.25.0
- uses: Alfresco/alfresco-build-tools/.github/actions/veracode@v5.25.0
continue-on-error: true
with:
srcclr-api-token: ${{ secrets.SRCCLR_API_TOKEN }}
srcclr-install-options: -Dmaven.test.skip -P !test -pl "!common-test,!e2e-test"
pmd_scan:
name: "PMD Scan"
runs-on: ubuntu-latest
if: >
github.event_name == 'pull_request' &&
!contains(github.event.head_commit.message, '[skip pmd]') &&
!contains(github.event.head_commit.message, '[skip tests]')
steps:
- uses: actions/checkout@v4
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v5.25.0
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v5.25.0
- uses: Alfresco/ya-pmd-scan@v3.0.2
test_application:
name: "Build and test application"
runs-on: ubuntu-latest
needs:
- pre_commit
if: >
!contains(github.event.head_commit.message, '[skip tests]') &&
!contains(github.event.head_commit.message, '[skip build]')
strategy:
fail-fast: false
matrix:
subproject: [ "bulk-ingester", "common", "common-authentication", "common-test",
"live-ingester", "prediction-applier", "prediction-applier-extension" ]
steps:
- uses: actions/checkout@v4
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v5.25.0
- name: "Login to Quay.io"
uses: docker/login-action@v3.1.0
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v5.25.0
- name: "Test application"
run: mvn ${{ env.MAVEN_CLI_OPTS }} clean verify -pl '${{ matrix.subproject }}' -am -DfailIfNoTests=false
test_distribution:
name: "Build application with distribution profile"
runs-on: ubuntu-latest
needs:
- pre_commit
if: >
!contains(github.event.head_commit.message, '[skip tests]') &&
!contains(github.event.head_commit.message, '[skip build]')
strategy:
fail-fast: false
matrix:
repoVersion: [ 7.3.2, 7.4.2, 23.2.1 ]
steps:
- uses: actions/checkout@v4
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v1.35.2
- name: "Login to Quay.io"
uses: docker/login-action@v2.1.0
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.35.2
- name: "Build application with distribution profile"
run: mvn ${{ env.MAVEN_CLI_OPTS }} clean install -Pdistribution -DskipTests -Dalfresco-platform.version=${{ matrix.repoVersion }}
run_e2e_test:
name: "Run e2e tests"
runs-on: ubuntu-latest
needs:
- pre_commit
if: >
!contains(github.event.head_commit.message, '[skip build]') &&
!contains(github.event.head_commit.message, '[skip tests]') &&
!contains(github.event.head_commit.message, '[skip e2es]')
strategy:
fail-fast: false
matrix:
repoVersion: [ 7.3.2, 7.4.2, 23.2.1 ]
steps:
- uses: actions/checkout@v4
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v5.25.0
- name: "Login to Quay.io"
uses: docker/login-action@v3.1.0
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v5.25.0
- name: "Build application"
run: mvn ${{ env.MAVEN_CLI_OPTS }} clean install -DskipTests -Dalfresco-platform.version=${{ matrix.repoVersion }}
- name: "Build docker images"
run: bash ./scripts/ci/buildDockerImages.sh
- name: "Run e2e tests"
run: mvn ${{ env.MAVEN_CLI_OPTS }} verify -pl 'prediction-applier-extension,e2e-test' -am -DskipUnitTests -DskipIntegrationTests -Dalfresco-platform.version=${{ matrix.repoVersion }}
push_docker_images:
name: "Push docker images"
runs-on: ubuntu-latest
needs:
- test_application
if: >
github.event_name == 'push' &&
!(failure() || cancelled()) &&
!contains(github.event.head_commit.message, '[skip build]')
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v3
- name: "Login to Quay.io"
uses: docker/login-action@v3.1.0
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v5.25.0
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v5.25.0
- name: "Build application"
run: mvn ${{ env.MAVEN_CLI_OPTS }} clean install -DskipTests
- name: "Push docker images"
run: bash ./scripts/ci/buildDockerImages.sh -p
env:
COMMIT_MESSAGE: ${{ github.sha }}
- name: "Clean Maven cache"
run: bash ./scripts/ci/cleanup_cache.sh
publish_snapshot_artifacts:
name: "Publish SNAPSHOT artifacts"
runs-on: ubuntu-latest
needs:
- test_application
if: >
!(failure() || cancelled()) &&
(github.ref_name == 'master' || startsWith(github.ref_name, 'release/')) &&
github.event_name != 'pull_request' &&
!contains(github.event.head_commit.message, '[skip build]')
steps:
- uses: actions/checkout@v4
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v5.25.0
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v5.25.0
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v5.25.0
- name: "Publish SNAPSHOT artifacts"
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
run: mvn ${{ env.MAVEN_CLI_OPTS }} deploy -DskipTests
- name: "Clean Maven cache"
run: bash ./scripts/ci/cleanup_cache.sh
release_and_deploy_to_nexus_and_s3:
name: "Make release and deploy to Nexus and S3 Staging Bucket"
runs-on: ubuntu-latest
needs:
- test_application
if: >
!(failure() || cancelled()) &&
(github.ref_name == 'master' || startsWith(github.ref_name, 'release/')) &&
github.event_name != 'pull_request' &&
contains(github.event.head_commit.message, '[release]')
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v5.25.0
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v5.25.0
- uses: Alfresco/alfresco-build-tools/.github/actions/configure-git-author@v5.25.0
with:
username: ${{ secrets.BOT_GITHUB_USERNAME }}
email: ${{ secrets.BOT_GITHUB_EMAIL }}
- name: "Build application"
run: mvn ${{ env.MAVEN_CLI_OPTS }} clean install -DskipTests -Dproject.revision.key=${{ github.sha }}
- name: "Make release and deploy to Nexus"
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
run: mvn ${{ env.MAVEN_CLI_OPTS }} -DreleaseVersion="${{ env.RELEASE_VERSION }}" -DdevelopmentVersion="${{ env.DEVELOPMENT_VERSION }}" -Dtag="${{ env.RELEASE_VERSION }}" -Dusername="${{ secrets.BOT_GITHUB_USERNAME }}" -Dpassword="${{ secrets.BOT_GITHUB_TOKEN }}" -DscmCommentPrefix="[maven-release-plugin][skip ci]" -DskipTests -Dproject.revision.key=${{ github.sha }} "-Darguments=-DskipTests -Dadditionalparam=-Xdoclint:none -Dproject.revision.key=${{ github.sha }}" release:prepare release:perform
- run: mkdir -p deploy_dir/community/hxinsight-connector/${{ env.RELEASE_VERSION }}
- name: "Move the final artifacts to a single folder (deploy_dir) to be copied to S3"
run: mv "distribution/target/alfresco-hxinsight-connector-distribution-${{ env.RELEASE_VERSION }}.zip" "deploy_dir/community/hxinsight-connector/${{ env.RELEASE_VERSION }}/"
- name: "Clone Alfresco/third-party-license-overrides"
run: git clone --depth=1 https://github.com/Alfresco/third-party-license-overrides.git
- uses: actions/setup-python@v5
- name: "Create third party license csv file and add it to the deploy directory"
run: python3 ./third-party-license-overrides/thirdPartyLicenseCSVCreator.py --project "${{ github.workspace }}" --version "${{ env.RELEASE_VERSION }}" --combined --output "deploy_dir/community/hxinsight-connector/${{ env.RELEASE_VERSION }}"
- name: "Configure AWS credentials"
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_S3_STAGING_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_S3_STAGING_SECRET_KEY }}
aws-region: ${{ env.S3_BUCKET_REGION }}
- name: "Deploy to S3 Staging Bucket"
run: aws s3 cp --recursive --acl private ./deploy_dir s3://alfresco-artefacts-staging
- name: "Clean Maven cache"
run: bash ./scripts/ci/cleanup_cache.sh
deploy_release_version_to_quay:
name: "Deploy release version to quay.io"
runs-on: ubuntu-latest
needs:
- test_application
if: >
!(failure() || cancelled()) &&
(github.ref_name == 'master' || startsWith(github.ref_name, 'release/')) &&
github.event_name != 'pull_request' &&
contains(github.event.head_commit.message, '[release]')
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v3
- name: "Login to Quay.io"
uses: docker/login-action@v3.1.0
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v5.25.0
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v5.25.0
- name: "Build application"
run: mvn ${{ env.MAVEN_CLI_OPTS }} clean install -DskipTests -Dproject.revision.key=${{ github.sha }}
- name: "Deploy release version to quay.io"
run: bash ./scripts/ci/releaseDockerImage.sh -v ${{ env.RELEASE_VERSION }}
env:
COMMIT_MESSAGE: ${{ github.sha }}
- name: "Clean Maven cache"
run: bash ./scripts/ci/cleanup_cache.sh
deploy_release:
name: "Copy to S3 Downloads Bucket"
runs-on: ubuntu-latest
needs:
- deploy_release_version_to_quay
- release_and_deploy_to_nexus_and_s3
- publish_snapshot_artifacts
- push_docker_images
if: >
!(failure() || cancelled()) &&
(github.ref_name == 'master' || startsWith(github.ref_name, 'release/')) &&
github.event_name != 'pull_request' &&
contains(github.event.head_commit.message, '[release]')
steps:
- uses: actions/checkout@v4
- name: "Configure AWS credentials"
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_S3_RELEASE_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_S3_RELEASE_SECRET_ACCESS_KEY }}
aws-region: ${{ env.S3_BUCKET_REGION }}
- run: set -x
- name: "Check release version and copy to S3 Downloads Bucket"
run: |
if [[ ${{ env.RELEASE_VERSION }} =~ ^[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?$ ]]; then
aws s3 cp --recursive --acl private --copy-props none "s3://alfresco-artefacts-staging/community/hxinsight-connector/${{ env.RELEASE_VERSION }}/" "s3://eu.dl.alfresco.com/release/community/hxinsight-connector/${{ env.RELEASE_VERSION }}/"
fi