Skip to content

Commit

Permalink
chore: setup git hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
bokub committed May 4, 2022
1 parent 3ea6ae9 commit 41d85f2
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 354 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/run.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: gradient-string CI
name: CI/CD

on:
- push
Expand All @@ -7,16 +7,18 @@ on:

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: npm ci
- run: npx xo
- run: npm run lint

test:
name: Test (Node v${{ matrix.node }})
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -27,14 +29,15 @@ jobs:
with:
node-version: ${{ matrix.node }}
- run: npm ci
- run: npx c8 cross-env FORCE_COLOR=1 ava
- run: npm test
- run: npm run coverage
- uses: codecov/codecov-action@v3
if: matrix.node == 16
with:
files: ./coverage.lcov

publish:
name: Publish on npm
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs:
Expand Down
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"

npm run lint
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,14 @@ npm i @types/gradient-string

MIT © [Boris K](https://github.com/bokub)

[build-src]: https://flat.badgen.net/travis/bokub/gradient-string
[build-src]: https://flat.badgen.net/github/checks/bokub/gradient-string?label=tests
[version-src]: https://runkit.io/bokub/npm-version/branches/master/gradient-string?style=flat
[codecov-src]: https://flat.badgen.net/codecov/c/github/bokub/gradient-string
[downloads-src]: https://flat.badgen.net/npm/dm/gradient-string?color=FF9800
[xo-src]: https://flat.badgen.net/badge/code%20style/XO/5ed9c7
[awesome-src]: https://awesome.re/mentioned-badge-flat.svg

[build-href]: https://travis-ci.org/bokub/gradient-string
[build-href]: https://github.com/bokub/gradient-string/actions/workflows/run.yml
[version-href]: https://www.npmjs.com/package/gradient-string
[codecov-href]: https://codecov.io/gh/bokub/gradient-string
[downloads-href]: https://www.npmjs.com/package/gradient-string
Expand Down
Loading

0 comments on commit 41d85f2

Please sign in to comment.