Improve build performance by reducing files uploaded for Sonar analys… #5
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
name: Build | |
on: | |
push: | |
branches: [ 'main' ] | |
pull_request: | |
branches: [ 'main' ] | |
types: [ opened, reopened, synchronize ] | |
jobs: | |
build-api: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
- name: Cache Maven Packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Build and Test | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
SONAR_ORG: ${{secrets.SONAR_ORG}} | |
SONAR_PROJECT: ${{secrets.SONAR_PROJECT}} | |
SONAR_TOKEN: ${{secrets.SONAR_TOKEN}} | |
run: | | |
# | |
# Set write-transformed-bytecode-to-build-output for IT coverage. Do NOT use the container image | |
# created by this step. | |
# | |
# See: https://quarkus.io/guides/tests-with-coverage#coverage-for-integration-tests | |
# | |
mvn verify -Pdocker -B --no-transfer-progress -Dquarkus.package.write-transformed-bytecode-to-build-output=true -f api/pom.xml | |
- name: Archive Results | |
uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: artifacts | |
path: api/target/failsafe-reports/ | |
## Save the context information for use in Sonar analysis | |
- name: Save Build Context | |
run: echo "$GITHUB_CONTEXT" > api/target/build-context.json | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
## Attach the target directory for use in Sonar analysis | |
- name: Attach Build Output | |
uses: actions/upload-artifact@v3 | |
with: | |
name: target | |
path: | | |
**/target/ | |
!**/target/**/*.jar | |
!**/target/failsafe-reports/**/* | |
!**/target/surefire-reports/**/* | |
build-ui: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Build UI Image | |
uses: docker/build-push-action@v5 | |
with: | |
context: ui/ | |
push: false | |
tags: | | |
eyefloaters/ui:latest |