|
| 1 | +name: Verify Coplan migration |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: [verify-coplan-namespace-migration] |
| 5 | +permissions: |
| 6 | + contents: read |
| 7 | + statuses: write |
| 8 | +jobs: |
| 9 | + verify: |
| 10 | + runs-on: |
| 11 | + group: ubuntu-x86-runners |
| 12 | + env: |
| 13 | + RAILS_ENV: test |
| 14 | + DATABASE_URL: mysql2://root:root@127.0.0.1:3306/planning_department_test |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 |
| 17 | + - run: sudo systemctl start mysql |
| 18 | + - uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b |
| 19 | + with: |
| 20 | + ruby-version: .ruby-version |
| 21 | + bundler-cache: true |
| 22 | + - run: bin/rails db:create db:schema:load |
| 23 | + - name: Run migration spec |
| 24 | + continue-on-error: true |
| 25 | + run: bundle exec rspec spec/migrations/rename_coplan_class_names_spec.rb --seed 50468 --format progress --format json --out tmp/coplan-migration-report.json |
| 26 | + - name: Report migration example status |
| 27 | + if: ${{ !cancelled() }} |
| 28 | + env: |
| 29 | + GH_TOKEN: ${{ github.token }} |
| 30 | + run: | |
| 31 | + python3 - <<'PY' |
| 32 | + import json, os, pathlib, subprocess |
| 33 | + report = pathlib.Path('tmp/coplan-migration-report.json') |
| 34 | + parsed = json.loads(report.read_text()) if report.exists() else {} |
| 35 | + for n, example in enumerate(parsed.get('examples', [])): |
| 36 | + error = example.get('exception', {}) |
| 37 | + lines = [s.strip() for s in error.get('message', '').splitlines() if s.strip()] |
| 38 | + for section, body in [('result', str(error.get('class', example['status']))), *[(str(i), s) for i, s in enumerate(lines[:8])]]: |
| 39 | + subprocess.run(['gh','api','--method','POST', |
| 40 | + f'repos/{os.environ["GITHUB_REPOSITORY"]}/statuses/{os.environ["GITHUB_SHA"]}', |
| 41 | + '-f','state=' + ('failure' if error else 'success'), |
| 42 | + '-f',f'context=Migration diagnostic {n} {section}', |
| 43 | + '-f','description=' + body[:136]], check=True) |
| 44 | + PY |
| 45 | + - name: Reproduce MySQL full suite |
| 46 | + continue-on-error: true |
| 47 | + run: bundle exec rspec --exclude-pattern 'spec/system/**/*_spec.rb' --seed 50468 --format progress --format json --out tmp/coplan-full-report.json |
| 48 | + - name: Report failed example locations |
| 49 | + if: ${{ !cancelled() }} |
| 50 | + env: |
| 51 | + GH_TOKEN: ${{ github.token }} |
| 52 | + run: | |
| 53 | + python3 - <<'PY' |
| 54 | + import json, os, pathlib, subprocess |
| 55 | + report = pathlib.Path('tmp/coplan-full-report.json') |
| 56 | + parsed = json.loads(report.read_text()) if report.exists() else {} |
| 57 | + for n, example in enumerate(item for item in parsed.get('examples', []) if item['status'] == 'failed'): |
| 58 | + error = example.get('exception', {}) |
| 59 | + source = f'{example["file_path"]}:{example["line_number"]} {error.get("class","")}' |
| 60 | + subprocess.run(['gh','api','--method','POST', |
| 61 | + f'repos/{os.environ["GITHUB_REPOSITORY"]}/statuses/{os.environ["GITHUB_SHA"]}', |
| 62 | + '-f','state=failure','-f',f'context=Failed MySQL example {n}', |
| 63 | + '-f',f'description={source[:136]}'], check=True) |
| 64 | + PY |
0 commit comments