Skip to content

Commit d8e9c5e

Browse files
author
Guy Bedford
authored
fix: windows support & windows ci (#962)
1 parent 3f0e69a commit d8e9c5e

File tree

629 files changed

+153
-39
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

629 files changed

+153
-39
lines changed

.github/workflows/main.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ jobs:
3333
- uses: actions/setup-node@v3
3434
with:
3535
node-version: 'lts/*'
36+
- run: cd documentation && npm run rename
3637
- run: cd documentation && npm ci
3738
- run: cd documentation && npm run build
3839

@@ -113,11 +114,21 @@ jobs:
113114

114115
test-npm-package:
115116
if: github.ref != 'refs/heads/main'
116-
runs-on: ubuntu-latest
117117
needs: [build]
118118
strategy:
119119
matrix:
120120
node-version: [18, 22]
121+
os: [
122+
ubuntu-latest,
123+
windows-latest,
124+
macos-latest
125+
]
126+
exclude:
127+
- os: macos-latest
128+
node-version: 18
129+
- os: windows-latest
130+
node-version: 18
131+
runs-on: ${{ matrix.os }}
121132
steps:
122133
- uses: actions/checkout@v3
123134
- uses: actions/setup-node@v3
@@ -131,6 +142,14 @@ jobs:
131142
uses: actions/download-artifact@v3
132143
with:
133144
name: fastly-debug
145+
- name: Download Engine
146+
uses: actions/download-artifact@v3
147+
with:
148+
name: fastly-weval
149+
- name: Download Engine Weval Cache
150+
uses: actions/download-artifact@v3
151+
with:
152+
name: fastly-weval-ic-cache
134153
- run: npm install
135154
- run: npm test
136155

.github/workflows/release-please.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ jobs:
4545

4646
- run: npm update
4747
working-directory: ./documentation
48+
- run: npm run rename
49+
working-directory: ./documentation
4850
- run: npm run docusaurus docs:version "$(npm pkg get version --json --prefix=../ | jq -r)"
4951
working-directory: ./documentation
5052

@@ -166,6 +168,9 @@ jobs:
166168
env:
167169
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
168170

171+
- run: npm run rename
172+
working-directory: ./documentation
173+
169174
- run: npm ci
170175
working-directory: ./documentation
171176

documentation/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"clear": "docusaurus clear",
99
"serve": "docusaurus serve",
1010
"write-translations": "docusaurus write-translations",
11-
"write-heading-ids": "docusaurus write-heading-ids"
11+
"write-heading-ids": "docusaurus write-heading-ids",
12+
"rename": "node rename-docs.mjs"
1213
},
1314
"devDependencies": {
1415
"@cmfcmf/docusaurus-search-local": "^0.11.0",

documentation/rename-docs.mjs

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/**
2+
* The docs site relies on path names like "fastly:backend", which
3+
* are not compatible in Windows.
4+
*
5+
* This script handles renaming the docs site folders to be prefixed with fastly: or not
6+
*/
7+
8+
import { readdirSync, renameSync } from 'node:fs';
9+
10+
const subsystems = [
11+
'backend',
12+
'cache-override',
13+
'cache',
14+
'compute',
15+
'config-store',
16+
'device',
17+
'dictionary',
18+
'edge-rate-limiter',
19+
'env',
20+
'experimental',
21+
'fanout',
22+
'geolocation',
23+
'kv-store',
24+
'logger',
25+
'object-store',
26+
'secret-store'
27+
];
28+
29+
const files = readdirSync('docs');
30+
const direction = files[0].startsWith('fastly:') ? 'remove-prefix' : 'add-prefix';
31+
32+
for (const file of files) {
33+
if (direction === 'remove-prefix' && file.startsWith('fastly:')) {
34+
if (!subsystems.includes(file.slice(7)))
35+
console.error(`missing subsystem - ${file.slice(7)}`);
36+
renameSync(`docs/${file}`, `docs/${file.slice(7)}`);
37+
}
38+
else if (subsystems.includes(file)) {
39+
renameSync(`docs/${file}`, `docs/fastly:${file}`);
40+
}
41+
}
42+
43+
const versions = readdirSync('versioned_docs');
44+
for (const version of versions) {
45+
const files = readdirSync(`versioned_docs/${version}`);
46+
for (const file of files) {
47+
if (direction === 'remove-prefix' && file.startsWith('fastly:')) {
48+
if (!subsystems.includes(file.slice(7)))
49+
console.error(`missing subsystem - ${file.slice(7)}`);
50+
renameSync(`versioned_docs/${version}/${file}`, `versioned_docs/${version}/${file.slice(7)}`);
51+
}
52+
else if (subsystems.includes(file)) {
53+
renameSync(`versioned_docs/${version}/${file}`, `versioned_docs/${version}/fastly:${file}`);
54+
}
55+
}
56+
}
57+
58+
if (direction === 'remove-prefix')
59+
console.log('Renamed docs to remove prefix (for committing to git)');
60+
else
61+
console.log('Renamed docs for building with fastly: prefix');

0 commit comments

Comments
 (0)