Build aissemble #441
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven | |
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
name: Build aissemble | |
on: | |
workflow_dispatch: | |
inputs: | |
buildBranch: | |
description: "Branch you want to build" | |
required: true | |
type: string | |
default: "dev" | |
push: | |
branches: [ "dev" ] | |
schedule: | |
- cron: "0 6 * * *" # every day at 6am UTC | |
jobs: | |
build: | |
runs-on: arc-runner-set-aissemble | |
env: | |
DOCKER_CONFIG: /home/runner/.docker | |
RUNS_ON_S3_BUCKET_CACHE: aissemble-github-cache | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ inputs.buildBranch }} | |
- name: Configure AWS | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.S3_CACHE_USER }} | |
aws-secret-access-key: ${{ secrets.S3_CACHE_USER_SECRET }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
mask-aws-account-id: true | |
# 3 hours, as our nightly takes ~ 2 | |
role-duration-seconds: 10800 | |
- name: Install dependencies | |
uses: ./.github/actions/install_dependencies | |
with: | |
docker-username: ${{ secrets.DOCKERHUB_USERNAME }} | |
docker-token: ${{ secrets.DOCKERHUB_TOKEN }} | |
#NB: We restore/save cache manually so that we save the cache even if the build fails | |
- name: Load docker build cache | |
id: cached-docker-build | |
uses: runs-on/cache/restore@v4 | |
if: ${{ ! github.event.schedule }} | |
with: | |
path: ~/.docker/cache | |
key: docker-cache-${{ hashFiles('**/Dockerfile') }} | |
restore-keys: | | |
docker-cache- | |
- name: Load m2 repository cache # Manually caching .m2 repo as the setup-java caching isn't falling back to older caches | |
id: cached-m2-repo | |
uses: runs-on/cache/restore@v4 | |
if: ${{ ! github.event.schedule }} | |
with: | |
path: ~/.m2/repository | |
key: maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
maven- | |
- name: Load m2 build cache | |
id: cached-m2-build | |
uses: runs-on/cache/restore@v4 | |
if: ${{ ! github.event.schedule }} | |
with: | |
path: ~/.m2/build-cache | |
key: maven-build-cache-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
maven-build-cache- | |
#NB: Not saving poetry cache on failure in case it's a failure caused by an in-flight python package release | |
- name: Poetry cache | |
id: cached-poetry | |
uses: runs-on/cache@v4 | |
if: ${{ ! github.event.schedule }} | |
with: | |
path: ~/.cache/pypoetry | |
key: poetry-cache-${{ hashFiles('**/pyproject.toml') }} | |
restore-keys: | | |
poetry-cache- | |
# Generate the settings.xml for ghcr.io, pypi, & dev-pypi server profiles | |
- name: Create settings.xml | |
run: | | |
echo "<settings><servers><server><id>ghcr.io</id><username>${{ secrets.GHCR_IO_USERNAME }}</username><password>${{ secrets.GHCR_IO_TOKEN }}</password></server><server><id>pypi</id><username>${{ secrets.PYPI_USERNAME }}</username><password>${{ secrets.PYPI_TOKEN }}</password></server><server><id>dev-pypi</id><username>${{ secrets.TEST_PYPI_USERNAME }}</username><password>${{ secrets.TEST_PYPI_TOKEN }}</password></server> </servers></settings>" > $HOME/.m2/settings.xml | |
# Run build with the gh-build profile | |
- name: Build aiSSEMBLE | |
run: | | |
./mvnw -B clean deploy -U -file pom.xml -Pci,integration-test,gh-build --settings $HOME/.m2/settings.xml | |
# Install Maven which is needed for archetype tests | |
- name: Set up Maven | |
uses: stCarolas/setup-maven@v5 | |
with: | |
maven-version: 3.9.9 | |
# Execute archetype tests | |
- name: Run Archetype Tests | |
run: | | |
./mvnw -B clean install -Parchetype-test -pl :foundation-archetype | |
- name: Save docker build cache | |
id: save-docker-build | |
uses: runs-on/cache/save@v4 | |
if: always() && steps.cached-docker-build.outputs.cache-hit != 'true' | |
with: | |
path: ~/.docker/cache | |
key: docker-cache-${{ hashFiles('**/Dockerfile') }} | |
- name: Save m2 repository cache | |
id: save-m2-repo | |
uses: runs-on/cache/save@v4 | |
if: always() && steps.cached-m2-repo.outputs.cache-hit != 'true' | |
with: | |
path: ~/.m2/repository | |
key: maven-${{ hashFiles('**/pom.xml') }} | |
- name: Save m2 build cache | |
id: save-m2-build | |
uses: runs-on/cache/save@v4 | |
if: always() && steps.cached-m2-build.outputs.cache-hit != 'true' | |
with: | |
path: ~/.m2/build-cache | |
key: maven-build-cache-${{ hashFiles('**/pom.xml') }} |