mirror of
https://github.com/openhop-dev/openhop_repeater.git
synced 2026-09-17 01:44:19 +00:00
133 lines
3.3 KiB
YAML
133 lines
3.3 KiB
YAML
name: PR Checks
|
|
|
|
on:
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: pr-checks-${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
pre-commit:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
cache: pip
|
|
cache-dependency-path: |
|
|
pyproject.toml
|
|
.pre-commit-config.yaml
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
python -m pip install pre-commit
|
|
python -m pip install -e .[dev]
|
|
|
|
- name: Run pre-commit
|
|
run: pre-commit run --all-files
|
|
|
|
python-310:
|
|
name: Python 3.10
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.10"
|
|
cache: pip
|
|
cache-dependency-path: pyproject.toml
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
python -m pip install -e .[dev]
|
|
|
|
- name: Run tests
|
|
run: python -m pytest -q
|
|
|
|
repository-lint:
|
|
name: Actions and shell scripts
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Lint GitHub Actions workflows
|
|
run: docker run --rm -v "$PWD:/repo" -w /repo rhysd/actionlint:1.7.12
|
|
|
|
- name: Check shell scripts
|
|
run: |
|
|
git ls-files -z '*.sh' | xargs -0 --no-run-if-empty \
|
|
docker run --rm -v "$PWD:/mnt" -w /mnt \
|
|
koalaman/shellcheck:v0.11.0 --severity=error
|
|
|
|
package-smoke:
|
|
name: Wheel smoke test
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
cache: pip
|
|
cache-dependency-path: pyproject.toml
|
|
|
|
- name: Build wheel
|
|
run: |
|
|
python -m pip install --upgrade pip build
|
|
rm -rf build dist ./*.egg-info
|
|
python -m build --wheel
|
|
|
|
- name: Install wheel
|
|
run: python -m pip install dist/*.whl
|
|
|
|
- name: Verify installed package
|
|
run: |
|
|
python - <<'PY'
|
|
from importlib.metadata import entry_points
|
|
from importlib.resources import files
|
|
|
|
package = files("repeater")
|
|
required = (
|
|
"web/openapi.yaml",
|
|
"web/html/index.html",
|
|
"presets/letsmesh.yaml",
|
|
)
|
|
missing = [path for path in required if not package.joinpath(path).is_file()]
|
|
if missing:
|
|
raise SystemExit(f"Missing packaged files: {', '.join(missing)}")
|
|
|
|
scripts = {ep.name for ep in entry_points(group="console_scripts")}
|
|
expected = {"openhop-repeater", "pymc-cli"}
|
|
if missing_scripts := expected - scripts:
|
|
raise SystemExit(f"Missing console scripts: {', '.join(sorted(missing_scripts))}")
|
|
PY
|
|
openhop-repeater --help
|