Files
mostlymatter/.github/workflows/migration.yml
2023-08-16 10:09:11 +03:00

60 строки
2.1 KiB
YAML

name: Database Migration Test
on:
workflow_call:
jobs:
test:
name: MySQL -> Postgres Migration
runs-on: ubuntu-22.04
env:
COMPOSE_PROJECT_NAME: ghactions
BUILD_IMAGE: mattermost/mattermost-build-server:20230118_golang-1.19.5
TEST_IMAGE: migration-test-image
defaults:
run:
working-directory: server
steps:
- name: Checkout mattermost project
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Run docker compose
run: |
cd build
docker-compose --ansi never run --rm start_dependencies
docker-compose --ansi never exec -T minio sh -c 'mkdir -p /data/mattermost-test';
docker-compose --ansi never ps
- name: Build test image
run: |
echo -e "FROM $BUILD_IMAGE\n\nRUN apt update && apt install -y pgloader" >> dockerfile_tmp
docker build -t $TEST_IMAGE - < dockerfile_tmp
- name: Generate test-data
run: |
docker run --net ${COMPOSE_PROJECT_NAME}_mm-test \
--ulimit nofile=8096:8096 \
--env-file=build/dotenv/migration.env \
-v $(go env GOCACHE):/go/cache \
-e GOCACHE=/go/cache \
-v $PWD:/mattermost \
-w /mattermost \
$TEST_IMAGE \
make test-data
- name: Migrate the DB and compare
run: |
docker run --net ${COMPOSE_PROJECT_NAME}_mm-test \
--ulimit nofile=8096:8096 \
--env-file=build/dotenv/migration.env \
-v $(go env GOCACHE):/go/cache \
-e GOCACHE=/go/cache \
-v $PWD:/mattermost \
-w /mattermost \
$TEST_IMAGE \
make test-migration
- name: Upload artifacts
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: Migration logs
path: server/migration.log
retention-days: 7
- name: Stop docker compose
run: |
cd build
docker-compose --ansi never stop