Run API Tests #31
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: Run API Tests | |
| on: | |
| push: | |
| branches: | |
| - main | |
| schedule: | |
| - cron: '0 0 * * 5' | |
| permissions: | |
| contents: write | |
| pages: write | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Cache Maven packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-m2- | |
| - name: Build and test | |
| run: mvn clean test | |
| env: | |
| # Database Configuration | |
| DB_USERNAME: sa | |
| DB_PASSWORD: ci_test_password_123 | |
| # H2 Console Configuration (disabled for CI) | |
| H2_CONSOLE_ENABLED: false | |
| # Logging Configuration | |
| LOG_LEVEL: INFO | |
| SPRING_WEB_LOG_LEVEL: WARN | |
| HIBERNATE_SQL_LOG_LEVEL: WARN | |
| HIBERNATE_BINDER_LOG_LEVEL: WARN | |
| # Management Endpoints Configuration | |
| MANAGEMENT_ENDPOINTS: health | |
| HEALTH_SHOW_DETAILS: when-authorized | |
| - name: Upload Allure Results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: allure-results | |
| path: allure-results/ | |
| - name: Install Allure CLI | |
| run: | | |
| sudo apt-get update && sudo apt-get install -y wget unzip | |
| wget https://github.com/allure-framework/allure2/releases/download/2.27.0/allure-2.27.0.zip | |
| unzip allure-2.27.0.zip -d /opt/ | |
| sudo ln -s /opt/allure-2.27.0/bin/allure /usr/bin/allure | |
| - name: Generate Allure HTML Report | |
| run: | | |
| allure generate allure-results --clean -o allure-report | |
| - name: Upload Allure HTML Report | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: allure-html-report | |
| path: allure-report/ | |
| - name: Deploy Allure HTML Report to GitHub Pages | |
| if: github.event_name == 'schedule' || github.event_name == 'push' | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: allure-report | |
| force_orphan: true |