From 7c2604108cf8716743089425943659528ae1db71 Mon Sep 17 00:00:00 2001 From: Jens Tirsvad Nielsen Date: Tue, 13 Oct 2026 16:27:09 +0800 Subject: [PATCH 1/2] Run yamllint and actionlint in CI No issue closed: CI change requested by S01. --- .gitea/workflows/ci.yml | 98 ++++++++++++++++++++++------------------- .yamllint.yml | 6 +-- README.md | 3 +- 3 files changed, 57 insertions(+), 50 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index a9460a4..18490bb 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -1,46 +1,52 @@ -# Continuous integration for the squirrel census project: runs the pytest tests -# on Python 3.13 for every push and pull request. Read by Gitea Actions (a -# runner must be registered for the repository). It changes nothing outside the -# repository and uses no secret. Decision: MIL-001 task "Add CI workflow". -# Host: Gitea Actions; uses only github.* contexts, so it also runs on GitHub. - -name: Tests - -on: - push: - branches: [main] - pull_request: - -permissions: - contents: read - -env: - PYTHON_VERSION: "3.13" - PIP_VERSION: "26.2.1" - -concurrency: - group: tests-${{ github.ref }} - cancel-in-progress: true - -jobs: - pytest: - name: Run the tests - runs-on: ubuntu-latest - timeout-minutes: 10 - steps: - - name: Check out the code - uses: actions/checkout@v4.2.2 - - - name: Set up Python - uses: actions/setup-python@v5.6.0 - with: - python-version: ${{ env.PYTHON_VERSION }} - - - name: Create the virtual environment and install - run: | - python -m venv .venv - .venv/bin/python -m pip install --upgrade "pip==${PIP_VERSION}" - .venv/bin/python -m pip install -e ".[dev]" - - - name: Run the tests - run: .venv/bin/python -m pytest +# Continuous integration for the squirrel census project: lints the YAML and +# workflow files and runs the pytest tests on Python 3.13 for every push and +# pull request. Read by Gitea Actions (a runner must be registered for the +# repository). It changes nothing outside the repository and uses no secret. Decision: MIL-001 task "Add CI workflow". +# Host: Gitea Actions; uses only github.* contexts, so it also runs on GitHub. + +name: Tests + +on: + push: + branches: [main] + pull_request: + +permissions: + contents: read + +env: + PYTHON_VERSION: "3.13" + PIP_VERSION: "26.2.1" + +concurrency: + group: tests-${{ github.ref }} + cancel-in-progress: true + +jobs: + pytest: + name: Run the tests + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Check out the code + uses: actions/checkout@v4.2.2 + + - name: Set up Python + uses: actions/setup-python@v5.6.0 + with: + python-version: ${{ env.PYTHON_VERSION }} + + - name: Create the virtual environment and install + run: | + python -m venv .venv + .venv/bin/python -m pip install --upgrade "pip==${PIP_VERSION}" + .venv/bin/python -m pip install -e ".[dev]" + + - name: Lint the YAML files + run: .venv/bin/python -m yamllint -c .yamllint.yml .gitea .yamllint.yml + + - name: Lint the workflow files + run: .venv/bin/actionlint .gitea/workflows/*.yml + + - name: Run the tests + run: .venv/bin/python -m pytest diff --git a/.yamllint.yml b/.yamllint.yml index e35c665..cf517e2 100644 --- a/.yamllint.yml +++ b/.yamllint.yml @@ -6,6 +6,6 @@ rules: max: 100 truthy: check-keys: false - # Git on Windows checks files out with CRLF; the repository blob has LF. - new-lines: - type: platform + # Line endings are normalised by git (LF in the repository, CRLF in some + # Windows checkouts), so the rule would fail on a local checkout only. + new-lines: disable diff --git a/README.md b/README.md index 87fac0c..b5865ec 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,8 @@ it is present. The workflow [`.gitea/workflows/ci.yml`][ci] runs for every push to `main` and for every pull request. It sets up Python 3.13, creates a `.venv`, upgrades `pip`, installs the -project with `.[dev]` and runs `python -m pytest`. It uses `github.*` contexts only, so +project with `.[dev]`, lints the YAML and workflow files with `yamllint` and +`actionlint`, and runs `python -m pytest`. It uses `github.*` contexts only, so it also runs on GitHub Actions. ## Build the source documentation From 16811c53fa17c1b3c14738e0605df23908740567 Mon Sep 17 00:00:00 2001 From: Jens Tirsvad Nielsen Date: Tue, 13 Oct 2026 16:27:26 +0800 Subject: [PATCH 2/2] Wrap the workflow header comment to the yamllint line limit --- .gitea/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 18490bb..c325dd5 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -1,7 +1,8 @@ # Continuous integration for the squirrel census project: lints the YAML and # workflow files and runs the pytest tests on Python 3.13 for every push and # pull request. Read by Gitea Actions (a runner must be registered for the -# repository). It changes nothing outside the repository and uses no secret. Decision: MIL-001 task "Add CI workflow". +# repository). It changes nothing outside the repository and uses no secret. +# Decision: MIL-001 task "Add CI workflow". # Host: Gitea Actions; uses only github.* contexts, so it also runs on GitHub. name: Tests