Skip to content

Commit f79de80

Browse files
authored
Add ci workflow and run.sh tasks file (#15)
1 parent 3c66177 commit f79de80

File tree

5 files changed

+101
-3
lines changed

5 files changed

+101
-3
lines changed

.github/workflows/ci.yaml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
name: "CI"
3+
concurrency: # Cancel any existing runs of this workflow for this same PR
4+
group: "${{ github.workflow }}-${{ github.ref }}"
5+
cancel-in-progress: true
6+
on: # yamllint disable-line
7+
push:
8+
branches:
9+
- "main"
10+
tags:
11+
- "v*"
12+
pull_request:
13+
14+
jobs:
15+
shellcheck:
16+
runs-on: "ubuntu-24.04"
17+
steps:
18+
- uses: "actions/checkout@v4"
19+
- run: "shellcheck run.sh"
20+
21+
lint:
22+
runs-on: "ubuntu-24.04"
23+
steps:
24+
- uses: "actions/checkout@v4"
25+
- uses: "astral-sh/setup-uv@v5"
26+
with:
27+
version: "0.6.6"
28+
- run: "./run.sh setup"
29+
- run: "./run.sh lint"
30+
31+
# tests:
32+
# runs-on: "ubuntu-24.04"
33+
# strategy:
34+
# matrix:
35+
# python-version:
36+
# - "3.9"
37+
# - "3.10"
38+
# - "3.11"
39+
# - "3.12"
40+
# - "3.13"
41+
# steps:
42+
# - uses: "actions/checkout@v4"
43+
# - uses: "astral-sh/setup-uv@v5"
44+
# with:
45+
# version: "0.6.6"
46+
# python-version: "${{ matrix.python-version }}"

.readthedocs.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ build:
1717
- "asdf install uv latest"
1818
- "asdf global uv latest"
1919
install:
20-
- "uv sync"
20+
- "uv sync --no-dev"
2121
post_install:
2222
- "uv run ansible-galaxy collection install -r docs/requirements.yaml"
2323
build:

.yamllint.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
22
extends: "default"
33
rules:
4-
comments: "enable"
4+
comments:
5+
min-spaces-from-content: 1
56
indentation:
67
spaces: 2
78
indent-sequences: true

mkdocs.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ markdown_extensions:
7575
watch:
7676
- "README.md"
7777

78-
nav:
78+
nav: # yamllint disable rule:indentation
7979
- "index.md"
8080
- "User Guide": "user_guide.md"
8181
- "Ansible Builtins": "ansible.builtin"

run.sh

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/usr/bin/env bash
2+
3+
set -o errexit
4+
set -o pipefail
5+
6+
# -----------------------------------------------------------------------------
7+
# Helper functions start with _ and aren't listed in this script's help menu.
8+
# -----------------------------------------------------------------------------
9+
10+
function _uvr {
11+
uv run "$@"
12+
}
13+
14+
# -----------------------------------------------------------------------------
15+
16+
function setup {
17+
echo "---------- Installing python environment via uv."
18+
_uvr uv sync
19+
}
20+
21+
function lint {
22+
echo "---------- LINTING WITH RUFF"
23+
_uvr ruff check mkdocs_ansible_collection
24+
echo "---------- CHECKING FORMATTING WITH RUFF"
25+
_uvr ruff format --check --diff mkdocs_ansible_collection
26+
echo "---------- LINTING WITH YAMLLINT"
27+
_uvr yamllint .
28+
}
29+
30+
function autofix {
31+
echo "---------- RUFF CHECK AUTOFIX"
32+
_uvr ruff check --fix mkdocs_ansible_collection
33+
echo "---------- FORMATTING WITH RUFF"
34+
_uvr ruff format mkdocs_ansible_collection
35+
}
36+
37+
# TODO: function test
38+
# TODO: function docs
39+
40+
# -----------------------------------------------------------------------------
41+
42+
function help {
43+
printf "%s <task> [args]\n\nTasks:\n" "${0}"
44+
45+
compgen -A function | grep -v "^_" | cat -n
46+
47+
printf "\nExtended help:\n Each task has comments for general usage\n"
48+
}
49+
50+
TIMEFORMAT=$'\nTask completed in %3lR'
51+
time "${@:-help}"

0 commit comments

Comments
 (0)