-
Notifications
You must be signed in to change notification settings - Fork 0
160 lines (141 loc) · 5.11 KB
/
Copy pathparse.yml
File metadata and controls
160 lines (141 loc) · 5.11 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
name: parse
# Daily freshness sweep + per-crate parse jobs.
#
# All work happens in the `codeview` Rust CLI now — TypeScript scripts
# are gone. Each job calls one `codeview cron *` subcommand:
#
# freshness → `codeview cron sweep`
# parse → `codeview cron parse-one`
# catalog → `codeview cron catalog`
#
# Std crates are out of scope here — see std.yml.
on:
schedule:
- cron: '0 3 * * *'
workflow_dispatch:
inputs:
force:
description: 'Comma-separated crate names to force-parse (skip freshness)'
required: false
default: ''
max_crates:
description: 'Cap on stale crates parsed this run'
required: false
default: '20'
watchlist:
description: "'catalog' | 'top:N' | path/to/file"
required: false
default: 'catalog'
env:
R2_BUCKET: crate-graphs
STATIC_R2_TARGET: remote
PARSER_REVISION: ${{ github.sha }}
# R2 over the S3-compatible endpoint
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
# Skip the SvelteKit bundle that codeview-cli's build.rs embeds — the
# cron subcommands don't need it.
CODEVIEW_SKIP_SIDECAR: '1'
jobs:
freshness:
name: freshness sweep
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.sweep.outputs.matrix }}
count: ${{ steps.sweep.outputs.count }}
steps:
- uses: actions/checkout@v6
- name: Install Rust stable
uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
with:
shared-key: cron-release
- name: Build codeview-cli (release)
run: cargo build --release -p codeview-cli
- name: Run sweep
id: sweep
run: |
target/release/codeview cron sweep \
--watchlist "${{ inputs.watchlist || 'catalog' }}" \
--max-crates "${{ inputs.max_crates || '20' }}" \
--force "${{ inputs.force || '' }}" \
--bucket "$R2_BUCKET" \
--quiet
parse:
name: parse ${{ matrix.crate.name }}@${{ matrix.crate.version }}
needs: freshness
if: needs.freshness.outputs.count != '0' && needs.freshness.outputs.count != ''
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 10
matrix: ${{ fromJSON(needs.freshness.outputs.matrix) }}
steps:
- uses: actions/checkout@v6
- name: Install Rust nightly (for the codeview-rustdoc parser path)
uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
with:
toolchain: nightly
- uses: Swatinem/rust-cache@v2
with:
shared-key: cron-release
- name: Build codeview-cli (release)
run: cargo build --release -p codeview-cli
- name: Parse + publish + record freshness
env:
NAME: ${{ matrix.crate.name }}
VERSION: ${{ matrix.crate.version }}
# codeview cron parse-one exit codes:
# 0 ok
# 64 transient (retry next sweep)
# 65 permanent (don't retry until parser/schema changes)
# 70 internal bug — page a human
run: |
set +e
target/release/codeview cron parse-one \
--name "$NAME" \
--version "$VERSION" \
--bucket "$R2_BUCKET"
code=$?
set -e
case $code in
0) echo "::notice title=parse $NAME@$VERSION::ok" ;;
64) echo "::warning title=parse $NAME@$VERSION::transient — will retry next sweep" ;;
65) echo "::warning title=parse $NAME@$VERSION::permanent — skipping until parser/schema changes" ;;
*) echo "::error title=parse $NAME@$VERSION::internal error (exit $code)" ;;
esac
# Translate handled non-zero codes back to 0 so they don't flag
# the whole job as failed.
exit $([ $code -le 65 ] && echo 0 || echo $code)
catalog:
name: rebuild catalog
needs: [freshness, parse]
if: always() && needs.freshness.outputs.count != '0' && needs.freshness.outputs.count != ''
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Rust stable
uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
with:
shared-key: cron-release
- name: Build codeview-cli (release)
run: cargo build --release -p codeview-cli
- name: Rebuild rust/catalog.json from freshness index
run: target/release/codeview cron catalog --bucket "$R2_BUCKET"
summary:
name: parse summary
needs: [freshness, parse, catalog]
if: always() && needs.freshness.outputs.count != '0'
runs-on: ubuntu-latest
steps:
- name: Echo summary
run: |
echo "freshness produced ${{ needs.freshness.outputs.count }} stale crates"
echo "parse job result: ${{ needs.parse.result }}"
echo "catalog job result: ${{ needs.catalog.result }}"