Repository navigation
128 lines (128 loc) · 4.22 KB
/
Copy pathci.yaml
File metadata and controls
128 lines (128 loc) · 4.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
name: Check
on:
pull_request:
types: [opened, reopened, synchronize]
permissions: {}
concurrency:
group: check-${{ github.ref }}-${{ github.run_attempt > 1 && github.run_id || 'current' }}
cancel-in-progress: ${{ github.run_attempt == 1 }}
jobs:
check:
name: 🧹 Check formatting
uses: $/.github/workflows/cooled-hooks.yaml
permissions:
contents: read
shell:
name: 🧹 Check inline shell
runs-on: ubuntu-26.04
permissions:
contents: read
steps:
- name: 📥 Check out repository
uses: actions/checkout@v7.0.1
with:
fetch-depth: 1
persist-credentials: false
- name: 💾 Restore prek cache
uses: actions/cache@v6.1.0
with:
path: ~/.cache/prek
key: prek-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.pre-commit-config.yaml') }}
- name: 🐍 Install uv and Python
uses: astral-sh/setup-uv@v10.3.3
with:
version: latest-known
python-version: "3.15"
enable-cache: true
cache-suffix: ${{ github.job }}
cache-dependency-glob: pyproject.toml
- name: 📦 Install release tools
env:
EXCLUDE_NEWER: 7 days
run: |
tools/install_live_tools.py .release-tools 'prek>=0.2' 'yq>=4.4.5'
uv run --no-project --python .release-tools python tools/expose_locked_commands.py .release-tools
- name: 🧹 Check inline shell
run: |
set -euo pipefail
script_dir=./inline-shell-check
mkdir "$script_dir"
trap 'rm -rf "$script_dir"' EXIT
for file in .github/workflows/*.yaml */action.yml; do
yq -rj '[.. | objects | select(has("run")) | .run] | .[] | . + "\u0000"' "$file" \
>"$RUNNER_TEMP/run-blocks"
index=0
while IFS= read -r -d '' script; do
script_file="$script_dir/run-${file//\//-}-$index.sh"
printf '#!/usr/bin/env bash\n%s\n' "${script%$'\n'}" >"$script_file"
index=$((index + 1))
done <"$RUNNER_TEMP/run-blocks"
done
scripts=("$script_dir"/*.sh)
echo "Checking ${#scripts[@]} run blocks from the workflows and Actions with shellcheck and shfmt"
tools/cooled_prek.py run shellcheck --files "$script_dir"/*.sh
tools/cooled_prek.py run shfmt --files "$script_dir"/*.sh
test:
name: 🧪 Test actions
runs-on: ubuntu-26.04
permissions:
contents: read
steps:
- name: 📥 Check out repository
uses: actions/checkout@v7.0.1
with:
fetch-depth: 1
persist-credentials: false
- name: 🐍 Install uv and Python
uses: astral-sh/setup-uv@v10.3.3
with:
version: latest-known
python-version: "3.15"
enable-cache: true
cache-suffix: ${{ github.job }}
cache-dependency-glob: pyproject.toml
- name: 🧪 Run Action tests
env:
EXCLUDE_NEWER: 7 days
run: uvx --exclude-newer "$EXCLUDE_NEWER" --with tox-uv tox run -e test
type:
name: 🔎 Type check
runs-on: ubuntu-26.04
permissions:
contents: read
steps:
- name: 📥 Check out repository
uses: actions/checkout@v7.0.1
with:
persist-credentials: false
- name: 🐍 Install uv and Python
uses: astral-sh/setup-uv@v10.3.3
with:
version: latest-known
python-version: "3.15"
enable-cache: true
cache-suffix: ${{ github.job }}
cache-dependency-glob: pyproject.toml
- name: 🔎 Check Python types
env:
EXCLUDE_NEWER: 7 days
run: uvx --exclude-newer "$EXCLUDE_NEWER" --with tox-uv tox run -e type
release:
name: 🏷️ Release dry run
uses: $/.github/workflows/prepare-release.yaml
permissions:
contents: read
pull-requests: read
with:
dry-run: true
gate:
name: 🚦 Required checks pass
if: ${{ !cancelled() }}
needs: [check, shell, test, type, release]
runs-on: ubuntu-26.04
permissions: {}
steps:
- name: 🚦 Require all needed jobs to pass
uses: $/required-checks
with:
needs: ${{ toJSON(needs) }}