|
| 1 | +# Copyright © 2025 Cask Data, Inc. |
| 2 | +# Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| 3 | +# use this file except in compliance with the License. You may obtain a copy of |
| 4 | +# the License at |
| 5 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 6 | +# Unless required by applicable law or agreed to in writing, software |
| 7 | +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 8 | +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 9 | +# License for the specific language governing permissions and limitations under |
| 10 | +# the License. |
| 11 | + |
| 12 | +# This workflow will build a Java project with Maven |
| 13 | +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven |
| 14 | +# Note: Any changes to this workflow would be used only after merging into develop |
| 15 | +name: Build with unit tests |
| 16 | + |
| 17 | +on: |
| 18 | + push: |
| 19 | + branches: [ develop, release/** ] |
| 20 | + pull_request: |
| 21 | + branches: [ develop, release/** ] |
| 22 | + types: [opened, synchronize, reopened, labeled] |
| 23 | + |
| 24 | +jobs: |
| 25 | + build: |
| 26 | + runs-on: k8s-runner-build |
| 27 | + |
| 28 | + # We allow builds: |
| 29 | + # 1) When it's a merge into a branch |
| 30 | + # 2) For PRs that are labeled as build and |
| 31 | + # - It's a code change |
| 32 | + # - A build label was just added |
| 33 | + # A bit complex, but prevents builds when other labels are manipulated |
| 34 | + if: > |
| 35 | + github.event_name == 'push' |
| 36 | + || (contains(github.event.pull_request.labels.*.name, 'build') |
| 37 | + && (github.event.action != 'labeled' || github.event.label.name == 'build') |
| 38 | + ) |
| 39 | +
|
| 40 | + steps: |
| 41 | + - uses: actions/checkout@v4 |
| 42 | + with: |
| 43 | + ref: ${{ github.event.workflow_run.head_sha }} |
| 44 | + - name: Cache |
| 45 | + uses: actions/cache@v4 |
| 46 | + with: |
| 47 | + path: ~/.m2/repository |
| 48 | + key: ${{ runner.os }}-maven-${{ github.workflow }}-${{ hashFiles('**/pom.xml') }} |
| 49 | + restore-keys: | |
| 50 | + ${{ runner.os }}-maven-${{ github.workflow }} |
| 51 | + - name: Build with Maven |
| 52 | + run: mvn clean test -fae -T 2 -B -V -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.wagon.httpconnectionManager.ttlSeconds=25 |
| 53 | + - name: Archive build artifacts |
| 54 | + uses: actions/upload-artifact@v4 |
| 55 | + if: always() |
| 56 | + with: |
| 57 | + name: reports-${{ github.run_id }} |
| 58 | + path: | |
| 59 | + **/target/rat.txt |
| 60 | + **/target/surefire-reports/* |
0 commit comments