-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (65 loc) · 2.08 KB
/
Copy pathci.yml
File metadata and controls
80 lines (65 loc) · 2.08 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
name: CI
on:
push:
branches: [main]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
checks:
name: ${{ matrix.name }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: Style wiring
run: uv run matchory-coding-style verify --strict
- name: Style selector
run: uv run matchory-coding-style sync --check --preset strict
- name: Lint
run: uv run ruff check --no-cache .
- name: Formatting
run: uv run ruff format --no-cache --check .
- name: Tests
run: uv run pytest -q
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
with:
enable-cache: true
- name: Install dependencies
run: uv sync --locked
- name: ${{ matrix.name }}
run: ${{ matrix.run }}
pinned-actions:
name: Actions are pinned to commit SHAs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Check every `uses:` is a 40-character SHA
run: |
status=0
while IFS= read -r line; do
reference="${line#*uses:}"
reference="$(printf '%s' "${reference}" | tr -d ' ' | cut -d'#' -f1)"
case "${reference}" in
./*|docker://*) continue ;;
esac
version="${reference##*@}"
if ! printf '%s' "${version}" | grep -Eq '^[0-9a-f]{40}$'; then
echo "::error::unpinned action: ${reference}"
status=1
fi
done < <(grep -rhE '^\s*-?\s*uses:' .github/)
if [ "${status}" -eq 0 ]; then
echo "All actions are pinned to commit SHAs"
fi
exit "${status}"