71 lines
2.2 KiB
YAML
71 lines
2.2 KiB
YAML
# Lint, ansible-test sanity, unit tests and a collection build on every push and PR.
|
|
name: ci
|
|
|
|
"on":
|
|
push:
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
# renovate: datasource=pypi depName=ruff
|
|
RUFF_VERSION: "0.17.5"
|
|
# renovate: datasource=pypi depName=yamllint
|
|
YAMLLINT_VERSION: "1.38.0"
|
|
# renovate: datasource=pypi depName=ansible-core
|
|
ANSIBLE_CORE_VERSION: "2.22.0"
|
|
# renovate: datasource=pypi depName=meshcore
|
|
MESHCORE_VERSION: "2.3.19"
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
|
|
- name: gitleaks
|
|
uses: https://git.rfa.cz/tth-pub/ci-actions/gitleaks@v15
|
|
with:
|
|
mode: block
|
|
|
|
- uses: actions/setup-python@v7
|
|
with:
|
|
python-version: "3.14"
|
|
|
|
- name: Install
|
|
run: |
|
|
set -euo pipefail
|
|
python -m pip install --quiet pytest "ansible-core==$ANSIBLE_CORE_VERSION" \
|
|
"meshcore==$MESHCORE_VERSION" "ruff==$RUFF_VERSION" "yamllint==$YAMLLINT_VERSION"
|
|
|
|
# Collection imports and ansible-test need the ansible_collections/<ns>/<name>
|
|
# layout, as a real directory (ansible-test resolves a symlinked cwd).
|
|
- name: Collection path
|
|
run: |
|
|
set -euo pipefail
|
|
mkdir -p "$RUNNER_TEMP/ac/ansible_collections/tth/meshcore"
|
|
cp -a . "$RUNNER_TEMP/ac/ansible_collections/tth/meshcore/"
|
|
|
|
- name: Lint
|
|
run: |
|
|
set -euo pipefail
|
|
ruff check .
|
|
ruff format --check .
|
|
yamllint .
|
|
|
|
- name: ansible-test sanity
|
|
run: |
|
|
set -euo pipefail
|
|
cd "$RUNNER_TEMP/ac/ansible_collections/tth/meshcore"
|
|
# the interpreter setup-python installed (ansible-test refuses others)
|
|
py=$(python -c 'import sys; print(f"{sys.version_info[0]}.{sys.version_info[1]}")')
|
|
ansible-test sanity --requirements --python "$py" --local --color no
|
|
|
|
- name: Tests
|
|
run: |
|
|
set -euo pipefail
|
|
cd "$RUNNER_TEMP/ac/ansible_collections/tth/meshcore"
|
|
PYTHONPATH="$RUNNER_TEMP/ac" python -m pytest -q -p no:cacheprovider tests/unit
|
|
|
|
- name: Build
|
|
run: ansible-galaxy collection build --force
|