diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index bdaf6dfd0..5f840467b 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -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 diff --git a/.github/workflows/ci-outpost.yml b/.github/workflows/ci-outpost.yml index a8e12de7a..c54b458b9 100644 --- a/.github/workflows/ci-outpost.yml +++ b/.github/workflows/ci-outpost.yml @@ -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 diff --git a/.github/workflows/ci-web.yml b/.github/workflows/ci-web.yml index 2d3db225a..167891a0b 100644 --- a/.github/workflows/ci-web.yml +++ b/.github/workflows/ci-web.yml @@ -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/ diff --git a/.github/workflows/ci-website.yml b/.github/workflows/ci-website.yml index 67e42bc92..8a170a375 100644 --- a/.github/workflows/ci-website.yml +++ b/.github/workflows/ci-website.yml @@ -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 diff --git a/.github/workflows/release-publish.yml b/.github/workflows/release-publish.yml index 347e41b2f..f62928a34 100644 --- a/.github/workflows/release-publish.yml +++ b/.github/workflows/release-publish.yml @@ -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 diff --git a/.github/workflows/web-api-publish.yml b/.github/workflows/web-api-publish.yml index 97f779216..1d3eb2ca1 100644 --- a/.github/workflows/web-api-publish.yml +++ b/.github/workflows/web-api-publish.yml @@ -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 diff --git a/website/package.json b/website/package.json index 9a0906abf..1c87040c8 100644 --- a/website/package.json +++ b/website/package.json @@ -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", diff --git a/website/test/sidebarIntegrations.mjs b/website/test/sidebarIntegrations.mjs new file mode 100644 index 000000000..3ab8e0ba3 --- /dev/null +++ b/website/test/sidebarIntegrations.mjs @@ -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]); + }); +});