Build & Test Maven Project #3886
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 & Test Maven Project | |
on: | |
push: | |
schedule: | |
- cron: '0 15 * * *' # daily at 3pm | |
jobs: | |
build-and-test: | |
timeout-minutes: 20 | |
runs-on: ubuntu-22.04 | |
name: Build Application | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Setup for JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 21 | |
java-package: jdk | |
cache: maven | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
cache: npm | |
cache-dependency-path: src/frontend/package-lock.json | |
- name: Run all web tests | |
# Testcontainers Cloud currently doesn't support Docker Compose usage | |
uses: nick-fields/retry@v3 | |
with: | |
timeout_minutes: 15 | |
max_attempts: 3 | |
command: ./mvnw verify --no-transfer-progress -Pwebtests | |
- name: Setup Testcontainers Cloud client | |
if: github.ref == 'refs/heads/main' | |
uses: atomicjar/testcontainers-cloud-setup-action@v1 | |
with: | |
token: ${{ secrets.TC_CLOUD_TOKEN }} | |
logfile: testcontainers-client.log | |
- name: Run all unit and integration tests | |
timeout-minutes: 15 | |
continue-on-error: true | |
run: ./mvnw verify --no-transfer-progress -Dskip.installnodenpm -Dskip.npm -PnoWebtests | |
- name: Flatten Selenide Screenshots and HTML source code on failure | |
if: ${{ failure() }} | |
working-directory: target | |
env: | |
SOURCE_FOLDER: selenide-screenshots | |
DESTINATION_FOLDER: aggregated-outcome | |
run: | | |
mkdir "$DESTINATION_FOLDER" | |
if [ -d "$SOURCE_FOLDER" ]; then | |
find "$SOURCE_FOLDER" -type f -name '*.png' -exec mv -i {} "$DESTINATION_FOLDER" \; | |
find "$SOURCE_FOLDER" -type f -name '*.html' -exec mv -i {} "$DESTINATION_FOLDER" \; | |
else | |
echo "No Selenide failure artifacts found in folder $SOURCE_FOLDER" | |
fi | |
- name: Archive Selenide outcome on failure | |
uses: actions/upload-artifact@v4 | |
if: ${{ failure() }} | |
with: | |
name: selenide-failure-captures | |
path: target/aggregated-outcome | |
- name: Upload Testcontainers Cloud output file | |
uses: actions/upload-artifact@v4 | |
if: github.ref == 'refs/heads/main' | |
with: | |
name: testcontainers-cloud-log-file | |
path: testcontainers-client.log | |
retention-days: 7 |