Unit Tests #265
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: Unit Tests | |
on: | |
push: | |
branches: | |
- main | |
- 3.x | |
- 2.x | |
pull_request: | |
workflow_dispatch: | |
schedule: | |
- cron: '05 7 * * *' # 07:00 UTC every day | |
env: | |
# Workaround for kotlin sample multithreading issue: https://youtrack.jetbrains.com/issue/KT-43894 | |
MAVEN_OPTS: "-Didea.home.path=${{ vars.RUNNER_TEMP }} -Didea.ignore.disabled.plugins=true" | |
jobs: | |
unitTests: | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
java: [17, 19] | |
steps: | |
- name: Get current date | |
id: date | |
run: echo "date=$(date +'%Y-%m-%d' --utc)" >> $GITHUB_OUTPUT | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-java@v1 | |
with: | |
java-version: ${{ matrix.java }} | |
- uses: actions/cache@v2 | |
id: mvn-cache | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-unified-${{ steps.date.outputs.date }} | |
- name: Maven go offline | |
id: mvn-offline | |
if: steps.mvn-cache.outputs.cache-hit != 'true' | |
run: ./mvnw compile dependency:go-offline | |
- name: Mvn install # Need this when the directory/pom structure changes | |
id: install1 | |
continue-on-error: true | |
run: | | |
./mvnw \ | |
--batch-mode \ | |
--show-version \ | |
--threads 1.5C \ | |
--define maven.test.skip=true \ | |
--define maven.javadoc.skip=true \ | |
install | |
- name: Retry install on failure | |
id: install2 | |
if: steps.install1.outcome == 'failure' | |
run: | | |
./mvnw \ | |
--batch-mode \ | |
--show-version \ | |
--threads 1.5C \ | |
--define maven.test.skip=true \ | |
--define maven.javadoc.skip=true \ | |
install | |
- name: Unit Tests | |
run: | | |
./mvnw \ | |
--batch-mode \ | |
--fail-at-end \ | |
--threads 1.5C \ | |
test | |
- name: Aggregate Report | |
run: | | |
./mvnw \ | |
--batch-mode \ | |
--define aggregate=true \ | |
surefire-report:report-only | |
- name: Archive logs | |
if: always() | |
continue-on-error: true | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Unit Test Logs - Java ${{ matrix.java }} | |
path: | | |
**/target/surefire-reports/* | |
**/target/site | |
releaseCheck: | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
steps: | |
- name: Get current date | |
id: date | |
run: echo "date=$(date +'%Y-%m-%d' --utc)" >> $GITHUB_OUTPUT | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-java@v1 | |
with: | |
java-version: 17 | |
- uses: actions/cache@v2 | |
id: mvn-cache | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-unified-${{ steps.date.outputs.date }} | |
- name: Maven go offline | |
id: mvn-offline | |
if: steps.mvn-cache.outputs.cache-hit != 'true' | |
run: ./mvnw compile dependency:go-offline | |
- name: releaseCheck | |
run: | | |
./mvnw \ | |
--batch-mode \ | |
-Drelease=true \ | |
-DskipTests \ | |
-Dgpg.skip \ | |
-Dcheckstyle.skip \ | |
clean \ | |
package | |
- name: docsCheck | |
run: | | |
./mvnw \ | |
--batch-mode \ | |
--activate-profiles docs,spring \ | |
-DskipTests \ | |
-Dgpg.skip \ | |
-Dcheckstyle.skip \ | |
--projects docs \ | |
clean \ | |
package | |
- name: Archive Artifacts | |
if: always() | |
continue-on-error: true | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Release Artifacts | |
path: | | |
**/.flattened-pom.xml | |
**/target/**.jar | |
target/site/apidocs | |
**/target/generated-docs | |
!spring-cloud-gcp-samples |