# 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.6" # 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 # The 26.04 image (act-latest) makes setup-python fetch a Python built for # a newer CPU than swarm-runner has ("CPU ISA level is lower than # required"); on 24.04 it fetches one that runs there. container: image: catthehacker/ubuntu:act-24.04@sha256:ebfc2752875ebb29fbfa360db9dcd2f76bc160147ec6bd1b035bba0ef8b38fbe steps: - uses: actions/checkout@v7 - name: gitleaks uses: https://git.rfa.cz/tth-pub/ci-actions/gitleaks@v17 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// # 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