Skip to content
Closed
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 55 additions & 23 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,70 @@
name: "build"
name: "Build CI/CD PipeLine"

on:
pull_request:
schedule:
- cron: "0 0 * * *" # Run everyday
push:
branches: [main, develop]
Copy link
Member

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.

paths-ignore:
- "*.md"
- "docs/**"
Copy link
Member

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.


pull_request:
branches: [main]
Copy link
Member

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.

types: [opened, synchronize, reopened]
Copy link
Member

Choose a reason for hiding this comment

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

Why these?

paths-ignore:
- "*.md"
- "docs/**"
Copy link
Member

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.

schedule:
- cron: "0 0 * * *"

Copy link
Member

Choose a reason for hiding this comment

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

Why this blank line?

workflow_dispatch:

jobs:
build:
name: Build and Test
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
Copy link
Member

@cclauss cclauss Aug 23, 2025

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

Copy link
Author

Choose a reason for hiding this comment

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

Fixed it

Copy link
Member

Choose a reason for hiding this comment

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

- uses: actions/checkout@v5
- uses: astral-sh/setup-uv@v6

- name: Set up uv
Copy link
Member

Choose a reason for hiding this comment

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

astral-sh/setup-uv@v3 tells the reader more than Set up uv does.

- uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: uv.lock
cache-dependency-glob: |
**/uv.lock
**/pyproject.toml
- name: Set up Python
- uses: actions/setup-python@v5
with:
python-version: 3.x
python-version: 3.11
allow-prereleases: true
- run: uv sync --group=test
- name: Install dependencies
Copy link
Member

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.

- run: |
uv sync --all-extras
uv pip list
Comment on lines +43 to +44
Copy link
Member

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.

- name: Lint code
run: uv run ruff check . --output-format=github
Copy link
Member

@cclauss cclauss Aug 23, 2025

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.

- name: Run tests
# TODO: #8818 Re-enable quantum tests
run: uv run pytest
--ignore=computer_vision/cnn_classification.py
--ignore=docs/conf.py
--ignore=dynamic_programming/k_means_clustering_tensorflow.py
--ignore=machine_learning/lstm/lstm_prediction.py
--ignore=neural_network/input_data.py
--ignore=project_euler/
--ignore=quantum/q_fourier_transform.py
--ignore=scripts/validate_solutions.py
--ignore=web_programming/current_stock_price.py
--ignore=web_programming/fetch_anime_and_play.py
--cov-report=term-missing:skip-covered
--cov=. .
- if: ${{ success() }}
run: scripts/build_directory_md.py 2>&1 | tee DIRECTORY.md
Comment on lines -37 to -38
Copy link
Member

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.

run: |
uv run pytest \
--ignore=computer_vision/cnn_classification.py \
--ignore=docs/conf.py \
--ignore=dynamic_programming/k_means_clustering_tensorflow.py \
--ignore=machine_learning/lstm/lstm_prediction.py \
--ignore=neural_network/input_data.py \
--ignore=project_euler/ \
--ignore=quantum/q_fourier_transform.py \
--ignore=scripts/validate_solutions.py \
--ignore=web_programming/current_stock_price.py \
--ignore=web_programming/fetch_anime_and_play.py \
--cov-report=term-missing:skip-covered \
--cov=. .

- name: Build package (if needed)
run: uv build
if: ${{ success() }}

- name: Generate Directory Markdoun
run: python scripts/build_directory_md.py 2>&1 | tee DIRECTORY.md