Update flyway to v10.22.0 #2169
This file contains 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@v4 | |
with: | |
# Fetch tags to allow constructing version string | |
fetch-depth: 0 | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: adopt | |
java-version: 21 | |
- name: Install a newer curl | |
# Integration tests utilize --retry-all-errors, which is added in curl 7.71.0 | |
run: | | |
curl -vL https://github.com/moparisthebest/static-curl/releases/download/v7.78.0/curl-amd64 -o /tmp/curl | |
sudo install /tmp/curl /usr/local/bin/curl | |
echo "/usr/local/bin" >> $GITHUB_PATH | |
- name: Set version | |
run: | | |
echo "VERSION=$(./scripts/version.sh)" >> $GITHUB_ENV | |
- name: Setup Gradle | |
uses: gradle/actions/[email protected] | |
- name: Build and test | |
run: ./gradlew build --info | |
- name: Add coverage report to PR | |
if: ${{ github.event_name == 'pull_request' }} | |
uses: madrapps/[email protected] | |
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/[email protected] | |
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@v4 | |
with: | |
name: test results | |
path: "**/build/reports/tests/test/" | |
- name: Save coverage reports | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage | |
path: "build/reports/jacoco" | |
- name: Save swagger ui | |
if: always() | |
uses: actions/upload-artifact@v4 | |
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@v4 | |
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 | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v4 | |
with: | |
# Fetch tags to allow constructing version string | |
fetch-depth: 0 | |
- name: Set version | |
run: | | |
echo "VERSION=$(./scripts/version.sh)" >> $GITHUB_ENV | |
- uses: actions/download-artifact@v4 | |
with: | |
name: swagger ui | |
path: swagger-ui | |
- uses: azure/login@v2 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
- name: Upload rendered specification to Azure | |
run: | | |
az storage blob upload-batch -s swagger-ui -d '$web' --account-name vauhtijuoksu --overwrite | |
- uses: actions/download-artifact@v4 | |
with: | |
name: vauhtijuosu-api.tar | |
path: . | |
- run: | | |
docker load --input vauhtijuoksu-api.tar | |
- uses: azure/docker-login@v1 | |
with: | |
login-server: vauhtijuoksu.azurecr.io | |
username: ${{ secrets.ACR_USERNAME }} | |
password: ${{ secrets.ACR_PASSWORD }} | |
- name: Push docker image to ACR | |
run: | | |
docker tag vauhtijuoksu/vauhtijuoksu-api:${{ env.VERSION }} vauhtijuoksu.azurecr.io/vauhtijuoksu/vauhtijuoksu-api:${{ env.VERSION }} | |
docker push vauhtijuoksu.azurecr.io/vauhtijuoksu/vauhtijuoksu-api:${{ env.VERSION }} | |
- uses: azure/[email protected] | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
cluster-name: vauhtijuoksu | |
resource-group: Vauhtijuoksu-Azure-Sponsorship | |
- uses: azure/[email protected] | |
id: install | |
- name: Deploy mock server to AKS | |
run: | | |
helm upgrade --install mockserver deployment/mockserver | |
- name: Deploy Redis to AKS | |
run: | | |
kubectl delete secret vauhtijuoksu-api-redis --ignore-not-found | |
kubectl create secret generic vauhtijuoksu-api-redis --from-literal=REDIS__PASSWORD=${{ secrets.REDIS_PASSWORD }} | |
helm upgrade --install redis oci://registry-1.docker.io/bitnamicharts/redis \ | |
--set architecture=standalone \ | |
--set auth.existingSecret=vauhtijuoksu-api-redis \ | |
--set auth.existingSecretPasswordKey=REDIS__PASSWORD \ | |
--version 18.1.5 | |
- name: Deploy API server to AKS | |
run: | | |
helm upgrade --install vauhtijuoksu-api deployment/api-server \ | |
--set database.address=${{ secrets.DATABASE_ADDRESS }} \ | |
--set database.user=${{ secrets.DATABASE_USERNAME }} \ | |
--set database.database=${{ secrets.DATABASE_DATABASE }} \ | |
--set image.tag=${{ env.VERSION }} |