Skip to content

ci: add Makefile target and CI check for collectstatic#65

Merged
dwilding merged 7 commits intocanonical:mainfrom
Samarthegde:issue-64-makefile
Sep 17, 2025
Merged

ci: add Makefile target and CI check for collectstatic#65
dwilding merged 7 commits intocanonical:mainfrom
Samarthegde:issue-64-makefile

Conversation

@Samarthegde
Copy link
Contributor

This commit introduces a new check in the CI pipeline to ensure that Django's collected static files are always up-to-date and committed to the repository.

A new lint target has been added to the dashboard/Makefile. This target first runs make collectstatic and then uses git diff to verify that there are no uncommitted changes in the staticfiles/ directory. If changes are detected, the build will fail.

The GitHub Actions workflow has been updated to execute this new make lint command, automating the verification process. This prevents developers from forgetting to run collectstatic after modifying assets, which could lead to deploying outdated static files.


Manual checks

  • If you changed the Dashboard application or the rock, have you increased the version number in rockcraft.yaml? Remember to use the same version number in README.md.

This commit introduces a new check in the CI pipeline to ensure that Django's collected static files are always up-to-date and committed to the repository.

A new `lint` target has been added to the `dashboard/Makefile`. This target first runs `make collectstatic` and then uses `git diff` to verify that there are no uncommitted changes in the `staticfiles/` directory. If changes are detected, the build will fail.

The GitHub Actions workflow has been updated to execute this new `make lint` command, automating the verification process. This prevents developers from forgetting to run `collectstatic` after modifying assets, which could lead to deploying outdated static files.
@dwilding dwilding linked an issue Sep 16, 2025 that may be closed by this pull request
Copy link
Collaborator

@dwilding dwilding left a comment

Choose a reason for hiding this comment

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

Thank you @Samarthegde, this is a very welcome addition!

I made some small adjustments while reviewing this:

  • Changed lint to collectstatic-check because I'd prefer to reserve lint for running code style and static analysis checks in the future

  • Renamed the "Tests" workflow to "Checks", because this workflow is doing more things now

  • Added a new section in the application README about editing static files, mentioning about running make collectstatic. (This was also prompted by a question from @AnneCYH a couple of days ago)

@dwilding dwilding changed the title ci(static): Add Makefile target and CI check for collectstatic ci: add Makefile target and CI check for collectstatic Sep 17, 2025
@dwilding dwilding merged commit 783347d into canonical:main Sep 17, 2025
3 of 4 checks passed
@Samarthegde Samarthegde deleted the issue-64-makefile branch September 19, 2025 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Makefile target and CI check for collectstatic

2 participants