-
Notifications
You must be signed in to change notification settings - Fork 0
171 lines (161 loc) · 6.15 KB
/
Copy pathci.yml
File metadata and controls
171 lines (161 loc) · 6.15 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
name: CI
'on':
push:
branches: [main]
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
CARGO_BINSTALL_VERSION: '1.15.7'
WHITAKER_INSTALLER_VERSION: '0.2.1'
jobs:
build:
name: build
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Setup Rust
uses: leynos/shared-actions/.github/actions/setup-rust@b61ad14766ae81b830abdaf066eb3d9b6c4f537b
- name: Build
run: make build
check-fmt:
name: check-fmt
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Setup Rust
uses: leynos/shared-actions/.github/actions/setup-rust@b61ad14766ae81b830abdaf066eb3d9b6c4f537b
- name: Check formatting
run: make check-fmt
lint:
name: lint
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Setup Rust
uses: leynos/shared-actions/.github/actions/setup-rust@b61ad14766ae81b830abdaf066eb3d9b6c4f537b
- name: Cache Whitaker installer
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306
with:
path: |
~/.cargo/bin/whitaker-installer
~/.cache/cargo-binstall
~/.local/share/whitaker
key: whitaker-installer-${{ runner.os }}-${{ runner.arch }}-${{ env.WHITAKER_INSTALLER_VERSION }}
- name: Install Whitaker
shell: bash
run: |
set -euxo pipefail
if command -v cargo-binstall >/dev/null 2>&1; then
echo "cargo-binstall already present"
else
cargo install cargo-binstall --locked --version "${{ env.CARGO_BINSTALL_VERSION }}"
fi
if command -v whitaker-installer >/dev/null 2>&1; then
echo "whitaker-installer already present; skipping cargo binstall"
else
cargo binstall --no-confirm whitaker-installer@${{ env.WHITAKER_INSTALLER_VERSION }}
fi
whitaker-installer
- name: Lint
run: make lint
test:
name: test
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Setup Rust
uses: leynos/shared-actions/.github/actions/setup-rust@b61ad14766ae81b830abdaf066eb3d9b6c4f537b
- name: Test
run: make test
docs-gate:
name: docs-gate
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 0
- name: Setup Rust
uses: leynos/shared-actions/.github/actions/setup-rust@b61ad14766ae81b830abdaf066eb3d9b6c4f537b
- name: Build docs-gate helper
shell: bash
run: |
set -euo pipefail
cargo build --quiet -p repovec-ci
- name: Decide whether documentation gates should run
id: docs_gate_plan
shell: bash
run: |
set -euo pipefail
base_ref=""
if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then
base_ref="${{ github.event.pull_request.base.sha }}"
elif [[ "${GITHUB_EVENT_NAME}" == "push" ]]; then
base_ref="${{ github.event.before }}"
fi
if [[ -n "${base_ref}" && "${base_ref}" != "0000000000000000000000000000000000000000" ]]; then
mapfile -t changed_files < <(git diff --name-only "${base_ref}" "${GITHUB_SHA}")
else
changed_files=()
fi
if [[ "${#changed_files[@]}" -gt 0 ]]; then
printf '%s\n' "${changed_files[@]}" | target/debug/repovec-ci --stdin >>"${GITHUB_OUTPUT}"
else
target/debug/repovec-ci >>"${GITHUB_OUTPUT}"
fi
- name: Report documentation gate decision
shell: bash
run: |
set -euo pipefail
echo "should_run=${{ steps.docs_gate_plan.outputs.should_run }}"
echo "docs_gate_required=${{ steps.docs_gate_plan.outputs.docs_gate_required }}"
echo "nixie_required=${{ steps.docs_gate_plan.outputs.nixie_required }}"
echo "reason=${{ steps.docs_gate_plan.outputs.reason }}"
echo "matched_files_count=${{ steps.docs_gate_plan.outputs.matched_files_count }}"
echo "matched_files=${{ steps.docs_gate_plan.outputs.matched_files }}"
echo "conservative_fallback_files_count=${{ steps.docs_gate_plan.outputs.conservative_fallback_files_count }}"
echo "conservative_fallback_files=${{ steps.docs_gate_plan.outputs.conservative_fallback_files }}"
- name: Install markdownlint-cli2
if: steps.docs_gate_plan.outputs.docs_gate_required == 'true'
shell: bash
run: |
set -euo pipefail
npm install --global markdownlint-cli2@0.22.0
- name: Markdown lint
if: steps.docs_gate_plan.outputs.docs_gate_required == 'true'
run: make markdownlint
- uses: oven-sh/setup-bun@0c5077e514
if: steps.docs_gate_plan.outputs.nixie_required == 'true'
with:
bun-version: "1.3.12"
- name: Install Mermaid CLI
if: steps.docs_gate_plan.outputs.nixie_required == 'true'
shell: bash
run: |
set -euxo pipefail
bun install --global @mermaid-js/mermaid-cli@11.9.0
bun x @puppeteer/browsers browsers install chrome-headless-shell
mmdc --version
- name: Install nixie
if: steps.docs_gate_plan.outputs.nixie_required == 'true'
shell: bash
run: |
set -euo pipefail
uv tool install git+https://github.com/leynos/nixie@68240ea737bed95fe6d420ccc5e737aea9149a94
- name: Mermaid validation
if: steps.docs_gate_plan.outputs.nixie_required == 'true'
run: make nixie
- name: Skip documentation gates
if: steps.docs_gate_plan.outputs.docs_gate_required != 'true'
run: echo "No documentation inputs detected; documentation gates skipped."