chore(deps): Update all non-major client dependencies #367
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: Flyway Validation | |
on: | |
pull_request: | |
branches: [staging] | |
workflow_call: {} | |
push: | |
branches: [staging] | |
env: | |
DATASOURCE_URL: jdbc:postgresql://localhost:5432/helios | |
DATASOURCE_USERNAME: helios | |
DATASOURCE_PASSWORD: helios | |
jobs: | |
validate-migrations: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_USER: ${{ env.DATASOURCE_USERNAME }} | |
POSTGRES_PASSWORD: ${{ env.DATASOURCE_PASSWORD }} | |
POSTGRES_DB: helios | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Fetch all branches | |
if: github.event_name == 'pull_request' | |
run: | | |
git fetch origin ${{ github.base_ref }}:refs/remotes/origin/${{ github.base_ref }} | |
git fetch origin ${{ github.head_ref }}:refs/remotes/origin/${{ github.head_ref }} | |
- name: Check for changes | |
id: check_changes | |
if: github.event_name == 'pull_request' | |
run: | | |
CHANGED_PATHS=$(git diff --name-status origin/${{ github.base_ref }} origin/${{ github.head_ref }} | grep -E "server/application-server/src/main/resources/db/migration/" || true) | |
if [[ -z "$CHANGED_PATHS" ]]; then | |
echo "CHANGE_DETECTED=false" >> "$GITHUB_OUTPUT" | |
echo "No Flyway migration changes detected." | |
else | |
echo "CHANGE_DETECTED=true" >> "$GITHUB_OUTPUT" | |
echo "Flyway migration changes detected:" | |
echo "$CHANGED_PATHS" | |
if echo "$CHANGED_PATHS" | grep -q "^[^A]"; then | |
echo "Error: One or more existing migrations were changed." | |
exit 1 | |
else | |
echo "No existing migrations were changed." | |
fi | |
fi | |
- name: Set up Java | |
if: steps.check_changes.outputs.CHANGE_DETECTED == 'true' || github.event_name == 'push' | |
uses: actions/setup-java@v4 | |
with: | |
distribution: "temurin" | |
java-version: "21" | |
- name: Run Gradle to apply Flyway migrations | |
if: steps.check_changes.outputs.CHANGE_DETECTED == 'true' || github.event_name == 'push' | |
working-directory: ./server/application-server | |
run: ./gradlew flywayMigrate | |
- name: Run Gradle to validate Flyway migrations | |
if: steps.check_changes.outputs.CHANGE_DETECTED == 'true' || github.event_name == 'push' | |
working-directory: ./server/application-server | |
run: ./gradlew flywayValidate |