Files
mostlymatter/.github/workflows/migration.yml
dependabot[bot] 8e03c466ab Bump the github-actions-updates group with 5 updates (#30549)
Bumps the github-actions-updates group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [actions/upload-artifact](https://github.com/actions/upload-artifact) | `4.4.3` | `4.6.2` |
| [github/codeql-action](https://github.com/github/codeql-action) | `3.28.11` | `3.28.12` |
| [actions/download-artifact](https://github.com/actions/download-artifact) | `4.1.8` | `4.2.1` |
| [tj-actions/changed-files](https://github.com/tj-actions/changed-files) | `531f5f7d163941f0c1c04e0ff4d8bb243ac4366f` | `27ae6b33eaed7bf87272fdeb9f1c54f9facc9d99` |
| [getsentry/action-release](https://github.com/getsentry/action-release) | `3.1.0` | `3.1.1` |


Updates `actions/upload-artifact` from 4.4.3 to 4.6.2
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v4.4.3...ea165f8d65b6e75b540449e92b4886f43607fa02)

Updates `github/codeql-action` from 3.28.11 to 3.28.12
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v3.28.11...5f8171a638ada777af81d42b55959a643bb29017)

Updates `actions/download-artifact` from 4.1.8 to 4.2.1
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v4.1.8...95815c38cf2ff2164869cbab79da8d1f422bc89e)

Updates `tj-actions/changed-files` from 531f5f7d163941f0c1c04e0ff4d8bb243ac4366f to 27ae6b33eaed7bf87272fdeb9f1c54f9facc9d99
- [Release notes](https://github.com/tj-actions/changed-files/releases)
- [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md)
- [Commits](531f5f7d16...27ae6b33ea)

Updates `getsentry/action-release` from 3.1.0 to 3.1.1
- [Release notes](https://github.com/getsentry/action-release/releases)
- [Changelog](https://github.com/getsentry/action-release/blob/master/CHANGELOG.md)
- [Commits](fa247637f7...00ed2a6cc2)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions-updates
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions-updates
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions-updates
- dependency-name: tj-actions/changed-files
  dependency-type: direct:production
  dependency-group: github-actions-updates
- dependency-name: getsentry/action-release
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions-updates
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-24 16:22:57 +02:00

78 строки
3.0 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
TEST_IMAGE: migration-test-image
defaults:
run:
working-directory: server
steps:
- name: Checkout mattermost project
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Calculate Golang Version
id: go
working-directory: ./server
run: echo GO_VERSION=$(cat .go-version) >> "${GITHUB_OUTPUT}"
- 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: Fix MySQL user permissions
run: |
cd build
docker exec ${COMPOSE_PROJECT_NAME}-mysql-1 sh -c "sed -i '/# default-authentication-plugin/c\default-authentication-plugin=mysql_native_password' /etc/my.cnf"
docker exec ${COMPOSE_PROJECT_NAME}-mysql-1 sh -c "mysql -u root -pmostest -e \"ALTER USER 'mmuser'@'%' IDENTIFIED WITH mysql_native_password BY 'mostest';\""
docker exec ${COMPOSE_PROJECT_NAME}-mysql-1 sh -c "mysql -u root -pmostest -e \"ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'mostest';\""
docker restart ${COMPOSE_PROJECT_NAME}-mysql-1 && sleep 10
- name: Build test image
env:
BUILD_IMAGE: golang:${{ steps.go.outputs.GO_VERSION }}-bookworm
PGLOADER_IMAGE: mattermost/mattermost-pgloader:v3.6.9
run: |
docker build -t $TEST_IMAGE - <<EOF
FROM $PGLOADER_IMAGE AS pgloader
FROM $BUILD_IMAGE
COPY --from=pgloader /usr/bin/pgloader /usr/bin/pgloader
EOF
# Print out installed pgloader version
docker run --rm $TEST_IMAGE pgloader --version
- 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@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: Migration logs
path: server/migration.log
retention-days: 7
- name: Stop docker compose
run: |
cd build
docker compose --ansi never stop