Skip to content

Run tests on supported databases #1833

Run tests on supported databases

Run tests on supported databases #1833

Workflow file for this run

name: CI
on:
push:
branches:
- 7.11.x
- fix/MNT-24335-performance_issue_WF_tests_withUnitTests
pull_request:
branches:
- 7.11.x
- fix/MNT-24335-performance_issue_WF_tests_withUnitTests
# Allows to run this workflow manually from the Actions tab
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name || github.run_id }}
cancel-in-progress: true
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: Alfresco/alfresco-build-tools/.github/actions/pre-commit@v1.21.0
build:
runs-on: ubuntu-latest
needs: pre-commit
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
token: ${{ secrets.BOT_GITHUB_TOKEN }}
- uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Setup Java JDK 11
uses: actions/setup-java@de1bb2b0c5634f0fc4438d7aa9944e68f9bf86cc # 3.6.0
with:
java-version: 11
distribution: 'temurin'
- uses: Alfresco/alfresco-build-tools/.github/actions/update-pom-to-next-pre-release@v1.21.0
id: update-pom-to-next-version
if: github.event_name == 'push'
- name: Update VERSION file
if: github.event_name == 'push'
run: |
echo ${{steps.update-pom-to-next-version.outputs.next-prerelease}} > VERSION
- name: Set preview version
if: ${{ contains(github.head_ref, 'preview') }}
run: |
GITHUB_PR_NUMBER=PR-${{ github.event.pull_request.number }}
echo 0.0.1-${GITHUB_PR_NUMBER}-${GITHUB_RUN_NUMBER}-SNAPSHOT > VERSION
- name: Set VERSION env variable
if: ${{ github.event_name == 'push' || contains(github.head_ref, 'preview') }}
run: |
VERSION=$(cat VERSION)
echo set VERSION=$VERSION
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Update pom files to the new version
if: ${{ contains(github.head_ref, 'preview') }}
run: mvn -B versions:set -DnewVersion=$VERSION -DprocessAllModules=true -DgenerateBackupPoms=false
- name: Define Maven Command
id: define_maven_command
shell: bash
run: |
if [ $DO_PUSH == 'true' ]
then
echo "command=deploy" >> $GITHUB_OUTPUT
else
echo "command=verify" >> $GITHUB_OUTPUT
fi
env:
DO_PUSH: ${{ github.event_name == 'push' || contains(github.head_ref, 'preview') }}
- name: Build and Test with Maven (and maybe Deploy)
shell: bash
run: mvn ${{ steps.define_maven_command.outputs.command }} ${{ env.MAVEN_CLI_OPTS}}
env:
MAVEN_CLI_OPTS: --show-version --no-transfer-progress --settings settings.xml
MAVEN_USERNAME: ${{ secrets.NEXUS_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
- name: Echo Longest Tests run
shell: bash
run: find . -name TEST-*.xml -exec grep -h testcase {} \; | awk -F '"' '{printf("%s#%s() - %.3fms\n", $4, $2, $6); }' | sort -n -k 3 | tail -20
- name: Configure git user
if: github.event_name == 'push'
run: |
git config --global user.name $GITHUB_USERNAME
git config --global user.email $GITHUB_USERNAME@users.noreply.github.com
env:
GITHUB_USERNAME: ${{ secrets.BOT_GITHUB_USERNAME }}
- name: Create release tag
if: github.event_name == 'push'
run: |
git commit -am "Release $VERSION" --allow-empty
git tag -fa $VERSION -m "Release version $VERSION"
git push -f -q origin $VERSION
notify:
runs-on: ubuntu-latest
needs: build
if: always() && failure() && github.event_name == 'push'
steps:
- name: Slack Notification
uses: Alfresco/alfresco-build-tools/.github/actions/send-slack-notification@v1.21.0
with:
channel-id: 'eng-hxp-studio-activiti-gh-notifs'
token: ${{ secrets.SLACK_NOTIFICATION_BOT_TOKEN }}