[RFC0030 - 2] File-based service bindings app feature #246
Workflow file for this run
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: Backwards Compatibility Unit Tests | |
concurrency: | |
group: '${{ github.workflow }}-${{ github.new_cc_ref || github.run_id }}' | |
cancel-in-progress: true | |
on: | |
workflow_dispatch: | |
description: "This action tests backwards compatibility when db migrations are introduced. It tests database schema at new code(old_cc_ref) with unittests running old code(new_cc_ref) " | |
inputs: | |
old_cc_ref: | |
description: 'Old Version of CC_NG that the backwards compatibility should be checked against' | |
required: true | |
new_cc_ref: | |
description: 'New Version of CC_NG that needs testing for backwards incompatible changes' | |
required: true | |
new_cc_repo: | |
description: 'New REPO of CC_NG that needs testing for backwards incompatible changes' | |
required: false | |
default: 'cloudfoundry/cloud_controller_ng' | |
pull_request: | |
branches: [ main ] | |
paths: | |
- 'db/migrations/**' | |
- '.github/workflows/unit_tests_backwards_compatibility.yml' | |
permissions: | |
contents: read # to fetch code (actions/checkout) | |
jobs: | |
Test-Postgres-Backwards-Compatibillity: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
strategy: | |
fail-fast: false | |
max-parallel: 3 | |
matrix: | |
image: ["postgres:10", "postgres:11", "postgres:16"] | |
services: | |
postgres: | |
image: ${{ matrix.image }} | |
env: | |
POSTGRES_PASSWORD: rootpassword | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- uses: hmarr/debug-action@v3 | |
- name: Checkout code to run the db migration with | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ ( | |
github.event_name == 'workflow_dispatch' | |
&& github.event.inputs.new_cc_ref | |
|| github.event.pull_request.head.ref | |
)}} | |
repository: ${{ ( | |
github.event_name == 'workflow_dispatch' | |
&& github.event.inputs.new_cc_repo | |
|| github.event.pull_request.head.repo.full_name | |
)}} | |
- name: Setup Environment | |
uses: ./.github/workflows/composite/setup | |
- name: Migrate Database | |
run: DB=postgres POSTGRES_CONNECTION_PREFIX="postgres://postgres:rootpassword@localhost:5432" bundle exec rake db:parallel:recreate db:parallel:migrate | |
- name: Checkout code to run the unit tests with | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ ( | |
github.event_name == 'workflow_dispatch' | |
&& github.event.inputs.old_cc_ref | |
|| github.event.pull_request.base.sha | |
)}} | |
- name: Setup Environment | |
uses: ./.github/workflows/composite/setup | |
- name: Run Tests | |
run: DB=postgres POSTGRES_CONNECTION_PREFIX="postgres://postgres:rootpassword@localhost:5432" bundle exec rake spec:without_migrate | |
Test-Mysql-Backwards-Compatibillity: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
strategy: | |
fail-fast: false | |
max-parallel: 3 | |
matrix: | |
image: ["mysql:5.7", "mysql:8.0", "mysql:8.2"] | |
services: | |
mysql: | |
image: ${{ matrix.image }} | |
env: | |
MYSQL_DATABASE: cc_test | |
MYSQL_ROOT_PASSWORD: password | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
ports: | |
- 3306:3306 | |
steps: | |
- uses: hmarr/debug-action@v3 | |
- name: Checkout code to run the db migration with | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ ( | |
github.event_name == 'workflow_dispatch' | |
&& github.event.inputs.new_cc_ref | |
|| github.event.pull_request.head.ref | |
)}} | |
repository: ${{ ( | |
github.event_name == 'workflow_dispatch' | |
&& github.event.inputs.new_cc_repo | |
|| github.event.pull_request.head.repo.full_name | |
)}} | |
- name: Setup Environment | |
uses: ./.github/workflows/composite/setup | |
- name: Migrate Database | |
run: DB=mysql MYSQL_CONNECTION_PREFIX="mysql2://root:[email protected]:3306" bundle exec rake db:parallel:recreate db:parallel:migrate | |
- name: Checkout code to run the unit tests with | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ ( | |
github.event_name == 'workflow_dispatch' | |
&& github.event.inputs.old_cc_ref | |
|| github.event.pull_request.base.sha | |
)}} | |
- name: Setup Environment | |
uses: ./.github/workflows/composite/setup | |
- name: Run tests | |
run: DB=mysql MYSQL_CONNECTION_PREFIX="mysql2://root:[email protected]:3306" bundle exec rake spec:without_migrate |