Skip to content

Commit

Permalink
ci: test husky hook
Browse files Browse the repository at this point in the history
  • Loading branch information
yld-weng committed Aug 10, 2021
1 parent 54dee89 commit 863c355
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 31 deletions.
30 changes: 19 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,31 @@ name: Test

on:
push:
branches-ignore: [ master ]
branches-ignore: [master]
pull_request:
branches: [ '**' ]
types: [ assigned, opened, synchronize, reopened, unlocked, review_requested, edited ]
branches: ["**"]
types:
[
assigned,
opened,
synchronize,
reopened,
unlocked,
review_requested,
edited
]
workflow_dispatch:
inputs:
Name:
Name:
required: true
default: 'Re-run the workflow'
default: "Re-run the workflow"
Description:
default: ''

default: ""

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.1
Expand All @@ -31,10 +39,10 @@ jobs:
- name: Jest cache
id: gatsby-jest-cache
uses: actions/cache@v2
with:
with:
path: .jest-cache
key: ${{ runner.os }}-jestCache-${{ github.run_id }}

restore-keys: ${{ runner.os }}-jestCache-

- name: Run unit tests
run: npm run test

4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged && npm run test
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ package.json
package-lock.json
public

.mdx

2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"semi": false,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "es6"
"trailingComma": "none"
}
18 changes: 8 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 4 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,8 @@
"gh-pages-script": "gh-pages -d public -r https://$GH_TOKEN@github.com/researchdata-sheffield/dataviz-hub2.git",
"deploy": "gatsby build && npm run gh-pages-script",
"deploy-noCache": "gatsby clean && npm run deploy",
"deploy:incremental": "npm run build:incremental && npm run gh-pages-script"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged && npm run test"
}
"deploy:incremental": "npm run build:incremental && npm run gh-pages-script",
"prepare": "husky install"
},
"dependencies": {
"@mdx-js/mdx": "^1.6.22",
Expand Down Expand Up @@ -139,10 +135,10 @@
"gatsby-plugin-eslint": "^3.0.0",
"gatsby-remark-code-titles": "^1.1.0",
"gh-pages": "^3.2.3",
"husky": "^7.0.1",
"husky": "^7.0.0",
"identity-obj-proxy": "^3.0.0",
"jest": "^27.0.6",
"lint-staged": "^11.0.1",
"lint-staged": "^11.1.2",
"prettier": "2.3.2",
"react-test-renderer": "^17.0.2",
"start-server-and-test": "^1.12.6",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ exports[`Search component return search result without error 1`] = `
<span
class=""
>
An interative tool based on the flowchart made by Jean Russell to help you determine which statistical test to use for two variables. This tool is a part of ...
An interative tool based on the flow chart made by Jean Russell to help you determine which statistical test to use for two variables. This tool is a part of ...
</span>
</span>
</h1>
Expand Down

0 comments on commit 863c355

Please sign in to comment.