-
-
Notifications
You must be signed in to change notification settings - Fork 47.7k
Update build.yml #12913
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
Update build.yml #12913
Conversation
-Improved reliability: Updated action versions (checkout@v5 → @v4, setup-uv@v6 → @V3) and pinned Python to "3.11" for consistent builds across environments -Enhanced caching strategy: Extended dependency caching to include both uv.lock and pyproject.toml files, reducing CI run times for the team Added code quality gates: -Integrated ruff linting to maintain code standards -Added pytest execution to catch regressions early -Implemented automatic package building for release readiness -Better developer experience: Added descriptive step names and structured workflow for easier debugging and maintenance -Streamlined configuration: Removed unnecessary allow-prereleases flag to prevent potential instability issues
.github/workflows/build.yml
Outdated
run: uv run ruff check , --output-format=github | ||
|
||
|
||
run: uv run ruff check , --output-format=github |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does the comma (,) do on this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed it .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the . useful? If not, let's remove it.
Why does pre-commit fail? |
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v5 | ||
- name: Checkout Repository |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This step only has a name
but no run
or uses
so this GHA is invalid https://github.com/TheAlgorithms/Python/actions/runs/17159313101
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pre-commit fails due to some wrong indentation and some mismatched indents, let me see that. |
schedule: | ||
- cron: "0 0 * * *" # Run everyday | ||
push: | ||
branches: [main, develop] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This repo has no main
or develop
branch, so this change disables all push testing.
.github/workflows/build.yml
Outdated
- "*.md" | ||
- "docs/**" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why ignore these? docs
contains Python code.
- "docs/**" | ||
|
||
pull_request: | ||
branches: [main] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This repo has no main
branch, so this change disables all pull request testing.
|
||
pull_request: | ||
branches: [main] | ||
types: [opened, synchronize, reopened] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why these?
types: [opened, synchronize, reopened] | ||
paths-ignore: | ||
- "*.md" | ||
- "docs/**" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why ignore these? docs
contains Python code.
**/uv.lock | ||
**/pyproject.toml | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hyphen on line 37 makes this entire file invalid.
actions/setup-python@v5
tells the reader more than Set up Python
.
with: | ||
python-version: 3.x | ||
python-version: "3.11" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CONTRIBUTING.md says we always use the latest production version of CPython, so why slow down and invalidate our testing by using an old version of Python?
allow-prereleases: true | ||
- run: uv sync --group=test | ||
- name: Install dependencies |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uv sync --group=test
tells the reader more than Install dependencies
.
uv sync --all-extras | ||
uv pip list |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not helpful. This has the potential to slow down the build and generate longer logs, which will go unread.
- if: ${{ success() }} | ||
run: scripts/build_directory_md.py 2>&1 | tee DIRECTORY.md |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The if
and run
commands need to be placed in the same job step, not in two separate job steps.
uv sync --all-extras | ||
uv pip list | ||
- name: Lint code | ||
run: uv run ruff check . --output-format=github |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why run ruff again? It is already run in the pre-commit
and dedicated ruff
jobs.
-Improved reliability:
Updated action versions (checkout@v5 → @v4, setup-uv@v6 → @V3) and pinned Python to "3.11" for consistent builds across environments -Enhanced caching strategy:
Extended dependency caching to include both uv.lock and pyproject.toml files, reducing CI run times for the team Added code quality gates:
-Integrated ruff linting to maintain code standards -Added pytest execution to catch regressions early -Implemented automatic package building for release readiness
-Better developer experience: Added descriptive step names and structured workflow for easier debugging and maintenance
-Streamlined configuration: Removed unnecessary allow-prereleases flag to prevent potential instability issues
Describe your change:
Checklist: