Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ACS-4454 Migrating to GH Actions #727

Merged
merged 25 commits into from
Feb 9, 2023
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 132 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
name: Alfresco Transform Core CI

on:
push:
branches:
- feature/**
mikolajbrzezinski marked this conversation as resolved.
Show resolved Hide resolved
- fix/**
- SP/**
mikolajbrzezinski marked this conversation as resolved.
Show resolved Hide resolved
- HF/**
- ATS-**
- ACS-**
- MNT-**
pull_request:
branches:
- master
- feature/**
- fix/**
- SP/**
- HF/**
- ATS-**
- ACS-**
- MNT-**
workflow_call:
workflow_dispatch:

env:
DOCKERHUB_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKERHUB_USERNAME: ${{ secrets.DOCKER_USERNAME }}
mikolajbrzezinski marked this conversation as resolved.
Show resolved Hide resolved
GITHUB_ACTIONS_DEPLOY_TIMEOUT: 60
mikolajbrzezinski marked this conversation as resolved.
Show resolved Hide resolved
JAVA_VERSION: "17"
mikolajbrzezinski marked this conversation as resolved.
Show resolved Hide resolved
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD }}
QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }}
mikolajbrzezinski marked this conversation as resolved.
Show resolved Hide resolved

jobs:
veracode:
name: "Veracode - Source Clear Scan (SCA)"
runs-on: ubuntu-latest
if: >
github.ref_name == 'master' || github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v3
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.32.0
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.32.0
- name: "Before install"
mikolajbrzezinski marked this conversation as resolved.
Show resolved Hide resolved
run: |
mikolajbrzezinski marked this conversation as resolved.
Show resolved Hide resolved
bash _ci/init.sh
- uses: Alfresco/alfresco-build-tools/.github/actions/veracode@v1.32.0
with:
srcclr-api-token: ${{ secrets.SRCCLR_API_TOKEN }}

build_and_test:
name: "Core & Base Snapshot deployment"
runs-on: ubuntu-latest
if: >
github.ref_name == 'master' && github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v3
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.32.0
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.32.0
- name: "Before install"
mikolajbrzezinski marked this conversation as resolved.
Show resolved Hide resolved
run: |
mikolajbrzezinski marked this conversation as resolved.
Show resolved Hide resolved
bash _ci/init.sh
- name: "Install"
mikolajbrzezinski marked this conversation as resolved.
Show resolved Hide resolved
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
run: |
mikolajbrzezinski marked this conversation as resolved.
Show resolved Hide resolved
mvn -B -U -q clean install -DadditionalOption=-Xdoclint:none -DskipTests -Dmaven.javadoc.skip=true -Dmaven.wagon.http.pool=false -Pbase
- name: "Before script"
mikolajbrzezinski marked this conversation as resolved.
Show resolved Hide resolved
run: bash _ci/cache_artifacts.sh
- name: "Run tests"
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
run: |
mikolajbrzezinski marked this conversation as resolved.
Show resolved Hide resolved
mvn -B -U clean deploy -DadditionalOption=-Xdoclint:none -Dmaven.javadoc.skip=true -Dmaven.wagon.http.pool=false -Pbase

all_tests_matrix:
name: ${{ matrix.testName }}
runs-on: ubuntu-latest
if: always()
mikolajbrzezinski marked this conversation as resolved.
Show resolved Hide resolved
strategy:
fail-fast: false
matrix:
include:
- testName: ImageMagick
testPackage: imagemagick
- testName: LibreOffice
testPackage: libreoffice
- testName: Transform Misc
testPackage: misc
- testName: PDF Renderer
testPackage: pdf-renderer
- testName: Tika
testPackage: tika
steps:
- uses: actions/checkout@v3
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.32.0
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.32.0
- name: "Before install"
run: |
mikolajbrzezinski marked this conversation as resolved.
Show resolved Hide resolved
bash _ci/init.sh
- name: "Install"
mikolajbrzezinski marked this conversation as resolved.
Show resolved Hide resolved
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
run: |
mikolajbrzezinski marked this conversation as resolved.
Show resolved Hide resolved
bash _ci/build.sh ${{ matrix.testPackage }}
- name: "Before script"
run: bash _ci/cache_artifacts.sh
- name: "Run tests"
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
run: |
mikolajbrzezinski marked this conversation as resolved.
Show resolved Hide resolved
bash _ci/test.sh ${{ matrix.testPackage }}

all_in_one_transformer:
mikolajbrzezinski marked this conversation as resolved.
Show resolved Hide resolved
name: "All in One Transformer"
runs-on: ubuntu-latest
if: always()
mikolajbrzezinski marked this conversation as resolved.
Show resolved Hide resolved
steps:
- uses: actions/checkout@v3
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.32.0
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.32.0
- name: "Before install"
run: |
mikolajbrzezinski marked this conversation as resolved.
Show resolved Hide resolved
bash _ci/init.sh
- name: "Install"
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
run: |
mikolajbrzezinski marked this conversation as resolved.
Show resolved Hide resolved
bash _ci/build.sh full-build
- name: "Before script"
run: bash _ci/cache_artifacts.sh
- name: "Run tests"
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
run: |
mikolajbrzezinski marked this conversation as resolved.
Show resolved Hide resolved
bash _ci/test.sh aio-test
53 changes: 53 additions & 0 deletions .github/workflows/master_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Master/Release branch workflow
mikolajbrzezinski marked this conversation as resolved.
Show resolved Hide resolved

on:
push:
branches:
- master
- SP/**
- HF/**
schedule:
- cron: '0 5 * * 1'

env:
GIT_USERNAME: ${{ secrets.BOT_GITHUB_USERNAME }}
GIT_EMAIL: ${{ secrets.BOT_GITHUB_EMAIL }}
GIT_PASSWORD: ${{ secrets.BOT_GITHUB_TOKEN }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKERHUB_USERNAME: ${{ secrets.DOCKER_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD }}
QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }}
GITHUB_ACTIONS_DEPLOY_TIMEOUT: 60

jobs:
run_ci:
uses: ./.github/workflows/ci.yml
secrets: inherit

release:
name: "Release"
runs-on: ubuntu-latest
needs: [ run_ci ]
if: >
!failure() &&
contains(github.event.head_commit.message, '[release]') &&
github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v3
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.32.0
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.32.0
- name: "Init"
run: bash ./scripts/ci/init.sh
- uses: Alfresco/alfresco-build-tools/.github/actions/configure-git-author@v1.32.0
with:
username: ${{ env.GIT_USERNAME }}
email: ${{ env.GIT_EMAIL }}
global: true
- name: "Before script"
mikolajbrzezinski marked this conversation as resolved.
Show resolved Hide resolved
run: bash _ci/cache_artifacts.sh
- name: "Release"
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
run: |
mikolajbrzezinski marked this conversation as resolved.
Show resolved Hide resolved
bash _ci/release.sh
84 changes: 0 additions & 84 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Alfresco Transform Core
[![Build Status](https://travis-ci.com/Alfresco/alfresco-transform-core.svg?branch=master)](https://travis-ci.com/Alfresco/alfresco-transform-core)
[![Build Status](https://github.com/Alfresco/alfresco-transform-core/actions/workflows/master_release.yml/badge.svg?branch=master)](https://github.com/Alfresco/alfresco-transform-core/actions/workflows/master_release.yml)

Contains the common transformer (T-Engine) code, plus a few implementations.

Expand Down
2 changes: 1 addition & 1 deletion _ci/cache_artifacts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if [ -f "${HOME}/artifacts/libreoffice-dist-${LIBREOFFICE_VERSION}-linux.gz" ];
echo "Using cached LibreOffice distribution..."
else
echo "Downloading LibreOffice distribution..."
curl -s -S ${LIBREOFFICE_RPM_URL} -o "${HOME}/artifacts/libreoffice-dist-${LIBREOFFICE_VERSION}-linux.gz"
curl -s -S ${LIBREOFFICE_RPM_URL} -o "${HOME}/artifacts/libreoffice-dist-${LIBREOFFICE_VERSION}-linux.gz" --create-dirs
fi
cp "${HOME}/artifacts/libreoffice-dist-${LIBREOFFICE_VERSION}-linux.gz" engines/libreoffice

Expand Down
6 changes: 4 additions & 2 deletions _ci/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ PS4="\[\e[35m\]+ \[\e[m\]"
set -vex
pushd "$(dirname "${BASH_SOURCE[0]}")/../"

mkdir -p ${HOME}/.m2 && cp -rf _ci/settings.xml ${HOME}/.m2/
mkdir -p ${HOME}/.m2 && cp -f _ci/settings.xml ${HOME}/.m2/
find "${HOME}/.m2/repository/" -type d -name "*-SNAPSHOT*" | xargs -r -l rm -rf

echo "${QUAY_PASSWORD}" | docker login -u="${QUAY_USERNAME}" --password-stdin quay.io
echo "${DOCKERHUB_PASSWORD}" | docker login -u=${DOCKERHUB_USERNAME} --password-stdin docker.io
mikolajbrzezinski marked this conversation as resolved.
Show resolved Hide resolved
find "${HOME}/.m2/repository/" -type d -name "*-SNAPSHOT*" | xargs -r -l rm -rf
mikolajbrzezinski marked this conversation as resolved.
Show resolved Hide resolved


# Enable experimental docker features (e.g. squash options)
echo '{"experimental":true}' | sudo tee /etc/docker/daemon.json
Expand Down
6 changes: 3 additions & 3 deletions _ci/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ set -vex
pushd "$(dirname "${BASH_SOURCE[0]}")/../"

# For PR builds only execute a Dry Run of the release
[ "${TRAVIS_PULL_REQUEST}" = "false" ] && DRY_RUN="" || DRY_RUN="-DdryRun"
[ "${PULL_REQUEST}" = "false" ] && DRY_RUN="" || DRY_RUN="-DdryRun"

# Travis CI runner work on DETACHED HEAD, so we need to checkout the release branch
git checkout -B "${TRAVIS_BRANCH}"
# GitHub Actions CI runner work on DETACHED HEAD, so we need to checkout the release branch
git checkout -B "${BRANCH_NAME}"

git config user.email "build@alfresco.com"
mikolajbrzezinski marked this conversation as resolved.
Show resolved Hide resolved

Expand Down
4 changes: 2 additions & 2 deletions _ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ set -vex
pushd "$(dirname "${BASH_SOURCE[0]}")/../"

# Always build the image, but only publish from the "master" branch
[ "${TRAVIS_PULL_REQUEST}" = "false" ] && [ "${TRAVIS_BRANCH}" = "master" ] && PROFILE="internal" || PROFILE="local"
[ "${PULL_REQUEST}" = "false" ] && [ "${BRANCH_NAME}" = "master" ] && PROFILE="internal" || PROFILE="local"

# If the branch is "master" and the commit is not a Pull Request then deploy the JAR SNAPSHOT artifacts
[ "${TRAVIS_PULL_REQUEST}" = "false" ] && [ "${TRAVIS_BRANCH}" = "master" ] && DEPLOY="deploy" || DEPLOY="verify"
[ "${PULL_REQUEST}" = "false" ] && [ "${BRANCH_NAME}" = "master" ] && DEPLOY="deploy" || DEPLOY="verify"

# Do not deploy snapshots for alfresco-transform-core, alfresco-transformer-base and alfresco-base-t-engine
mvn -B -U -Dmaven.wagon.http.pool=false \
Expand Down
2 changes: 1 addition & 1 deletion deprecated/alfresco-transformer-base/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ and the Alfresco Maven repository:
</repository>
~~~

The build plan is available in [TravisCI](https://travis-ci.com/Alfresco/alfresco-transform-core).
The build plan is available in [GitHub Actions CI](https://github.com/Alfresco/alfresco-transform-core/actions).

## Contributing guide

Expand Down
6 changes: 3 additions & 3 deletions docs/build-and-release.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Build
The `alfresco-transform-core` project uses _Travis CI_. \
The `.travis.yml` config file can be found in the root of the repository.
The `alfresco-transform-core` project uses _GitHub Actions CI_. \
The `ci.yml` and `master_release.yml` config files can be found in the `.github/workflows` directory of the project.


## Stages and Jobs
Expand All @@ -9,7 +9,7 @@ The `.travis.yml` config file can be found in the root of the repository.


## Branches
Travis CI builds differ by branch:
GitHub Actions CI builds differ by branch:
* `master` / `SP/*` / `HF/*` branches:
- regular builds which include the _Build_ stage;
> On the `master` branch only the _Build_ stage updates the `latest` T-Engines images on
Expand Down