From e22fc86845e489fd1f1e3f71aa48b9813979607a Mon Sep 17 00:00:00 2001 From: Patrice Chalin Date: Sat, 13 Jan 2024 09:09:15 -0500 Subject: [PATCH] [CI] Run npm test scripts under Linux and Windows (#1778) --- .gitattributes | 3 +++ .github/workflows/smoke.yaml | 7 +++++-- .github/workflows/test.yaml | 28 ++++++++++++++++++++++++++++ .prettierignore | 1 + package.json | 3 ++- tools/make-site.sh | 2 +- 6 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 .gitattributes create mode 100644 .github/workflows/test.yaml diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..8e486f6180 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +* text=auto eol=lf +*.cmd text eol=crlf +*.bat text eol=crlf diff --git a/.github/workflows/smoke.yaml b/.github/workflows/smoke.yaml index fb0e71062a..83885d63c6 100644 --- a/.github/workflows/smoke.yaml +++ b/.github/workflows/smoke.yaml @@ -1,11 +1,14 @@ +# Smoke test across OSs: build a Docsy-based site from scratch, fetching Docsy +# via NPM. + name: smoke on: push: - branches: [ main ] + branches: [main] pull_request: schedule: # midnight every day - - cron: '0 0 * * *' + - cron: '0 0 * * *' workflow_dispatch: jobs: diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000000..13ad7b8098 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,28 @@ +# Runs `npm test` to build Docsy & the User Guide and run all repo checks across +# OSs. + +name: test + +on: + push: + branches: [main] + pull_request: + schedule: + - cron: '11 0 * * *' # 11 past midnight every day + workflow_dispatch: + +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [windows-latest, ubuntu-latest] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version-file: .nvmrc + cache: npm + cache-dependency-path: package.json + - run: npm install --omit=optional + - run: npm test diff --git a/.prettierignore b/.prettierignore index 54ed1b8a29..f112941105 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,4 +1,5 @@ .editorconfig +.gitattributes .gitignore .nvmrc .prettierignore diff --git a/package.json b/package.json index b42f1b85bd..1404a8a93d 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "cd:docs": "npm run _cd:docs -- npm run", "check": "npm run check:format && npm run check:links--md", "check:format": "npm run _check:format || (echo '[help] Run: npm run fix:format'; exit 1)", - "check:links--md": "npx markdown-link-check --config .markdown-link-check.json *.md", + "check:links--md": "ls *.md | xargs npx markdown-link-check --config .markdown-link-check.json", "check:links:all": "npm run cd:docs check:links:all", "check:links": "npm run cd:docs check:links", "docs-install": "npm run _cd:docs -- npm install", @@ -31,6 +31,7 @@ "pretest": "npm run _prebuild", "serve": "npm run cd:docs serve", "test": "npm run cd:docs test && npm run check", + "test-windows": "npm run cd:docs test", "update:pkg:dep": "npm install --save-exact @fortawesome/fontawesome-free@latest bootstrap@latest", "update:pkg:hugo": "npm install --save-exact -D hugo-extended@latest" }, diff --git a/tools/make-site.sh b/tools/make-site.sh index c6911ad225..30ac261282 100755 --- a/tools/make-site.sh +++ b/tools/make-site.sh @@ -88,4 +88,4 @@ $HUGO set +x -echo "[INFO] $SITE_NAME has been successfully created, set up, and built." +echo "[INFO] $SITE_NAME successfully created, set up, and built."