feat: add GET, PUT and DELETE endpoints to PetController #40
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: CI Pipeline | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # 1. Hämta koden | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| # 2. Installera Java | |
| - name: Set up JDK | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '25' | |
| # 3. Cache (snabbar upp builds) | |
| - name: Cache Maven dependencies | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.m2 | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven | |
| # 4. Build + Test | |
| - name: Build and run tests | |
| run: mvn clean verify | |
| env: | |
| SPRING_DATASOURCE_URL: ${{ secrets.DB_URL }} | |
| SPRING_DATASOURCE_USERNAME: ${{ secrets.DB_USER }} | |
| SPRING_DATASOURCE_PASSWORD: ${{ secrets.DB_PASSWORD }} | |
| MINIO_ACCESS_KEY: ${{ secrets.MINIO_ACCESS_KEY }} | |
| MINIO_SECRET_KEY: ${{ secrets.MINIO_SECRET_KEY }} | |
| # 5. Upload artifact (ONLY on main) | |
| - name: Upload JAR artifact | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: app-${{ github.ref_name }}-${{ github.run_number }}-${{ github.sha }} | |
| path: target/*.jar |