[CI] Run npm test scripts under Linux and Windows (#1778)

This commit is contained in:
Patrice Chalin 2024-01-13 09:09:15 -05:00 committed by GitHub
parent 91e0815c21
commit e22fc86845
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 40 additions and 4 deletions

3
.gitattributes vendored Normal file
View File

@ -0,0 +1,3 @@
* text=auto eol=lf
*.cmd text eol=crlf
*.bat text eol=crlf

View File

@ -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:

28
.github/workflows/test.yaml vendored Normal file
View File

@ -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

View File

@ -1,4 +1,5 @@
.editorconfig
.gitattributes
.gitignore
.nvmrc
.prettierignore

View File

@ -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"
},

View File

@ -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."