Skip to content

Rename drift-report inputs to pre-deployment-report #533

Rename drift-report inputs to pre-deployment-report

Rename drift-report inputs to pre-deployment-report #533

Workflow file for this run

name: End-to-End Tests
on:
schedule:
- cron: '0 3 * * 1-5'
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
REDGATE_DISABLE_TELEMETRY: 'true'
jobs:
migrations-enterprise:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
permissions:
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Retrieve secrets from Vault
uses: hashicorp/vault-action@v3.4.0
with:
method: jwt
path: ${{ vars.VAULT_AUTH_PATH }}
url: ${{ vars.VAULT_URL }}
role: "flyway-actions"
secrets: |
build-secrets/data/repos/red-gate/flyway-actions/flyway FLYWAY_PERMIT_ENTERPRISE | FLYWAY_PERMIT_ENTERPRISE;
- name: Setup Flyway
uses: red-gate/setup-flyway@v3
env:
REDGATE_LICENSING_PERMIT: ${{ env.FLYWAY_PERMIT_ENTERPRISE }}
with:
edition: enterprise
i-agree-to-the-eula: true
- name: Run checks
id: checks
uses: ./migrations/checks
env:
REDGATE_LICENSING_PERMIT: ${{ env.FLYWAY_PERMIT_ENTERPRISE }}
with:
target-url: jdbc:sqlite:database/no-drift.db
build-url: jdbc:sqlite:database/build.db
build-ok-to-erase: 'true'
fail-on-code-review: 'false'
working-directory: sample-projects/sqlite
pre-deployment-report-name: flyway-pre-deployment-report-${{ matrix.os }}
pre-deployment-report-retention-days: '1'
- name: Run deploy
id: deploy
uses: ./migrations/deploy
env:
REDGATE_LICENSING_PERMIT: ${{ env.FLYWAY_PERMIT_ENTERPRISE }}
with:
target-url: jdbc:sqlite:database/no-drift.db
working-directory: sample-projects/sqlite
- name: Run undo
id: undo
uses: ./migrations/undo
env:
REDGATE_LICENSING_PERMIT: ${{ env.FLYWAY_PERMIT_ENTERPRISE }}
with:
target-url: jdbc:sqlite:database/no-drift.db
working-directory: sample-projects/sqlite
- name: Download report
uses: actions/download-artifact@v8
with:
name: flyway-pre-deployment-report-${{ matrix.os }}.html
- name: Verify report exists
shell: bash
run: test -s flyway-pre-deployment-report-${{ matrix.os }}.html
- name: Test outputs
shell: bash
run: |
set -euo pipefail
echo "Checks exit code: ${{ steps.checks.outputs.exit-code }}"
echo "Checks drift detected: ${{ steps.checks.outputs.drift-detected }}"
echo "Changed object count: ${{ steps.checks.outputs.changed-object-count }}"
echo "Code violation count: ${{ steps.checks.outputs.code-violation-count }}"
echo "Code violation codes: ${{ steps.checks.outputs.code-violation-codes }}"
echo "Deploy exit code: ${{ steps.deploy.outputs.exit-code }}"
echo "Deploy drift detected: ${{ steps.deploy.outputs.drift-detected }}"
echo "Migrations applied: ${{ steps.deploy.outputs.migrations-applied }}"
echo "Schema version: ${{ steps.deploy.outputs.schema-version }}"
echo "Undo exit code: ${{ steps.undo.outputs.exit-code }}"
echo "Undo drift detected: ${{ steps.undo.outputs.drift-detected }}"
echo "Migrations undone: ${{ steps.undo.outputs.migrations-undone }}"
echo "Undo schema version: ${{ steps.undo.outputs.schema-version }}"
test "${{ steps.checks.outputs.exit-code }}" = "0"
test "${{ steps.checks.outputs.drift-detected }}" = "false"
test "${{ steps.checks.outputs.changed-object-count }}" = "2"
test "${{ steps.checks.outputs.code-violation-count }}" = "1"
test "${{ steps.checks.outputs.code-violation-codes }}" = "AM04"
test "${{ steps.deploy.outputs.exit-code }}" = "0"
test "${{ steps.deploy.outputs.drift-detected }}" = "false"
test "${{ steps.deploy.outputs.migrations-applied }}" = "3"
test "${{ steps.deploy.outputs.schema-version }}" = "3"
test "${{ steps.undo.outputs.exit-code }}" = "0"
test "${{ steps.undo.outputs.drift-detected }}" = "false"
test "${{ steps.undo.outputs.migrations-undone }}" = "1"
test "${{ steps.undo.outputs.schema-version }}" = "2"
migrations-enterprise-no-comparison-support:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
permissions:
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Retrieve secrets from Vault
uses: hashicorp/vault-action@v3.4.0
with:
method: jwt
path: ${{ vars.VAULT_AUTH_PATH }}
url: ${{ vars.VAULT_URL }}
role: "flyway-actions"
secrets: |
build-secrets/data/repos/red-gate/flyway-actions/flyway FLYWAY_PERMIT_ENTERPRISE | FLYWAY_PERMIT_ENTERPRISE;
- name: Setup Flyway
uses: red-gate/setup-flyway@v3
env:
REDGATE_LICENSING_PERMIT: ${{ env.FLYWAY_PERMIT_ENTERPRISE }}
with:
edition: enterprise
i-agree-to-the-eula: true
- name: Run checks
id: checks
uses: ./migrations/checks
env:
REDGATE_LICENSING_PERMIT: ${{ env.FLYWAY_PERMIT_ENTERPRISE }}
with:
target-url: jdbc:h2:./database/h2-prod
build-url: jdbc:h2:mem:build
build-ok-to-erase: 'true'
fail-on-code-review: 'false'
working-directory: sample-projects/h2
pre-deployment-report-name: flyway-pre-deployment-report-h2-${{ matrix.os }}
pre-deployment-report-retention-days: '1'
- name: Run deploy
id: deploy
uses: ./migrations/deploy
env:
REDGATE_LICENSING_PERMIT: ${{ env.FLYWAY_PERMIT_ENTERPRISE }}
with:
target-url: jdbc:h2:./database/h2-prod
working-directory: sample-projects/h2
- name: Run undo
id: undo
uses: ./migrations/undo
env:
REDGATE_LICENSING_PERMIT: ${{ env.FLYWAY_PERMIT_ENTERPRISE }}
with:
target-url: jdbc:h2:./database/h2-prod
working-directory: sample-projects/h2
- name: Download report
uses: actions/download-artifact@v8
with:
name: flyway-pre-deployment-report-h2-${{ matrix.os }}.html
- name: Verify report exists
shell: bash
run: test -s flyway-pre-deployment-report-h2-${{ matrix.os }}.html
- name: Test outputs
shell: bash
run: |
set -euo pipefail
echo "Checks exit code: ${{ steps.checks.outputs.exit-code }}"
echo "Checks drift detected: ${{ steps.checks.outputs.drift-detected }}"
echo "Changed object count: ${{ steps.checks.outputs.changed-object-count }}"
echo "Code violation count: ${{ steps.checks.outputs.code-violation-count }}"
echo "Code violation codes: ${{ steps.checks.outputs.code-violation-codes }}"
echo "Deploy exit code: ${{ steps.deploy.outputs.exit-code }}"
echo "Deploy drift detected: ${{ steps.deploy.outputs.drift-detected }}"
echo "Migrations applied: ${{ steps.deploy.outputs.migrations-applied }}"
echo "Schema version: ${{ steps.deploy.outputs.schema-version }}"
echo "Undo exit code: ${{ steps.undo.outputs.exit-code }}"
echo "Undo drift detected: ${{ steps.undo.outputs.drift-detected }}"
echo "Migrations undone: ${{ steps.undo.outputs.migrations-undone }}"
echo "Undo schema version: ${{ steps.undo.outputs.schema-version }}"
test "${{ steps.checks.outputs.exit-code }}" = "0"
test "${{ steps.checks.outputs.drift-detected }}" = ""
test "${{ steps.checks.outputs.changed-object-count }}" = ""
test "${{ steps.checks.outputs.code-violation-count }}" = "0"
test "${{ steps.checks.outputs.code-violation-codes }}" = ""
test "${{ steps.deploy.outputs.exit-code }}" = "0"
test "${{ steps.deploy.outputs.drift-detected }}" = ""
test "${{ steps.deploy.outputs.migrations-applied }}" = "3"
test "${{ steps.deploy.outputs.schema-version }}" = "3"
test "${{ steps.undo.outputs.exit-code }}" = "0"
test "${{ steps.undo.outputs.drift-detected }}" = ""
test "${{ steps.undo.outputs.migrations-undone }}" = "1"
test "${{ steps.undo.outputs.schema-version }}" = "2"
migrations-community:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Flyway
uses: red-gate/setup-flyway@v3
with:
edition: community
i-agree-to-the-eula: true
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.x'
- name: Install SQLFluff
run: pip install sqlfluff
- name: Run checks
id: checks
uses: ./migrations/checks
with:
target-url: jdbc:sqlite:database/no-drift.db
fail-on-code-review: 'false'
working-directory: sample-projects/sqlite
pre-deployment-report-name: flyway-community-pre-deployment-report-${{ matrix.os }}
pre-deployment-report-retention-days: '1'
- name: Run deploy
id: deploy
uses: ./migrations/deploy
with:
target-url: jdbc:sqlite:database/no-drift.db
working-directory: sample-projects/sqlite
- name: Test outputs
shell: bash
run: |
set -euo pipefail
echo "Checks exit code: ${{ steps.checks.outputs.exit-code }}"
echo "Code violation count: ${{ steps.checks.outputs.code-violation-count }}"
echo "Code violation codes: ${{ steps.checks.outputs.code-violation-codes }}"
echo "Deploy exit code: ${{ steps.deploy.outputs.exit-code }}"
echo "Migrations applied: ${{ steps.deploy.outputs.migrations-applied }}"
echo "Schema version: ${{ steps.deploy.outputs.schema-version }}"
test "${{ steps.checks.outputs.exit-code }}" = "0"
test "${{ steps.checks.outputs.code-violation-count }}" = "1"
test "${{ steps.checks.outputs.code-violation-codes }}" = "AM04"
test "${{ steps.deploy.outputs.exit-code }}" = "0"
test "${{ steps.deploy.outputs.migrations-applied }}" = "3"
test "${{ steps.deploy.outputs.schema-version }}" = "3"
state-enterprise:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
permissions:
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Retrieve secrets from Vault
uses: hashicorp/vault-action@v3.4.0
with:
method: jwt
path: ${{ vars.VAULT_AUTH_PATH }}
url: ${{ vars.VAULT_URL }}
role: "flyway-actions"
secrets: |
build-secrets/data/repos/red-gate/flyway-actions/flyway FLYWAY_PERMIT_ENTERPRISE | FLYWAY_PERMIT_ENTERPRISE;
- name: Setup Flyway
uses: red-gate/setup-flyway@v3
env:
REDGATE_LICENSING_PERMIT: ${{ env.FLYWAY_PERMIT_ENTERPRISE }}
with:
edition: enterprise
i-agree-to-the-eula: true
- name: Run state prepare
id: prepare
uses: ./state/prepare
env:
REDGATE_LICENSING_PERMIT: ${{ env.FLYWAY_PERMIT_ENTERPRISE }}
with:
target-url: jdbc:sqlite:state-prepare-target.db
working-directory: sample-projects/sqlite-state
fail-on-code-review: 'false'
- name: Run state deploy
id: deploy
uses: ./state/deploy
env:
REDGATE_LICENSING_PERMIT: ${{ env.FLYWAY_PERMIT_ENTERPRISE }}
with:
target-url: jdbc:sqlite:state-prepare-target.db
working-directory: sample-projects/sqlite-state
- name: Test outputs
shell: bash
run: |
set -euo pipefail
echo "Prepare exit code: ${{ steps.prepare.outputs.exit-code }}"
echo "Script path: ${{ steps.prepare.outputs.script-path }}"
echo "Undo script path: ${{ steps.prepare.outputs.undo-script-path }}"
echo "Deploy exit code: ${{ steps.deploy.outputs.exit-code }}"
test "${{ steps.prepare.outputs.exit-code }}" = "0"
[[ "${{ steps.prepare.outputs.script-path }}" == *D__deployment.sql ]]
[[ "${{ steps.prepare.outputs.undo-script-path }}" == *DU__undo.sql ]]
test "${{ steps.deploy.outputs.exit-code }}" = "0"