92 lines
2.8 KiB
YAML
92 lines
2.8 KiB
YAML
name: CI
|
|
|
|
on:
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
lint:
|
|
name: lint-and-types
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
|
|
with:
|
|
python-version: "3.13"
|
|
|
|
- name: Install Poetry
|
|
run: |
|
|
# Pinned to the release that generated poetry.lock: the content hash in the
|
|
# lock file depends on Poetry's hashing rules, so a different Poetry can
|
|
# report the lock as stale. Invoked as a module so the interpreter's Poetry
|
|
# is used even if an older one is earlier on PATH.
|
|
pip install "poetry==2.5.0"
|
|
python -m poetry --version
|
|
|
|
- name: Install dev dependencies
|
|
run: python -m poetry install --with dev
|
|
|
|
- name: Lint (ruff)
|
|
run: python -m poetry run ruff check .
|
|
|
|
- name: Type check (mypy)
|
|
run: python -m poetry run mypy
|
|
|
|
tests:
|
|
name: tests (python ${{ matrix.python-version }})
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
# The package requires Python 3.12 or newer.
|
|
python-version: ["3.12", "3.13", "3.14"]
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Install Poetry
|
|
run: |
|
|
# Pinned to the release that generated poetry.lock: the content hash in the
|
|
# lock file depends on Poetry's hashing rules, so a different Poetry can
|
|
# report the lock as stale. Invoked as a module so the interpreter's Poetry
|
|
# is used even if an older one is earlier on PATH.
|
|
pip install "poetry==2.5.0"
|
|
python -m poetry --version
|
|
|
|
- name: Install project and dev dependencies
|
|
run: python -m poetry install --with dev
|
|
|
|
# The generated-role validation tests run real ansible-lint and
|
|
# ansible-playbook --syntax-check, so the pinned collections must be present.
|
|
- name: Install pinned Ansible collections
|
|
run: >
|
|
python -m poetry run ansible-galaxy collection install
|
|
--requirements-file tests/requirements.yml
|
|
--collections-path collections
|
|
|
|
- name: Run tests
|
|
run: python -m poetry run pytest -q
|