Merge pull request #302 from learningequality/dependabot/uv/ifcfg-0.24 #264
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: Migrations for SQLite versions | |
| on: [push, pull_request] | |
| jobs: | |
| pre_job: | |
| name: Path match check | |
| runs-on: ubuntu-latest | |
| # Map a step output to a job output | |
| outputs: | |
| should_skip: ${{ steps.skip_check.outputs.should_skip }} | |
| steps: | |
| - id: skip_check | |
| uses: fkirc/skip-duplicate-actions@master | |
| with: | |
| github_token: ${{ github.token }} | |
| paths: '["morango/migrations/*.py", ".github/workflows/check_migrations_sqlite.yml", "pyproject.toml", "uv.lock"]' | |
| build: | |
| name: Build wheel | |
| needs: pre_job | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install uv | |
| if: ${{ needs.pre_job.outputs.should_skip != 'true' }} | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| python-version: 3.9 | |
| enable-cache: "true" | |
| - name: Build wheel | |
| if: ${{ needs.pre_job.outputs.should_skip != 'true' }} | |
| run: uv build --wheel | |
| - name: Upload wheel artifact | |
| if: ${{ needs.pre_job.outputs.should_skip != 'true' }} | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: wheel | |
| path: dist/*.whl | |
| retention-days: 1 | |
| migration_test: | |
| name: SQLite migration tests | |
| needs: [pre_job, build] | |
| runs-on: ubuntu-latest | |
| container: | |
| image: python:3.7-buster | |
| steps: | |
| - name: Install build dependencies | |
| if: ${{ needs.pre_job.outputs.should_skip != 'true' }} | |
| run: | | |
| echo "deb http://archive.debian.org/debian-archive/debian/ buster main" > /etc/apt/sources.list | |
| echo "deb http://archive.debian.org/debian-archive/debian-security/ buster/updates main" >> /etc/apt/sources.list | |
| echo "Acquire::Check-Valid-Until \"false\";" > /etc/apt/apt.conf.d/99archive | |
| apt-get -y -qq update | |
| apt-get install -y build-essential tcl git-lfs | |
| - uses: actions/checkout@v6 | |
| if: ${{ needs.pre_job.outputs.should_skip != 'true' }} | |
| with: | |
| lfs: true | |
| fetch-depth: 0 | |
| - name: Download wheel artifact | |
| if: ${{ needs.pre_job.outputs.should_skip != 'true' }} | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: wheel | |
| path: dist/ | |
| - name: Build SQLite 3.25.3 | |
| if: ${{ needs.pre_job.outputs.should_skip != 'true' }} | |
| run: | | |
| # Following the instructions from https://til.simonwillison.net/sqlite/ld-preload | |
| # to build SQLite from source, using version 3.25.3 | |
| tar -xzvf tests/SQLite-89e099fb.tar.gz | |
| cd SQLite-89e099fb | |
| CPPFLAGS="-DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_RTREE=1" ./configure | |
| make | |
| LD_PRELOAD=.libs/libsqlite3.so python3 -c \ | |
| 'import sqlite3; assert sqlite3.connect(":memory").execute("select sqlite_version()").fetchone()[0] == "3.25.3"' | |
| # Once we have confirmed that this works, set it for subsequent steps | |
| echo "LD_PRELOAD=$(realpath .libs/libsqlite3.so)" >> $GITHUB_ENV | |
| - uses: actions/cache@v5 | |
| if: ${{ needs.pre_job.outputs.should_skip != 'true' }} | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Install dependencies | |
| if: ${{ needs.pre_job.outputs.should_skip != 'true' }} | |
| run: pip install $(ls dist/*.whl | head -n 1)[test] | |
| - name: Run migrations | |
| if: ${{ needs.pre_job.outputs.should_skip != 'true' }} | |
| run: python tests/testapp/manage.py migrate |