Skip to content

Fix docker setup

Fix docker setup #360

Workflow file for this run

name: Alembic consistency check
on:
pull_request:
branches: [master]
jobs:
check-alembic:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.11'
- name: Get list of created migrations
id: get-changed-files
uses: ThiefMaster/changed-files-action@json-output
with:
repo-token: ${{ github.token }}
pattern: '^newdle/migrations/versions/.+\.py$'
- name: Check if any migrations changed
id: migrations-changed
run: |
echo ::set-output name=changed::${{ steps.get-changed-files.outputs.files_created != '[]' || steps.get-changed-files.outputs.files_updated != '[]' || steps.get-changed-files.outputs.files_deleted != '[]' }}
- name: Setup venv and config file
if: steps.migrations-changed.outputs.changed == 'true'
run: |
make config
PYTHON=python3.11 make env
pip install -q -e '.[dev]'
- name: Activate virtualenv for later steps
if: steps.migrations-changed.outputs.changed == 'true'
run: |
echo "VIRTUAL_ENV=$(pwd)/.venv" >> $GITHUB_ENV
echo "$(pwd)/.venv/bin" >> $GITHUB_PATH
- name: Check history consistency
if: steps.migrations-changed.outputs.changed == 'true'
run: python ./ci/check_history_consistency.py
- name: Store PR data
run: |
mkdir /tmp/migration-sql-data
echo ${{ github.event.number }} > /tmp/migration-sql-data/pull-request-id
- name: Print changed migrations
if: steps.migrations-changed.outputs.changed == 'true'
run: |
first_migration=$(jq -r '.[0] // empty' ~/files_created.json)
latest_migration=$(jq -r '.[-1] // empty' ~/files_created.json)
./ci/print_revision_sql.sh $first_migration $latest_migration > /tmp/migration-sql-data/upgrade.sql
- name: Create artifact
uses: actions/upload-artifact@v2
with:
name: migration-sql-data
path: /tmp/migration-sql-data
retention-days: 1