Maven Build #579
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: Maven Build | |
on: | |
push: | |
schedule: | |
- cron: '0 15 * * *' # daily at 3pm | |
jobs: | |
build-sample-projects: | |
strategy: | |
fail-fast: false | |
matrix: | |
projects: [ 'spring-boot-example', 'jakarta-ee-example' ] | |
runs-on: ubuntu-20.04 | |
name: ${{ matrix.projects }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: 11.0 | |
distribution: 'adopt' | |
java-package: 'jdk' | |
- name: Set up cache | |
uses: actions/cache@v2 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ matrix.projects }}-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven-${{ matrix.projects }}- | |
- name: Build the project | |
working-directory: ${{ matrix.projects }} | |
run: ./mvnw -B verify | |
- name: Log test output on failure | |
if: failure() || cancelled() | |
run: find . -type f -path "*test-reports/*-output.txt" -exec tail -n +1 {} + | |
run-performance-tests: | |
runs-on: ubuntu-20.04 | |
name: performance-tests | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: 11.0 | |
distribution: 'adopt' | |
java-package: 'jdk' | |
- name: Set up cache | |
uses: actions/cache@v2 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-gatling-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven-gatling- | |
- name: Start the infrastructure | |
run: docker-compose --file spring-boot-example/docker-compose.yml up -d | |
- name: Run Gatling performance tests | |
run: | | |
mvn --file spring-boot-example/pom.xml -B spring-boot:run & | |
mvn --file spring-boot-example/pom.xml -B gatling:test | |
- name: Run ApacheBench performance tests | |
run: | | |
mvn --file spring-boot-example/pom.xml -B spring-boot:run & | |
ab -p spring-boot-example/src/test/resources/apachebench/create-customer-request.json -T application/json -c 10 -n 1000 http://localhost:8080/api/customers |