-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Speed up migrations linting in CI #160
Comments
Hi @0x962 Thanks for submitting an issue. A good way to improve speed is indeed to only lint newly added migrations. This can be done in multiple ways:
The linter also writes a little cache, which is mostly leveraged on your local environment. I don't think GitHub Actions has some persistence to keep the cache from one run to the next 🤔 |
GitHub actions supports caching in general. @0x962 |
Hi @blueyed Good to know for GH Actions, thanks! The linter cache uses a hash of the file's content as key (see https://github.com/3YOURMIND/django-migration-linter/blob/main/django_migration_linter/migration_linter.py#L213) and stores the linting result as value for each file. Then, the cache is expectedly depend of the selected Django project, database and the linter's version. |
Thank you for your comments, @blueyed and @David-Wobrock. For other people who stumble upon this thread and use this amazing tool, this is my Github actions implementation. ( The relevant steps ) - name: Caches django migrations linter
uses: actions/cache@v2
with:
path: |
$HOME/.cache/django-migration-linter
key: ${{ runner.os }}-migrations-linter-${{ github.sha }}
restore-keys: |
${{ runner.os }}-migrations-linter-${{ github.sha }}
${{ runner.os }}-migrations-linter-
${{ runner.os }}-
- name: Run Migrations Linter
run: MIGRATE=True python manage.py lintmigrations |
🤗 |
We're running
django-migrations-linter
as part of our CI, it's a great tool, thank you!Do you have any recommendations on speeding up this step when using Github actions?
I did notice the
--git-commit-id
parameter, but was unable to make it work using thegithub.event.pull_request.sha
variable. (Raises a diff error)The text was updated successfully, but these errors were encountered: