Skip to content

Commit

Permalink
[CI] Run npm test scripts under Linux and Windows (google#1778)
Browse files Browse the repository at this point in the history
  • Loading branch information
chalin authored Jan 13, 2024
1 parent 91e0815 commit e22fc86
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* text=auto eol=lf
*.cmd text eol=crlf
*.bat text eol=crlf
7 changes: 5 additions & 2 deletions .github/workflows/smoke.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.editorconfig
.gitattributes
.gitignore
.nvmrc
.prettierignore
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
},
Expand Down
2 changes: 1 addition & 1 deletion tools/make-site.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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."

0 comments on commit e22fc86

Please sign in to comment.