Skip to content

DEV: Add transformers for customizing post users popup display names … #1

DEV: Add transformers for customizing post users popup display names …

DEV: Add transformers for customizing post users popup display names … #1

name: Migration Tests
on:
pull_request:
paths:
- ".github/workflows/migration-tests.yml"
- "migrations/**"
push:
branches:
- main
- stable
paths:
- ".github/workflows/migration-tests.yml"
- "migrations/**"
concurrency:
group: migration-tests-${{ format('{0}-{1}', github.head_ref || github.run_number, github.job) }}
cancel-in-progress: true
permissions:
contents: read
jobs:
gems:
if: github.event_name == 'pull_request' || github.repository != 'discourse/discourse-private-mirror'
name: Gems
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 1
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.4"
- name: RSpec (isolated, no Rails)
run: |
for gem in core tooling converters importer; do
echo "== migrations-$gem =="
(cd "migrations/$gem" && bundle install --jobs $(($(nproc) - 1)) && bundle exec rspec --tag ~rails)
done
- name: Converter coverage (no Rails)
run: |
bundle config set --local with migrations
bundle install --jobs $(($(nproc) - 1))
# Fails if the reference (Discourse) converter leaves an IntermediateDB
# column unwritten, or writes columns or models that don't exist in the
# schema. Runs without Rails or a source database.
migrations/bin/disco check coverage
tests:
if: github.event_name == 'pull_request' || github.repository != 'discourse/discourse-private-mirror'
name: Tests
runs-on: ${{ (github.repository_owner == 'discourse' && 'cdck-linux-8-core') || 'ubuntu-latest' }}
container: discourse/discourse_test:release
timeout-minutes: 20
env:
RAILS_ENV: test
PGUSER: discourse
PGPASSWORD: discourse
LOAD_PLUGINS: 1
steps:
- name: Set working directory owner
run: chown root:root .
- uses: actions/checkout@v6
with:
fetch-depth: 1
- name: Setup Git
run: |
git config --global user.email "ci@ci.invalid"
git config --global user.name "Discourse CI"
- name: Start redis
run: |
redis-server /etc/redis/redis.conf &
- name: Start Postgres
run: |
chown -R postgres /var/run/postgresql
sudo -E -u postgres script/start_test_db.rb
sudo -u postgres psql -c "CREATE ROLE $PGUSER LOGIN SUPERUSER PASSWORD '$PGPASSWORD';"
- name: Symlink vendor/bundle from image
run: |
ln -s /var/www/discourse/vendor/bundle vendor/bundle
- name: Setup gems
run: |
bundle config --local path vendor/bundle
bundle config --local deployment true
bundle config --local without development
bundle config --local with migrations
bundle install --jobs $(($(nproc) - 1))
- name: pnpm install
run: pnpm install --frozen-lockfile
- name: Create and migrate database
run: |
bin/rake db:create
script/silence_successful_output bin/rake db:migrate
- name: Run all schema and converter checks (disco check)
run: |
# Runs every check in dependency order: pending migrations, schema
# config validity, config ↔ database drift, committed generated files
# vs regeneration (in a temp directory), and converter coverage.
# Prints the actionable differences and fix commands on failure.
migrations/bin/disco check
- name: RSpec (Rails integration)
env:
MIGRATIONS_RAILS: "1"
run: |
for gem in core tooling converters importer; do
echo "== migrations-$gem (Rails integration) =="
(cd "migrations/$gem" && BUNDLE_GEMFILE="$GITHUB_WORKSPACE/Gemfile" bundle exec rspec --tag rails)
done