Skip to content

Update flyway/flyway Docker tag to v10.8 #759

Update flyway/flyway Docker tag to v10.8

Update flyway/flyway Docker tag to v10.8 #759

Workflow file for this run

name: Workflow
on:
push:
branches: [ main ]
pull_request: { }
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v4
- uses: asdf-vm/actions/install@v3
- name: Get dependencies
run: dart pub get
- name: Run code generation
run: dart run build_runner build
- name: Run tests
run: dart test
check-format:
name: Check Format
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v4
- uses: asdf-vm/actions/install@v3
- name: Check bin formatting
run: dart format bin --set-exit-if-changed
- name: Check lib formatting
run: dart format lib --set-exit-if-changed
- name: Check test formatting
run: dart format test --set-exit-if-changed
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v4
- uses: asdf-vm/actions/install@v3
- name: Get dependencies
run: dart pub get
- name: Run code generation
run: dart run build_runner build
- name: Run Analysis
run: dart analyze --fatal-infos
validate-migrations:
name: Validate Migrations
runs-on: ubuntu-latest
container: flyway/flyway:10.8
services:
postgres:
image: postgres:15-alpine
env:
POSTGRES_USER: woog
POSTGRES_PASSWORD: woogci
POSTGRES_DB: woog
steps:
- uses: actions/checkout@v4
- name: Check migration naming
working-directory: migrations/sql
run: |
for filename in *
do
pattern='^V[0-9]+__([A-Z][a-z]*)+\.sql$'
match=$(echo -n "$filename" | grep -E $pattern)
if [ ! "$match" ]
then
echo "Invalid migration file name: $filename" 1>&2
exit 1
fi
done
- run: flyway migrate
working-directory: migrations
env:
flyway_environment: ci
build-app-container-image:
needs:
- check-format
- lint
- test
uses: BlindfoldedSurgery/actions-container/.github/workflows/build-image-docker.yml@v3
with:
push-image: ${{ github.ref_name == github.event.repository.default_branch }}
image-name: api/app
build-migrations-container-image:
needs:
- check-format
- lint
- test
- validate-migrations
uses: BlindfoldedSurgery/actions-container/.github/workflows/build-image-docker.yml@v3
with:
push-image: ${{ github.ref_name == github.event.repository.default_branch }}
image-name: api/migrations
context: "{{defaultContext}}:migrations"
deploy:
runs-on: ubuntu-latest
if: success() && github.ref_name == github.event.repository.default_branch
needs:
- build-app-container-image
- build-migrations-container-image
concurrency: production
steps:
- uses: actions/checkout@v4
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4
- name: Substitute environment variables in values.yaml
run: "envsubst < values.yaml > values_sub.yaml && mv values_sub.yaml values.yaml"
env:
APP_IMAGE_NAME: "ghcr.io/${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG }}/${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG }}/app"
MIGRATIONS_IMAGE_NAME: "ghcr.io/${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG }}/${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG }}/migrations"
OTEL_EXPORTER_OTLP_ENDPOINT: ${{ secrets.OTEL_EXPORTER_OTLP_ENDPOINT }}
OTEL_EXPORTER_OTLP_HEADERS: ${{ secrets.OTEL_EXPORTER_OTLP_HEADERS }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
- uses: WyriHaximus/github-action-helm3@v3
with:
exec: helm upgrade backend . --install --namespace=wooglife --atomic
kubeconfig: '${{ secrets.KUBECONFIG_RAW }}'
clean:
strategy:
matrix:
image-name: [ "api/app", "api/migrations" ]
concurrency: cleanup
needs: [ deploy ]
uses: BlindfoldedSurgery/actions-container/.github/workflows/clean.yml@v3
with:
image-name: ${{ matrix.image-name }}
continue-on-error: true