-
Notifications
You must be signed in to change notification settings - Fork 0
122 lines (105 loc) · 3.99 KB
/
Copy pathdocs-source.yml
File metadata and controls
122 lines (105 loc) · 3.99 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
name: Reusable documentation source validation
on:
workflow_call:
inputs:
docs_commit:
description: Immutable full commit of spice-framework/docs used for validation.
required: true
type: string
permissions:
contents: read
jobs:
validate:
name: Documentation source
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Validate immutable docs commit input
env:
DOCS_COMMIT: ${{ inputs.docs_commit }}
shell: bash
run: |
if [[ ! "$DOCS_COMMIT" =~ ^[0-9a-f]{40}$ ]]; then
echo "docs_commit must be a lowercase full Git commit" >&2
exit 1
fi
- name: Checkout source repository
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
path: source
persist-credentials: false
- name: Checkout immutable documentation validator
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
repository: spice-framework/docs
ref: ${{ inputs.docs_commit }}
path: portal
persist-credentials: false
- name: Configure exact Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24.11.1
- name: Read exact snapshot materializer commit
id: source-lock
working-directory: portal
shell: bash
run: |
commit="$(node -p "require('./sources/ecosystem.lock.json').catalog.commit")"
[[ "$commit" =~ ^[0-9a-f]{40}$ ]]
echo "development=$commit" >> "$GITHUB_OUTPUT"
- name: Checkout exact snapshot materializer
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
repository: spice-framework/development
ref: ${{ steps.source-lock.outputs.development }}
path: portal/.generated/tools/development
persist-credentials: false
- name: Render generic snapshot lock
working-directory: portal
run: >-
node scripts/render-materializer-lock.mjs
sources/ecosystem.lock.json
.generated/materializer-lock.json
- name: Configure exact Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: 1.26.5
cache: false
- name: Materialize exact ecosystem snapshot
working-directory: portal/.generated/tools/development
env:
GOTOOLCHAIN: local
run: >-
go run ./cmd/spice-dev snapshot materialize
--lock "$GITHUB_WORKSPACE/portal/.generated/materializer-lock.json"
--root "$GITHUB_WORKSPACE/portal/.generated/sources"
- name: Activate exact pnpm
shell: bash
run: |
corepack enable
corepack prepare pnpm@11.16.0 --activate
- name: Install locked portal dependencies
working-directory: portal
run: pnpm install --frozen-lockfile
- name: Install preview browser
working-directory: portal
run: pnpm exec playwright install --with-deps chromium
- name: Validate and build the source overlay
working-directory: portal
env:
SOURCE_COMMIT: ${{ github.sha }}
SOURCE_REPOSITORY: ${{ github.repository }}
run: pnpm run preview:source --source ../source --repository "$SOURCE_REPOSITORY" --commit "$SOURCE_COMMIT"
- name: Verify preview behavior and accessibility
working-directory: portal
run: pnpm run test:e2e && pnpm run test:a11y && pnpm run test:visual
- name: Upload preview evidence
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: documentation-source-${{ github.event.repository.name }}-${{ github.run_id }}
path: |
portal/.artifacts/source-preview
portal/dist
if-no-files-found: warn
retention-days: 7