Skip to content

Build & Test Maven Project #2806

Build & Test Maven Project

Build & Test Maven Project #2806

Workflow file for this run

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@v3
- name: Setup for JDK 17
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
java-package: jdk
cache: maven
- name: Setup Node 16
uses: actions/setup-node@v3
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@v2
with:
timeout_minutes: 15
max_attempts: 3
command: ./mvnw verify --no-transfer-progress -Pwebtests
- name: Setup Testcontainers Cloud client
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@v3
if: ${{ failure() }}
with:
name: selenide-failure-captures
path: target/aggregated-outcome
- name: Upload Testcontainers Cloud output file
uses: actions/upload-artifact@v3
if: always()
with:
name: testcontainers-cloud-log-file
path: testcontainers-client.log
retention-days: 30
- name: Get Allure history
uses: actions/checkout@v3
if: always()
continue-on-error: true
with:
ref: gh-pages
path: gh-pages
- name: Allure Report action from marketplace
uses: simple-elf/allure-report-action@master
if: always()
id: allure-report
with:
allure_results: target/allure-results
gh_pages: gh-pages
allure_report: allure-report
allure_history: allure-history
- name: Deploy report to Github Pages
if: always()
uses: peaceiris/actions-gh-pages@v2
env:
PERSONAL_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: allure-history