Update flyway to v11.20.2 #2992
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: build | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout the repository | |
| uses: actions/checkout@v6 | |
| with: | |
| # Fetch tags to allow constructing version string | |
| fetch-depth: 0 | |
| - name: Setup Java | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: adopt | |
| java-version: 21 | |
| - name: Set version | |
| run: | | |
| echo "VERSION=$(./scripts/version.sh)" >> $GITHUB_ENV | |
| - name: Build and test | |
| uses: burrunan/gradle-cache-action@v3 | |
| with: | |
| concurrent: true | |
| arguments: | | |
| build | |
| --info | |
| - name: Add coverage report to PR | |
| if: ${{ github.event_name == 'pull_request' }} | |
| uses: madrapps/jacoco-report@v1.6 | |
| continue-on-error: true # Commenting doesn't work from forked PRs, because those have no access to secrets | |
| with: | |
| title: Unit and integration test coverage | |
| update-comment: true | |
| paths: ${{ github.workspace }}/server/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| min-coverage-overall: 78 # Current coverage | |
| min-coverage-changed-files: 80 # Okay target for now | |
| - name: Add feature test coverage report to PR | |
| if: ${{ github.event_name == 'pull_request' }} | |
| uses: madrapps/jacoco-report@v1.6 | |
| continue-on-error: true | |
| with: | |
| title: Feature test coverage | |
| update-comment: true | |
| paths: ${{ github.workspace }}/build/reports/jacoco/featureTestReport/featureTestReport.xml | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| min-coverage-overall: 75 | |
| min-coverage-changed-files: 80 | |
| - name: Save test results | |
| if: always() | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: test results | |
| path: "**/build/reports/tests/test/" | |
| - name: Save coverage reports | |
| if: always() | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: coverage | |
| path: "build/reports/jacoco" | |
| - name: Save swagger ui | |
| if: always() | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: swagger ui | |
| path: api-doc/build/swagger-ui | |
| - name: Output docker image | |
| run: | | |
| docker image save vauhtijuoksu/vauhtijuoksu-api:${{ env.VERSION }} -o vauhtijuoksu-api.tar | |
| - name: Save Docker image | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: vauhtijuosu-api.tar | |
| path: vauhtijuoksu-api.tar | |
| publish: | |
| if: github.ref == 'refs/heads/main' && vars.DEPLOY_TO_PROD == 'true' | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| packages: write | |
| steps: | |
| - name: Checkout the repository | |
| uses: actions/checkout@v6 | |
| with: | |
| # Fetch tags to allow constructing version string | |
| fetch-depth: 0 | |
| - name: Set version | |
| run: | | |
| echo "VERSION=$(./scripts/version.sh)" >> $GITHUB_ENV | |
| - name: Login to to Tailscale | |
| uses: tailscale/github-action@v4 | |
| with: | |
| oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }} | |
| oauth-secret: ${{ secrets.TS_OAUTH_SECRET }} | |
| tags: tag:gh-runner | |
| use-cache: 'true' | |
| - name: Setup Kubectl | |
| uses: azure/setup-kubectl@v4 | |
| - name: Setup kubeconfig | |
| run: | | |
| mkdir ~/.kube | |
| echo "${{ vars.KUBECONFIG }}" > ~/.kube/config | |
| kubectl get all | |
| - uses: actions/download-artifact@v6 | |
| with: | |
| name: vauhtijuosu-api.tar | |
| path: . | |
| - run: | | |
| docker load --input vauhtijuoksu-api.tar | |
| - name: Log in to GHCR | |
| run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
| - name: Push docker image to GHCR | |
| run: | | |
| docker tag vauhtijuoksu/vauhtijuoksu-api:${{ env.VERSION }} ghcr.io/vauhtijuoksu/vauhtijuoksu-api:${{ env.VERSION }} | |
| docker push ghcr.io/vauhtijuoksu/vauhtijuoksu-api:${{ env.VERSION }} | |
| - uses: azure/setup-helm@v3.5 | |
| id: install | |
| - name: Deploy mock server to AKS | |
| run: | | |
| helm upgrade --install mockserver deployment/mockserver -n vauhtijuoksu-api --create-namespace | |
| - name: Deploy Redis to AKS | |
| run: | | |
| kubectl delete secret vauhtijuoksu-api-redis --ignore-not-found -n vauhtijuoksu-api | |
| kubectl create secret generic vauhtijuoksu-api-redis --from-literal=REDIS__PASSWORD=${{ secrets.REDIS_PASSWORD }} -n vauhtijuoksu-api | |
| helm repo add valkey https://valkey.io/valkey-helm/ | |
| helm repo update | |
| helm upgrade --install valkey valkey/valkey -n vauhtijuoksu-api --create-namespace | |
| - name: Deploy API server to AKS | |
| run: | | |
| helm upgrade --install vauhtijuoksu-api deployment/api-server \ | |
| -n vauhtijuoksu-api --create-namespace \ | |
| --set database.address=${{ secrets.DATABASE_ADDRESS }} \ | |
| --set database.user=${{ secrets.DATABASE_USERNAME }} \ | |
| --set database.database=${{ secrets.DATABASE_DATABASE }} \ | |
| --set ingress=traefik \ | |
| --set image.tag=${{ env.VERSION }} |