Skip to content
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

[DI-2709] Adds CI worflow for the generated project #89

Merged
merged 4 commits into from
Oct 16, 2024

Conversation

bulya
Copy link
Collaborator

@bulya bulya commented Oct 11, 2024

Change list

  • Adds .guthub/workflows/ci.yml with couple jobs to:
    • run pre-commit hooks on CI, inc. ruff linting & formatting;
    • run api tests;
  • Update a couple of versions for pre-commit hooks
  • Update outdated safety pre-commit hook to work with poetry

The workflow tested on the newly generated project, and looks like this on GH:

image image image image

- Adds `.guthub/workflows/ci.yml` with couple jobs to:
-- run pre-commit hooks on CI, inc. ruff linting & formatting;
-- run `api` tests;
- Update couple versions for pre-commit hooks
Comment on lines -39 to -47
# TODO: Run this hook from docker container.
# - repo: local
# hooks:
# - id: migrations-check
# language: system
# name: Check for uncreated migrations.
# entry: sh -c "make api-check-migrations"
# files: models/*.*\.py$
# stages: [commit]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We will run this on CI, so I think it's OK to remove it from the pre-commit

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think that pre-commit hook & CI are for the same purpose. In my point of view pre-commit hook is a helper for developer to fix and notify some stupid issues like formatting, unused imports & not created migrations.

Pre-commit hook is not required, while CI is. So, pre-commit hook helps to avoid unnecessary CI runs in case of some issues. It's better to get a notification about these issues when you make a commit instead of waiting for a CI run.

I would like to keep this hook.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@alexryabtsev
I don't know why it was "commented" before, I can uncomment it and see if it works fine with Docker, though. If not, I can keep it commented and we can look at this later in another task/PR.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't know either why it's commented out.

@SergeyKubrak do you remember the reason why it was commented here?

@bulya Please try to uncomment and test it, if you have a capacity. If it won't work, let's try to fix it in another task. Thank you.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@bulya It's not a strong requirement. You can remove checking migrations from pre-commit hooks, if it produces additional complexity in CI workflow. It's more important to have this check in CI rather than in pre-commit hooks.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I am leaving this for visibility.
We have nevertheless decided to remove this from the pre-commit hooks, as we run all pre-commit hooks in the linter CI job, and we don't want either to run it there via the docker-compose or explicitly exclude it from the hooks list.

Copy link
Collaborator

@denys-chura denys-chura left a comment

Choose a reason for hiding this comment

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

Looks and works good. I checked that action works on my repo. Couple comments.

README.md Show resolved Hide resolved
{{ cookiecutter.project_slug }}/Makefile Outdated Show resolved Hide resolved
bulya and others added 2 commits October 15, 2024 11:49
Co-authored-by: Denys Chura <[email protected]>
Co-authored-by: Denys Chura <[email protected]>
@alexryabtsev alexryabtsev self-requested a review October 15, 2024 16:17
Copy link
Collaborator

@denys-chura denys-chura left a comment

Choose a reason for hiding this comment

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

👍

@bulya bulya merged commit bf6eec9 into django-stars:main Oct 16, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants