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:20230904_golang-1.20.7 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: 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 \ $BUILD_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 \ $BUILD_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