Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Add CI check for uncommitted migrations#580

Merged
sarayourfriend merged 13 commits intomainfrom
add/ci-check-makemigrations#571
Mar 25, 2022
Merged

Add CI check for uncommitted migrations#580
sarayourfriend merged 13 commits intomainfrom
add/ci-check-makemigrations#571

Conversation

@sarayourfriend
Copy link
Contributor

Fixes

Fixes #571 by @sarayourfriend

Description

Adds a new check to verify there are no uncommitted migrations in the PR.

Testing Instructions

Verify that the test commit (43c8c2c) introduces uncommitted migrations and that the CI fails for that commit.

Checklist

  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the default branch of the repository (main) or a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • [N/A] I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • [N/A] I tried running the project locally and verified that there are no visible errors.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@sarayourfriend sarayourfriend requested a review from a team as a code owner March 22, 2022 13:18
@dhruvkb dhruvkb added 🛠 goal: fix Bug fix 🟥 priority: critical Must be addressed ASAP 🤖 aspect: dx Concerns developers' experience with the codebase labels Mar 22, 2022
Copy link
Contributor

@AetherUnbound AetherUnbound left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the most recent CI run failed because it was unable to run the just command, not because of an uncommitted migration 🤔

@sarayourfriend
Copy link
Contributor Author

It looks like the most recent CI run failed because it was unable to run the just command, not because of an uncommitted migration thinking

Yes, so far it still hasn't run correctly. I only undrafted this so I could get the CI to run, please ignore for now!

@sarayourfriend sarayourfriend changed the title Add CI check for uncommitted migrations [WIP] Add CI check for uncommitted migrations Mar 22, 2022
@AetherUnbound
Copy link
Contributor

Yes, so far it still hasn't run correctly. I only undrafted this so I could get the CI to run, please ignore for now!

Oh got it, my bad! I didn't realize/remember CI doesn't run on drafts

@sarayourfriend
Copy link
Contributor Author

Seems like the TTY value in the docker-compose won't work for CI 🤔 Why does it work for running the tests?

@sarayourfriend
Copy link
Contributor Author

This run shows it working to pass when there are no uncommitted migrations: https://github.com/WordPress/openverse-api/runs/5680076354

The run was a mistake but at least it proves that it works 🙂

The next run will show what happens when it should break.

'"$(just web-health)" != "200"' \
"Waiting for the API to be healthy..."

@_api-up: up wait-for-es wait-for-ing wait-for-web
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Smart!

@sarayourfriend sarayourfriend changed the title [WIP] Add CI check for uncommitted migrations Add CI check for uncommitted migrations Mar 24, 2022
@sarayourfriend
Copy link
Contributor Author

@AetherUnbound @obulat @stacimc this is ready for review now.

You can see that the workflow correctly fails when there are uncommitted migrations: https://github.com/WordPress/openverse-api/runs/5680410997?check_suite_focus=true

And passes when a new migration is added: https://github.com/WordPress/openverse-api/runs/5680076354

@sarayourfriend sarayourfriend enabled auto-merge (squash) March 25, 2022 12:08
Copy link
Contributor

@AetherUnbound AetherUnbound left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome 🎉 great work!

cd api && pipenv run python manage.py {{ args }}

# Run Django administrative commands in the docker container
@dj docker_args="" +args="": _api-up
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this!!

@sarayourfriend sarayourfriend merged commit c995823 into main Mar 25, 2022
Copy link
Contributor

@stacimc stacimc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Excited to see this go in!

@sarayourfriend sarayourfriend deleted the add/ci-check-makemigrations#571 branch March 25, 2022 21:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

🤖 aspect: dx Concerns developers' experience with the codebase 🛠 goal: fix Bug fix 🟥 priority: critical Must be addressed ASAP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Run makemigrations in CI to prevent merging PRs with missing migrations.

4 participants