v3: harden ORM migrations and align Rails history #27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Apply v3 migrations follow-up fixes | |
| on: | |
| pull_request: | |
| types: [edited] | |
| branches: [master] | |
| push: | |
| branches: | |
| - agent/fix-v3-migration-safety-and-rails-compat | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: agent-fix-v3-migrations-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| apply-and-validate: | |
| if: github.actor != 'github-actions[bot]' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 40 | |
| steps: | |
| - name: Check out branch | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.head_ref || github.ref_name }} | |
| fetch-depth: 0 | |
| persist-credentials: true | |
| - name: Apply reviewed migration fixes | |
| shell: bash | |
| run: | | |
| base64 --decode .github/agent_fix_v3_migrations.py.gz.b64 | gzip --decompress --stdout > /tmp/agent_fix_v3_migrations.py | |
| python3 /tmp/agent_fix_v3_migrations.py | |
| python3 - <<'PY' | |
| from pathlib import Path | |
| path = Path('vlib/v3/migrations/migrations_test.v') | |
| normalized = [] | |
| for line in path.read_text().splitlines(keepends=True): | |
| index = 0 | |
| prefix = [] | |
| while index < len(line): | |
| if line.startswith(r'\t', index): | |
| prefix.append('\t') | |
| index += 2 | |
| elif line[index] in ' \t': | |
| prefix.append(line[index]) | |
| index += 1 | |
| else: | |
| break | |
| normalized.append(''.join(prefix) + line[index:]) | |
| path.write_text(''.join(normalized)) | |
| PY | |
| - name: Build V | |
| shell: bash | |
| run: make -j2 | |
| - name: Format changed V files | |
| shell: bash | |
| run: | | |
| ./v fmt -w vlib/v3/migrations/migrations.v | |
| ./v fmt -w vlib/v3/migrations/schema.v | |
| ./v fmt -w vlib/v3/migrations/migrations_test.v | |
| git diff --check | |
| - name: Run migration tests and checks | |
| shell: bash | |
| run: | | |
| ./v -cc clang -g vlib/v3/migrations/migrations_test.v | |
| ./v -cc clang -g vlib/v3/tests/migrations_public_api_test.v | |
| ./v vet vlib/v3/migrations | |
| ./v check-md vlib/v3/migrations/README.md | |
| - name: Commit validated changes | |
| shell: bash | |
| run: | | |
| rm -f .github/agent_fix_v3_migrations.py.gz.b64 | |
| rm -f .github/workflows/agent-fix-v3-migrations.yml | |
| git config user.name 'github-actions[bot]' | |
| git config user.email '41898282+github-actions[bot]@users.noreply.github.com' | |
| git add vlib/v3/migrations/migrations.v \ | |
| vlib/v3/migrations/schema.v \ | |
| vlib/v3/migrations/migrations_test.v \ | |
| vlib/v3/migrations/README.md \ | |
| .github/agent_fix_v3_migrations.py.gz.b64 \ | |
| .github/workflows/agent-fix-v3-migrations.yml | |
| git commit -m 'v3: harden ORM migrations and align Rails history' | |
| git push origin HEAD:${{ github.head_ref || github.ref_name }} |