Skip to content

Commit e58eb0a

Browse files
committed
Fix docs workflow cache artifact fallback
1 parent 3984211 commit e58eb0a

File tree

6 files changed

+77
-273
lines changed

6 files changed

+77
-273
lines changed

.cigen/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ source_file_groups:
2323

2424
docs:
2525
- "*.md"
26-
- "docs/**/*.md"
26+
- "docs/**/*"
2727
- "notes/**/*.md"

.cigen/workflows/docs/jobs/build.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
image: ubuntu-latest
1+
image: rust:latest
2+
3+
source_files: "@docs"
24

35
requires:
46
- ci_gate

.github/workflows/ci.yml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ jobs:
4343
cp target/release/cigen .cigen/bin/cigen
4444
- uses: actions/upload-artifact@v4
4545
with:
46-
name: cigen-bin
4746
path: .cigen/bin/cigen
47+
name: cigen-bin
4848
clippy:
4949
runs-on: ubuntu-latest
5050
container:
@@ -78,6 +78,16 @@ jobs:
7878
with:
7979
name: cigen-bin
8080
path: .cigen/bin
81+
continue-on-error: true
82+
- name: Ensure cigen binary
83+
run: |
84+
set -e
85+
if [ ! -x .cigen/bin/cigen ]; then
86+
echo 'cigen binary not found; building from source'
87+
cargo build --release --bin cigen
88+
mkdir -p .cigen/bin
89+
cp target/release/cigen .cigen/bin/cigen
90+
fi
8191
- name: Prepare cigen binary
8292
run: |
8393
set -e
@@ -159,6 +169,16 @@ jobs:
159169
with:
160170
name: cigen-bin
161171
path: .cigen/bin
172+
continue-on-error: true
173+
- name: Ensure cigen binary
174+
run: |
175+
set -e
176+
if [ ! -x .cigen/bin/cigen ]; then
177+
echo 'cigen binary not found; building from source'
178+
cargo build --release --bin cigen
179+
mkdir -p .cigen/bin
180+
cp target/release/cigen .cigen/bin/cigen
181+
fi
162182
- name: Prepare cigen binary
163183
run: |
164184
set -e
@@ -240,6 +260,16 @@ jobs:
240260
with:
241261
name: cigen-bin
242262
path: .cigen/bin
263+
continue-on-error: true
264+
- name: Ensure cigen binary
265+
run: |
266+
set -e
267+
if [ ! -x .cigen/bin/cigen ]; then
268+
echo 'cigen binary not found; building from source'
269+
cargo build --release --bin cigen
270+
mkdir -p .cigen/bin
271+
cp target/release/cigen .cigen/bin/cigen
272+
fi
243273
- name: Prepare cigen binary
244274
run: |
245275
set -e

.github/workflows/docs.yml

Lines changed: 12 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ name: DOCS
2020
jobs:
2121
build:
2222
runs-on: ubuntu-latest
23+
container:
24+
image: rust:latest
2325
needs:
2426
- ci_gate
2527
steps:
@@ -49,6 +51,16 @@ jobs:
4951
with:
5052
name: cigen-bin
5153
path: .cigen/bin
54+
continue-on-error: true
55+
- name: Ensure cigen binary
56+
run: |
57+
set -e
58+
if [ ! -x .cigen/bin/cigen ]; then
59+
echo 'cigen binary not found; building from source'
60+
cargo build --release --bin cigen
61+
mkdir -p .cigen/bin
62+
cp target/release/cigen .cigen/bin/cigen
63+
fi
5264
- name: Prepare cigen binary
5365
run: |
5466
set -e
@@ -163,59 +175,11 @@ jobs:
163175
fi
164176
- name: Checkout repository
165177
uses: actions/checkout@v4
166-
- name: Download cigen binary
167-
uses: actions/download-artifact@v4
168-
with:
169-
name: cigen-bin
170-
path: .cigen/bin
171-
- name: Prepare cigen binary
172-
run: |
173-
set -e
174-
mkdir -p .cigen/bin
175-
chmod +x .cigen/bin/cigen
176-
- name: Compute source hash
177-
id: compute_hash
178-
run: |
179-
set -euo pipefail
180-
mkdir -p .cigen/skip-cache
181-
mkdir -p .cigen/cache
182-
./.cigen/bin/cigen hash \
183-
--job ci_gate \
184-
--config .cigen \
185-
--base-dir . \
186-
--output job_hash \
187-
--cache .cigen/cache/file-hashes.json
188-
- name: Restore skip cache
189-
id: job_skip_cache
190-
uses: actions/cache@v4
191-
with:
192-
path: .cigen/skip-cache/ci_gate
193-
key: job-skip-${ runner.os }-ci_gate-${ steps.compute_hash.outputs.job_hash }
194-
restore-keys: job-skip-${ runner.os }-ci_gate-
195-
if: ${{ env.ACT != 'true' }}
196-
- name: Skip job (cached)
197-
if: steps.job_skip_cache.outputs.cache-hit == 'true'
198-
run: echo 'Job cache hit; skipping remaining steps.' && exit 0
199178
- uses: actions/github-script@v7
200179
with:
201180
script: |
202181
const wait = require('./.github/wait-for-checks.js');
203182
await wait({ github, context, core, checks: ["test"] });
204-
if: steps.job_skip_cache.outputs.cache-hit != 'true'
205-
- name: Record job completion
206-
if: success() && steps.job_skip_cache.outputs.cache-hit != 'true'
207-
run: |
208-
set -e
209-
HASH="${JOB_HASH}"
210-
if [ -z "$HASH" ]; then
211-
echo 'JOB_HASH missing' >&2
212-
exit 1
213-
fi
214-
MARKER=.cigen/skip-cache/ci_gate/$HASH
215-
mkdir -p "$(dirname "$MARKER")"
216-
date > "$MARKER"
217-
env:
218-
JOB_HASH: ${{ steps.compute_hash.outputs.job_hash }}
219183
deploy:
220184
environment:
221185
name: github-pages
@@ -245,52 +209,4 @@ jobs:
245209
fi
246210
- name: Checkout repository
247211
uses: actions/checkout@v4
248-
- name: Download cigen binary
249-
uses: actions/download-artifact@v4
250-
with:
251-
name: cigen-bin
252-
path: .cigen/bin
253-
- name: Prepare cigen binary
254-
run: |
255-
set -e
256-
mkdir -p .cigen/bin
257-
chmod +x .cigen/bin/cigen
258-
- name: Compute source hash
259-
id: compute_hash
260-
run: |
261-
set -euo pipefail
262-
mkdir -p .cigen/skip-cache
263-
mkdir -p .cigen/cache
264-
./.cigen/bin/cigen hash \
265-
--job deploy \
266-
--config .cigen \
267-
--base-dir . \
268-
--output job_hash \
269-
--cache .cigen/cache/file-hashes.json
270-
- name: Restore skip cache
271-
id: job_skip_cache
272-
uses: actions/cache@v4
273-
with:
274-
path: .cigen/skip-cache/deploy
275-
key: job-skip-${ runner.os }-deploy-${ steps.compute_hash.outputs.job_hash }
276-
restore-keys: job-skip-${ runner.os }-deploy-
277-
if: ${{ env.ACT != 'true' }}
278-
- name: Skip job (cached)
279-
if: steps.job_skip_cache.outputs.cache-hit == 'true'
280-
run: echo 'Job cache hit; skipping remaining steps.' && exit 0
281212
- uses: actions/deploy-pages@v4
282-
if: steps.job_skip_cache.outputs.cache-hit != 'true'
283-
- name: Record job completion
284-
if: success() && steps.job_skip_cache.outputs.cache-hit != 'true'
285-
run: |
286-
set -e
287-
HASH="${JOB_HASH}"
288-
if [ -z "$HASH" ]; then
289-
echo 'JOB_HASH missing' >&2
290-
exit 1
291-
fi
292-
MARKER=.cigen/skip-cache/deploy/$HASH
293-
mkdir -p "$(dirname "$MARKER")"
294-
date > "$MARKER"
295-
env:
296-
JOB_HASH: ${{ steps.compute_hash.outputs.job_hash }}

0 commit comments

Comments
 (0)