-
Notifications
You must be signed in to change notification settings - Fork 535
144 lines (134 loc) · 5.29 KB
/
website-validation.yml
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
name: Website validation
on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- "docs/**"
- "*.md"
- "**/*.md"
- "!.changeset/**"
- "!build-tools/**"
- "!RELEASE_NOTES/**"
- "!server/**"
defaults:
run:
working-directory: ./docs
permissions:
pull-requests: read
jobs:
# Build the website (including API documentation).
# Publish the build artifact for subsequent jobs to leverage.
build_site:
runs-on: ubuntu-latest
name: Build site
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # ratchet:actions/checkout@v4
with:
submodules: false
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # ratchet:pnpm/action-setup@v4
- uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # ratchet:actions/setup-node@v3
with:
node-version: "18"
cache: "pnpm"
cache-dependency-path: docs/pnpm-lock.yaml
- name: Build site artifact
run: |
pnpm i --frozen-lockfile
npm run build
- name: Upload site artifact
# release notes: https://github.com/actions/upload-artifact/releases/tag/v4.4.3
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # ratchet:actions/upload-artifact@v4
with:
name: fluidframework-site
path: docs/build
retention-days: 3
# Run linter checks against the website content and infrastructure.
lint:
runs-on: ubuntu-latest
name: pnpm lint
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # ratchet:actions/checkout@v4
with:
submodules: false
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # ratchet:pnpm/action-setup@v4
- uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # ratchet:actions/setup-node@v3
with:
node-version: "18"
cache: "pnpm"
cache-dependency-path: docs/pnpm-lock.yaml
- name: pnpm lint
run: |
pnpm i --frozen-lockfile
pnpm lint
# Run the website's tests.
test:
runs-on: ubuntu-latest
name: 🧪 Website Tests
needs: build_site
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # ratchet:actions/checkout@v3
with:
submodules: false
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # ratchet:pnpm/action-setup@v4
- uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # ratchet:actions/setup-node@v3
with:
node-version: "18"
cache: "pnpm"
cache-dependency-path: docs/pnpm-lock.yaml
- name: Download site artifact
# release notes: https://github.com/actions/download-artifact/releases/tag/v4.1.8
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # ratchet:actions/download-artifact@v4
with:
name: fluidframework-site
path: docs/build
- name: Install dependencies
run: "pnpm i --frozen-lockfile"
- name: Run tests
run: "npm run test"
# Run the link checker against the website.
# Publish the results to the PR as a comment.
broken_link_check:
runs-on: ubuntu-latest
name: 🔗 Broken Link Check
needs: build_site
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # ratchet:actions/checkout@v3
with:
submodules: false
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # ratchet:pnpm/action-setup@v4
- uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # ratchet:actions/setup-node@v3
with:
node-version: "18"
cache: "pnpm"
cache-dependency-path: docs/pnpm-lock.yaml
- name: Create results folder
run: mkdir -p ./results
- name: Download site artifact
# release notes: https://github.com/actions/download-artifact/releases/tag/v4.1.8
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # ratchet:actions/download-artifact@v4
with:
name: fluidframework-site
path: docs/build
- name: Install dependencies
run: "pnpm i --frozen-lockfile"
- name: Check for broken links
id: linkcheck
continue-on-error: true
run: |
set -o pipefail
pnpm run ci:check-links | tee ./results/linkcheck-output.txt
- name: Save PR number
run: echo ${{ github.event.number }} > ./results/pr
- name: Save linkcheck report
run: |
cat "$GITHUB_WORKSPACE/.github/workflows/data/linkcheck-${{ steps.linkcheck.outcome }}.md" | tee ./results/linkcheck
echo -e "\n#### linkcheck output\n\n\`\`\`" | tee -a ./results/linkcheck
cat ./results/linkcheck-output.txt | tee -a ./results/linkcheck
echo -e "\n\`\`\`" | tee -a ./results/linkcheck
- name: Upload results artifact
# release notes: https://github.com/actions/upload-artifact/releases/tag/v4.4.3
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # ratchet:actions/upload-artifact@v4
with:
name: website-validation-results
path: ./docs/results
retention-days: 3