website: add sidebar item tests, bump node version to latest LTS
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
parent
ecd5fab082
commit
b225f6f3ff
|
@ -18,7 +18,7 @@ runs:
|
|||
- name: Setup node
|
||||
uses: actions/setup-node@v3.1.0
|
||||
with:
|
||||
node-version: '16'
|
||||
node-version: '18'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: web/package-lock.json
|
||||
- name: Setup dependencies
|
||||
|
|
|
@ -115,7 +115,7 @@ jobs:
|
|||
go-version: "^1.17"
|
||||
- uses: actions/setup-node@v3.6.0
|
||||
with:
|
||||
node-version: '16'
|
||||
node-version: '18'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: web/package-lock.json
|
||||
- name: Generate API
|
||||
|
|
|
@ -17,7 +17,7 @@ jobs:
|
|||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3.6.0
|
||||
with:
|
||||
node-version: '16'
|
||||
node-version: '18'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: web/package-lock.json
|
||||
- working-directory: web/
|
||||
|
@ -33,7 +33,7 @@ jobs:
|
|||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3.6.0
|
||||
with:
|
||||
node-version: '16'
|
||||
node-version: '18'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: web/package-lock.json
|
||||
- working-directory: web/
|
||||
|
@ -49,7 +49,7 @@ jobs:
|
|||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3.6.0
|
||||
with:
|
||||
node-version: '16'
|
||||
node-version: '18'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: web/package-lock.json
|
||||
- working-directory: web/
|
||||
|
@ -65,7 +65,7 @@ jobs:
|
|||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3.6.0
|
||||
with:
|
||||
node-version: '16'
|
||||
node-version: '18'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: web/package-lock.json
|
||||
- working-directory: web/
|
||||
|
@ -97,7 +97,7 @@ jobs:
|
|||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3.6.0
|
||||
with:
|
||||
node-version: '16'
|
||||
node-version: '18'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: web/package-lock.json
|
||||
- working-directory: web/
|
||||
|
|
|
@ -17,7 +17,7 @@ jobs:
|
|||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3.6.0
|
||||
with:
|
||||
node-version: '16'
|
||||
node-version: '18'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: website/package-lock.json
|
||||
- working-directory: website/
|
||||
|
@ -25,9 +25,24 @@ jobs:
|
|||
- name: prettier
|
||||
working-directory: website/
|
||||
run: npm run prettier-check
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3.6.0
|
||||
with:
|
||||
node-version: '18'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: website/package-lock.json
|
||||
- working-directory: website/
|
||||
run: npm ci
|
||||
- name: test
|
||||
working-directory: website/
|
||||
run: npm test
|
||||
ci-website-mark:
|
||||
needs:
|
||||
- lint-prettier
|
||||
- test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: echo mark
|
||||
|
|
|
@ -108,7 +108,7 @@ jobs:
|
|||
go-version: "^1.17"
|
||||
- uses: actions/setup-node@v3.6.0
|
||||
with:
|
||||
node-version: '16'
|
||||
node-version: '18'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: web/package-lock.json
|
||||
- name: Build web
|
||||
|
|
|
@ -14,7 +14,7 @@ jobs:
|
|||
token: ${{ secrets.BOT_GITHUB_TOKEN }}
|
||||
- uses: actions/setup-node@v3.6.0
|
||||
with:
|
||||
node-version: '16'
|
||||
node-version: '18'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
- name: Generate API Client
|
||||
run: make gen-client-ts
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
"deploy": "docusaurus deploy",
|
||||
"serve": "docusaurus serve",
|
||||
"prettier-check": "prettier --check .",
|
||||
"prettier": "prettier --write ."
|
||||
"prettier": "prettier --write .",
|
||||
"test": "node --test"
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/plugin-client-redirects": "2.3.1",
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
import test from "node:test";
|
||||
import assert from "node:assert";
|
||||
import sidebar from "../sidebarsIntegrations.js";
|
||||
import glob from "glob";
|
||||
|
||||
const getSidebarItems = () => {
|
||||
const allItems = [];
|
||||
const mapper = (category) => {
|
||||
category.items.forEach((item) => {
|
||||
if (item.constructor === String) {
|
||||
allItems.push(item);
|
||||
} else {
|
||||
mapper(item);
|
||||
}
|
||||
});
|
||||
};
|
||||
sidebar.integrations.forEach(mapper);
|
||||
return allItems.sort();
|
||||
};
|
||||
|
||||
test("ensure all services have a sidebar entry", (t) => {
|
||||
// All services in the sidebar
|
||||
const services = getSidebarItems()
|
||||
.filter((entry) => entry.startsWith("services/"))
|
||||
.map((entry) => entry.replace("/index", ""))
|
||||
.map((entry) => entry.replace("services/", ""));
|
||||
const servicesFiles = glob
|
||||
.sync("integrations/**/*.+(md|mdx)")
|
||||
.filter((entry) => entry.startsWith("integrations/services/"))
|
||||
.map((entry) => entry.replace("integrations/services/", ""))
|
||||
.map((entry) => entry.replace(/\/index\.mdx?/, ""))
|
||||
.filter((entry) => entry !== "index.mdx")
|
||||
.sort();
|
||||
servicesFiles.forEach((file, idx) => {
|
||||
assert.strictEqual(file, services[idx]);
|
||||
});
|
||||
});
|
||||
|
||||
test("ensure all sources have a sidebar entry", (t) => {
|
||||
// All sources in the sidebar
|
||||
const sources = getSidebarItems()
|
||||
.filter((entry) => entry.startsWith("sources/"))
|
||||
.map((entry) => entry.replace("/index", ""))
|
||||
.map((entry) => entry.replace("sources/", ""));
|
||||
const sourceFiles = glob
|
||||
.sync("integrations/**/*.+(md|mdx)")
|
||||
.filter((entry) => entry.startsWith("integrations/sources/"))
|
||||
.map((entry) => entry.replace("integrations/sources/", ""))
|
||||
.map((entry) => entry.replace(/\/index\.mdx?/, ""))
|
||||
.map((entry) => entry.replace(".md", ""))
|
||||
.sort();
|
||||
sourceFiles.forEach((file, idx) => {
|
||||
assert.strictEqual(file, sources[idx]);
|
||||
});
|
||||
});
|
Reference in New Issue