TheAlgorithms/Python

6 workflows · maturity 33% · 1 patterns · GitHub ↗

Security 4.17/100

Practices

○ Matrix✓ Permissions○ Security scan○ AI review○ Cache✓ Concurrency○ Reusable workflows

Detected patterns

Security dimensions

permissions
4.2
security scan
0
supply chain
0
secret handling
0
harden runner
0

Workflows (6)

build .github/workflows/build.yml
Triggers
pull_request, schedule
Runs on
ubuntu-latest
Jobs
build
Actions
astral-sh/setup-uv
Commands
  • sudo apt-get update && sudo apt-get install -y libhdf5-dev
  • uv sync --group=test
  • uv run --with=pytest-run-parallel pytest --iterations=8 --parallel-threads=auto --ignore=computer_vision/cnn_classification.py --ignore=docs/conf.py --ignore=dynamic_programming/k_means_clustering_tensorflow.py --ignore=machine_learning/local_weighted_learning/local_weighted_learning.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=. .
  • scripts/build_directory_md.py 2>&1 | tee DIRECTORY.md
View raw YAML
name: "build"

on:
  pull_request:
  schedule:
    - cron: "0 0 * * *" # Run everyday

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - run: sudo apt-get update && sudo apt-get install -y libhdf5-dev
      - uses: actions/checkout@v6
      - uses: astral-sh/setup-uv@v7
        with:
          enable-cache: true
          cache-dependency-glob: uv.lock
      - uses: actions/setup-python@v6
        with:
          python-version: 3.14
          allow-prereleases: true
      - run: uv sync --group=test
      - name: Run tests
        # TODO: #8818 Re-enable quantum tests
        run: uv run --with=pytest-run-parallel pytest
          --iterations=8 --parallel-threads=auto
          --ignore=computer_vision/cnn_classification.py
          --ignore=docs/conf.py
          --ignore=dynamic_programming/k_means_clustering_tensorflow.py
          --ignore=machine_learning/local_weighted_learning/local_weighted_learning.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
devcontainer_ci .github/workflows/devcontainer_ci.yml
Triggers
push, pull_request
Runs on
ubuntu-latest
Jobs
build
Actions
devcontainers/ci
View raw YAML
name: Test DevContainer Build

on:
  push:
    paths:
      - ".devcontainer/**"
  pull_request:
    paths:
      - ".devcontainer/**"

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: devcontainers/ci@v0.3
        with:
          push: never
          runCmd: "true"
directory_writer .github/workflows/directory_writer.yml
Triggers
push
Runs on
ubuntu-latest
Jobs
directory_writer
Commands
  • scripts/build_directory_md.py 2>&1 | tee DIRECTORY.md git config --global user.name "$GITHUB_ACTOR" git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com" git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
  • git add DIRECTORY.md git commit -am "updating DIRECTORY.md" || true git push --force origin HEAD:$GITHUB_REF || true
View raw YAML
# The objective of this GitHub Action is to update the DIRECTORY.md file (if needed)
# when doing a git push
name: directory_writer
on: [push]
jobs:
  directory_writer:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
        with:
          fetch-depth: 0
      - uses: actions/setup-python@v6
        with:
          python-version: 3.14
          allow-prereleases: true
      - name: Write DIRECTORY.md
        run: |
          scripts/build_directory_md.py 2>&1 | tee DIRECTORY.md
          git config --global user.name "$GITHUB_ACTOR"
          git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com"
          git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
      - name: Update DIRECTORY.md
        run: |
          git add DIRECTORY.md
          git commit -am "updating DIRECTORY.md" ||  true
          git push --force origin HEAD:$GITHUB_REF || true
project_euler .github/workflows/project_euler.yml
Triggers
pull_request, schedule
Runs on
ubuntu-latest, ubuntu-latest
Jobs
project-euler, validate-solutions
Actions
astral-sh/setup-uv, astral-sh/setup-uv
Commands
  • sudo apt-get update && sudo apt-get install -y libtiff5-dev libjpeg8-dev libopenjp2-7-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python3-tk libharfbuzz-dev libfribidi-dev libxcb1-dev libxml2-dev libxslt-dev libhdf5-dev libopenblas-dev
  • uv sync --group=euler-validate --group=test
  • uv run pytest --doctest-modules --cov-report=term-missing:skip-covered --cov=project_euler/ project_euler/
  • sudo apt-get update && sudo apt-get install -y libtiff5-dev libjpeg8-dev libopenjp2-7-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python3-tk libharfbuzz-dev libfribidi-dev libxcb1-dev libxml2-dev libxslt-dev libhdf5-dev libopenblas-dev
  • uv sync --group=euler-validate --group=test
  • uv run pytest scripts/validate_solutions.py
View raw YAML
on:
  pull_request:
    # Run only if a file is changed within the project_euler directory and related files
    paths:
      - "project_euler/**"
      - ".github/workflows/project_euler.yml"
      - "scripts/validate_solutions.py"
  schedule:
    - cron: "0 0 * * *" # Run everyday

name: "Project Euler"

jobs:
  project-euler:
    runs-on: ubuntu-latest
    steps:
      - run:
          sudo apt-get update && sudo apt-get install -y libtiff5-dev libjpeg8-dev libopenjp2-7-dev
          zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python3-tk
          libharfbuzz-dev libfribidi-dev libxcb1-dev
          libxml2-dev libxslt-dev
          libhdf5-dev
          libopenblas-dev
      - uses: actions/checkout@v6
      - uses: astral-sh/setup-uv@v7
      - uses: actions/setup-python@v6
        with:
          python-version: 3.14
          allow-prereleases: true
      - run: uv sync --group=euler-validate --group=test
      - run: uv run pytest --doctest-modules --cov-report=term-missing:skip-covered --cov=project_euler/ project_euler/
  validate-solutions:
    runs-on: ubuntu-latest
    steps:
      - run:
          sudo apt-get update && sudo apt-get install -y libtiff5-dev libjpeg8-dev libopenjp2-7-dev
          zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python3-tk
          libharfbuzz-dev libfribidi-dev libxcb1-dev
          libxml2-dev libxslt-dev
          libhdf5-dev
          libopenblas-dev
      - uses: actions/checkout@v6
      - uses: astral-sh/setup-uv@v7
      - uses: actions/setup-python@v6
        with:
          python-version: 3.14
          allow-prereleases: true
      - run: uv sync --group=euler-validate --group=test
      - run: uv run pytest scripts/validate_solutions.py
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ruff .github/workflows/ruff.yml
Triggers
push, pull_request
Runs on
ubuntu-latest
Jobs
ruff
Actions
astral-sh/setup-uv
Commands
  • uvx ruff check --output-format=github .
View raw YAML
# https://beta.ruff.rs
name: ruff
on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master
jobs:
  ruff:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: astral-sh/setup-uv@v7
      - run: uvx ruff check --output-format=github .
sphinx perms .github/workflows/sphinx.yml
Triggers
push, pull_request, workflow_dispatch
Runs on
ubuntu-24.04-arm, ubuntu-latest
Jobs
build_docs, deploy_docs
Actions
astral-sh/setup-uv, actions/configure-pages, actions/upload-pages-artifact, actions/deploy-pages
Commands
  • sudo apt-get update && sudo apt-get install -y libtiff5-dev libjpeg8-dev libopenjp2-7-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python3-tk libharfbuzz-dev libfribidi-dev libxcb1-dev libxml2-dev libxslt-dev libhdf5-dev libopenblas-dev
  • uv sync --group=docs
  • uv run sphinx-build -c docs . docs/_build/html
View raw YAML
name: sphinx

on:
  # Triggers the workflow on push or pull request events but only for the "master" branch
  push:
    branches: ["master"]
  pull_request:
    branches: ["master"]
  # Or manually from the Actions tab
  workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
  contents: read
  pages: write
  id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
  group: "pages"
  cancel-in-progress: false

jobs:
  build_docs:
    runs-on: ubuntu-24.04-arm
    steps:
      - run:
          sudo apt-get update && sudo apt-get install -y libtiff5-dev libjpeg8-dev libopenjp2-7-dev
          zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python3-tk
          libharfbuzz-dev libfribidi-dev libxcb1-dev
          libxml2-dev libxslt-dev
          libhdf5-dev
          libopenblas-dev
      - uses: actions/checkout@v6
      - uses: astral-sh/setup-uv@v7
      - uses: actions/setup-python@v6
        with:
          python-version: 3.14
          allow-prereleases: true
      - run: uv sync --group=docs
      - uses: actions/configure-pages@v6
      - run: uv run sphinx-build -c docs . docs/_build/html
      - uses: actions/upload-pages-artifact@v4
        with:
          path: docs/_build/html

  deploy_docs:
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    if: github.event_name != 'pull_request'
    needs: build_docs
    runs-on: ubuntu-latest
    steps:
      - uses: actions/deploy-pages@v5
        id: deployment