ci(forgejo): sync ci.yml with github workflow
Some checks failed
CI / lint (pull_request) Has been cancelled
CI / typecheck (pull_request) Has been cancelled
CI / test (pull_request) Has been cancelled
CI / security (pull_request) Has been cancelled
CI / gitleaks (pull_request) Has been cancelled
CI / commitlint (pull_request) Has been cancelled
Some checks failed
CI / lint (pull_request) Has been cancelled
CI / typecheck (pull_request) Has been cancelled
CI / test (pull_request) Has been cancelled
CI / security (pull_request) Has been cancelled
CI / gitleaks (pull_request) Has been cancelled
CI / commitlint (pull_request) Has been cancelled
This commit is contained in:
parent
1d4537b935
commit
c729fef977
1 changed files with 56 additions and 121 deletions
|
|
@ -2,6 +2,8 @@
|
||||||
# Copyright (c) 2026 Rug Munch Media LLC
|
# Copyright (c) 2026 Rug Munch Media LLC
|
||||||
# Part of Pry — https://git.rugmunch.io/RugMunchMedia/pryscraper
|
# Part of Pry — https://git.rugmunch.io/RugMunchMedia/pryscraper
|
||||||
# Licensed under MIT. See LICENSE.
|
# Licensed under MIT. See LICENSE.
|
||||||
|
#
|
||||||
|
# Force workflow re-parse: bump cache key 2026-07-03-a
|
||||||
name: CI
|
name: CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
|
@ -10,147 +12,80 @@ on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
env:
|
env:
|
||||||
UV_BIN: /root/.local/bin/uv
|
PYTHON_VERSION: "3.12"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
runs-on: docker-x64
|
runs-on: ubuntu-latest
|
||||||
container:
|
|
||||||
image: python:3.11-slim
|
|
||||||
steps:
|
steps:
|
||||||
- name: Install Node.js for actions/checkout
|
|
||||||
run: |
|
|
||||||
apt-get update
|
|
||||||
apt-get install -y --no-install-recommends curl ca-certificates
|
|
||||||
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
|
|
||||||
apt-get install -y --no-install-recommends nodejs
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-python@v5
|
||||||
- name: Install system deps
|
with:
|
||||||
run: |
|
python-version: ${{ env.PYTHON_VERSION }}
|
||||||
apt-get update
|
cache: pip
|
||||||
apt-get install -y --no-install-recommends gcc libpq-dev curl git ca-certificates
|
cache-dependency-path: pyproject.toml
|
||||||
rm -rf /var/lib/apt/lists/*
|
- run: pip install ruff
|
||||||
|
- run: ruff check .
|
||||||
- name: Install uv
|
- run: ruff format --check .
|
||||||
run: |
|
|
||||||
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
||||||
ln -sf /root/.local/bin/uv /usr/local/bin/uv
|
|
||||||
ln -sf /root/.local/bin/uvx /usr/local/bin/uvx
|
|
||||||
|
|
||||||
- name: Setup Python
|
|
||||||
run: |
|
|
||||||
uv python install 3.11
|
|
||||||
uv venv --python 3.11 .venv
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
uv pip install --python .venv/bin/python -r requirements.txt
|
|
||||||
uv pip install --python .venv/bin/python -e ".[dev]"
|
|
||||||
|
|
||||||
- name: Lint (ruff)
|
|
||||||
run: source .venv/bin/activate && ruff check . --exit-non-zero-on-fix
|
|
||||||
|
|
||||||
- name: Format check (ruff)
|
|
||||||
run: source .venv/bin/activate && ruff format --check .
|
|
||||||
|
|
||||||
typecheck:
|
typecheck:
|
||||||
runs-on: docker-x64
|
runs-on: ubuntu-latest
|
||||||
container:
|
|
||||||
image: python:3.11-slim
|
|
||||||
steps:
|
steps:
|
||||||
- name: Install Node.js for actions/checkout
|
|
||||||
run: |
|
|
||||||
apt-get update && apt-get install -y --no-install-recommends curl ca-certificates
|
|
||||||
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
|
|
||||||
apt-get install -y --no-install-recommends nodejs
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Install uv + setup
|
- uses: actions/setup-python@v5
|
||||||
run: |
|
with:
|
||||||
apt-get update && apt-get install -y --no-install-recommends curl ca-certificates && rm -rf /var/lib/apt/lists/*
|
python-version: ${{ env.PYTHON_VERSION }}
|
||||||
curl -LsSf https://astral.sh/uv/install.sh | sh
|
cache: pip
|
||||||
ln -sf /root/.local/bin/uv /usr/local/bin/uv
|
cache-dependency-path: pyproject.toml
|
||||||
ln -sf /root/.local/bin/uvx /usr/local/bin/uvx
|
- run: pip install -e ".[dev]"
|
||||||
uv python install 3.11
|
- run: mypy --python-version 3.12 --strict --ignore-missing-imports --exclude 'build/|dist/|.git/|__pycache__/' *.py
|
||||||
uv venv --python 3.11 .venv
|
|
||||||
uv pip install --python .venv/bin/python -e ".[dev]"
|
|
||||||
- name: Type check (mypy)
|
|
||||||
run: source .venv/bin/activate && mypy .
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
runs-on: docker-x64
|
runs-on: ubuntu-latest
|
||||||
container:
|
|
||||||
image: python:3.11-slim
|
|
||||||
steps:
|
steps:
|
||||||
- name: Install Node.js for actions/checkout
|
|
||||||
run: |
|
|
||||||
apt-get update && apt-get install -y --no-install-recommends curl ca-certificates
|
|
||||||
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
|
|
||||||
apt-get install -y --no-install-recommends nodejs
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Install uv + setup
|
- uses: actions/setup-python@v5
|
||||||
run: |
|
with:
|
||||||
apt-get update && apt-get install -y --no-install-recommends gcc libpq-dev curl ca-certificates && rm -rf /var/lib/apt/lists/*
|
python-version: ${{ env.PYTHON_VERSION }}
|
||||||
curl -LsSf https://astral.sh/uv/install.sh | sh
|
cache: pip
|
||||||
ln -sf /root/.local/bin/uv /usr/local/bin/uv
|
cache-dependency-path: pyproject.toml
|
||||||
ln -sf /root/.local/bin/uvx /usr/local/bin/uvx
|
- run: pip install -e ".[dev]"
|
||||||
uv python install 3.11
|
- run: pytest tests/ -v --cov=. --cov-report=term-missing --cov-fail-under=40
|
||||||
uv venv --python 3.11 .venv
|
|
||||||
uv pip install --python .venv/bin/python -e ".[dev]"
|
|
||||||
- name: Test (pytest)
|
|
||||||
run: source .venv/bin/activate && pytest tests/ -x -q --tb=short -m "not integration"
|
|
||||||
|
|
||||||
secrets:
|
security:
|
||||||
name: Secret scan (gitleaks)
|
runs-on: ubuntu-latest
|
||||||
runs-on: docker-x64
|
|
||||||
container:
|
|
||||||
image: python:3.11-slim
|
|
||||||
steps:
|
steps:
|
||||||
- name: Install Node.js for actions/checkout
|
- uses: actions/checkout@v4
|
||||||
run: |
|
- uses: actions/setup-python@v5
|
||||||
apt-get update && apt-get install -y --no-install-recommends curl ca-certificates
|
with:
|
||||||
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
|
python-version: ${{ env.PYTHON_VERSION }}
|
||||||
apt-get install -y --no-install-recommends nodejs
|
cache: pip
|
||||||
rm -rf /var/lib/apt/lists/*
|
cache-dependency-path: pyproject.toml
|
||||||
|
- run: pip install bandit
|
||||||
|
- run: bandit -r . -x tests/,.venv,__pycache__
|
||||||
|
|
||||||
|
gitleaks:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Run gitleaks
|
- uses: gitleaks/gitleaks-action@v2
|
||||||
run: |
|
env:
|
||||||
apt-get update && apt-get install -y --no-install-recommends wget git ca-certificates && rm -rf /var/lib/apt/lists/*
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
wget -qO- https://github.com/gitleaks/gitleaks/releases/download/v8.24.0/gitleaks_8.24.0_linux_x64.tar.gz | tar -xz -C /usr/local/bin gitleaks
|
|
||||||
gitleaks detect --source . --redact --no-banner --no-git
|
|
||||||
|
|
||||||
security:
|
commitlint:
|
||||||
name: Security audit (bandit)
|
if: github.event_name == 'pull_request'
|
||||||
runs-on: docker-x64
|
runs-on: ubuntu-latest
|
||||||
container:
|
|
||||||
image: python:3.11-slim
|
|
||||||
steps:
|
steps:
|
||||||
- name: Install Node.js for actions/checkout
|
|
||||||
run: |
|
|
||||||
apt-get update && apt-get install -y --no-install-recommends curl ca-certificates
|
|
||||||
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
|
|
||||||
apt-get install -y --no-install-recommends nodejs
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Install uv + setup
|
with:
|
||||||
run: |
|
fetch-depth: 0
|
||||||
apt-get update && apt-get install -y --no-install-recommends curl ca-certificates && rm -rf /var/lib/apt/lists/*
|
- uses: wagoid/commitlint-github-action@v6
|
||||||
curl -LsSf https://astral.sh/uv/install.sh | sh
|
with:
|
||||||
ln -sf /root/.local/bin/uv /usr/local/bin/uv
|
configFile: .commitlintrc.yml
|
||||||
ln -sf /root/.local/bin/uvx /usr/local/bin/uvx
|
|
||||||
uv python install 3.11
|
|
||||||
uv venv --python 3.11 /tmp/bandit-venv
|
|
||||||
uv pip install --python /tmp/bandit-venv/bin/python bandit
|
|
||||||
- name: Bandit (high+medium severity)
|
|
||||||
run: source /tmp/bandit-venv/bin/activate && bandit -r . -x tests/,.venv,__pycache__ -ll
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue