Build aissemble #1125
This file contains hidden or 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
| 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 | |
| permissions: | |
| contents: write # Requires 'write' for updating the dependency graph | |
| packages: write | |
| jobs: | |
| build: | |
| runs-on: arc-runner-set-aissemble | |
| env: | |
| RUNS_ON_S3_BUCKET_CACHE: aissemble-github-cache | |
| DOCKER_BUILDER_NAME: k8s-multiarch | |
| 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 }} | |
| - 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-repo-cache | |
| - 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 | |
| #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- | |
| - name: Provision Docker builder | |
| id: provision-docker-builder | |
| run: | | |
| docker builder create --name=$DOCKER_BUILDER_NAME \ | |
| --bootstrap \ | |
| --driver=kubernetes \ | |
| --platform=linux/amd64 \ | |
| --driver-opt="nodeselector=kubernetes.io/arch=amd64","image=docker.io/moby/buildkit:v0.19.0",replicas=3 | |
| docker builder create --name=$DOCKER_BUILDER_NAME \ | |
| --append \ | |
| --bootstrap \ | |
| --driver=kubernetes \ | |
| --platform=linux/arm64 \ | |
| --driver-opt="nodeselector=kubernetes.io/arch=arm64","image=docker.io/moby/buildkit:v0.19.0",replicas=3 | |
| mkdir ~/.docker/fabric8 && cp -R ~/.docker/buildx ~/.docker/fabric8/buildx | |
| # Generate the settings.xml for ghcr.io, pypi, & dev-pypi server profiles | |
| - name: Create settings.xml | |
| id: create-settings-xml | |
| run: | | |
| cat > $HOME/.m2/settings.xml << EOF | |
| <settings> | |
| <servers> | |
| <server> | |
| <id>ghcr.io</id> | |
| <username>\${env.GITHUB_ACTOR}</username> | |
| <password>\${env.GITHUB_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> | |
| EOF | |
| echo "HOME_DIR=$HOME" >> "$GITHUB_OUTPUT" | |
| # Run build with the gh-build profile | |
| - name: Build aiSSEMBLE | |
| run: | | |
| ./mvnw clean deploy -T8 -B -U -Pci,integration-test,gh-build | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # 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 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Submit Dependency Graph | |
| uses: advanced-security/maven-dependency-submission-action@v4 | |
| with: | |
| settings-file: ${{ steps.create-settings-xml.outputs.HOME_DIR }}/.m2/settings.xml | |
| - name: Teardown Docker builder | |
| id: teardown-docker-builder | |
| if: always() | |
| run: | | |
| docker builder rm -f $DOCKER_BUILDER_NAME | |
| - name: Save m2 repository cache | |
| id: save-m2-repo | |
| uses: runs-on/cache/save@v4 | |
| if: ${{ !cancelled() }} | |
| with: | |
| path: ~/.m2/repository | |
| key: maven-repo-cache | |
| - name: Save m2 build cache | |
| id: save-m2-build | |
| uses: runs-on/cache/save@v4 | |
| if: ${{ !cancelled() }} | |
| with: | |
| path: ~/.m2/build-cache | |
| key: maven-build-cache |