fixed github action issues #2
This file contains hidden or 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 Site & Integration Tests | |
| on: | |
| push: | |
| branches: | |
| - '**' | |
| schedule: | |
| - cron: '0 18-23/2 * * *' | |
| - cron: '0 0-6/2 * * *' | |
| workflow_dispatch: | |
| # Required so github-actions[bot] can push to gh-pages | |
| permissions: | |
| contents: write | |
| 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 | |
| - name: Deploy Maven site & Doxygen to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./docs | |
| destination_dir: . | |
| keep_files: true |