Repository navigation
120 lines (118 loc) · 4.49 KB
/
Copy pathlint.yml
File metadata and controls
120 lines (118 loc) · 4.49 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
name: ❄️ Lint
on: [pull_request]
jobs:
astro-main-pages:
name: Astro main pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.1.0
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: npm
cache-dependency-path: next/package-lock.json
- name: Install dependencies
working-directory: next
run: npm ci
- name: Test sitemap generation
working-directory: next
run: npm run test:sitemap
- name: Test Ingress documentation redirects
working-directory: next
run: npm run test:redirects
- name: Sync APISIX release docs for SEO tests
working-directory: next
run: |
set -euo pipefail
mkdir -p .sync
APISIX_SERIES=$(node -e "const v=require('../config/apisix-versions.js').versions;console.log(v[v.length-1])")
git clone --depth 1 --filter=blob:none --sparse -q \
-b "release/$APISIX_SERIES" \
https://github.com/apache/apisix.git \
.sync/apisix
(cd .sync/apisix && git sparse-checkout set docs)
INGRESS_VERSION=$(
git ls-remote --refs \
https://github.com/apache/apisix-ingress-controller.git \
'refs/heads/v*' 'refs/tags/v*' \
| sed 's|.*refs/[a-z]*/v||' \
| node -e "
const semver = require('semver');
const versions = require('fs').readFileSync(0, 'utf8').split('\\n')
.map((version) => version.trim())
.filter((version) => semver.valid(semver.coerce(version)));
versions.sort((left, right) => semver.compare(semver.coerce(left), semver.coerce(right)));
if (versions.length) console.log(versions[versions.length - 1]);
"
)
test -n "$INGRESS_VERSION"
git clone --depth 1 --filter=blob:none --sparse -q \
-b "v$INGRESS_VERSION" \
https://github.com/apache/apisix-ingress-controller.git \
.sync/apisix-ingress-controller
(cd .sync/apisix-ingress-controller && git sparse-checkout set docs)
- name: Sync site content
working-directory: next
run: node scripts/sync-content.mjs
env:
WEBSITE_REPO: ${{ github.workspace }}
- name: Build Astro site
working-directory: next
run: npm run build
- name: Verify documentation ownership signals
working-directory: next
run: npm run test:doc-signals
- name: Assert Chinese learning-center retirement contract
working-directory: next
run: |
set -euo pipefail
node scripts/generate-md-twins.mjs
test -f dist/zh/learning-center/index.html
test "$(find dist/zh/learning-center -name index.html | wc -l)" -eq 1
test "$(find dist/zh/learning-center -name index.md | wc -l)" -eq 0
if grep -Eq 'https://apisix\.apache\.org/zh/learning-center/.+/index\.md' dist/llms.txt; then
echo 'Retired Chinese learning-center Markdown URL remains in llms.txt.'
exit 1
fi
- name: Test main pages on desktop and mobile
working-directory: next
run: npm run test:e2e
markdownlint:
name: 🍇 Markdown
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.1.0
- name: 🚀 Use Node.js
uses: actions/setup-node@v3
with:
node-version: '12.x'
- run: npm install -g markdownlint-cli@0.25.0
- run: markdownlint '**/*.md' --ignore node_modules
frontmatter:
name: 🍒 Frontmatter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.1.0
- name: 🚀 Use Node.js
uses: actions/setup-node@v3
with:
node-version: '16.x'
- run: yarn install --frozen-lockfile --ignore-scripts
- run: yarn lint:frontmatter
yamllint:
name: 🍏 YAML
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.1.0
- uses: actions/setup-python@v4.1.0
with:
python-version: '3.x' # Version range or exact version of a Python version to use, using SemVer's version range syntax
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install yamllint
- name: 🧹 YAML Lint
run: |
yamllint .