Skip to content

Maven Site & Integration Tests #458

Maven Site & Integration Tests

Maven Site & Integration Tests #458

name: Maven Site & Integration Tests
on:
push:
branches:
- '**'
schedule:
- cron: '0 18-23/2 * * *'
- cron: '0 0-6/2 * * *'
workflow_dispatch:
permissions:
contents: write
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
build-and-test:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: libraryapidb
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping -h 127.0.0.1 -uroot -proot"
--health-interval=10s
--health-timeout=5s
--health-retries=5
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Cache Maven dependencies
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Wait for MySQL to be ready
run: |
echo "Waiting for MySQL..."
until mysqladmin ping -h 127.0.0.1 -uroot -proot --silent; do
sleep 2
done
- name: Run DB initialization script
run: |
echo "Running DB setup..."
mysql -h 127.0.0.1 -uroot -proot < src/main/resources/dbsetup.sql
- name: Run unit tests with JaCoCo
run: mvn test jacoco:report
- name: Run performance tests
run: mvn -Pperformance integration-test
- name: Copy performance report into site directory
run: mvn -Pperformance resources:copy-resources@copy-perf-report
- name: Run integration tests
run: mvn -Pintegration integration-test
- name: Generate Maven site
run: mvn site
- name: Copy Maven site + Doxygen output into docs/ folder
run: mvn post-site
# Ensure .nojekyll is always present in docs/ before deploying
- name: Ensure .nojekyll exists
run: touch docs/.nojekyll
- name: Ensure Maven does not overwrite the landing page
run: rm -f docs/index.html
- uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs
destination_dir: .
keep_files: true
enable_jekyll: false