Skip to content

Commit 941abe1

Browse files
authored
chore: setup github actions (validatorjs#1606)
* chore: prevent git from ignoring src/index.js file * chore: remove unused exclusion from nyc config * chore: replace travis-ci with github actions * chore: fix issue with github workflow config * chore: fix condition for coverage generation and sending * chore: treat node version as int * docs: replace travis with github actions badge * chore: add npm publish github action * chore: remove auto-generated files * chore: improve github actions styles * chore: use correct repo url to prevent unecessary redirect * chore: lint package.json file * chore: add new line at end of file * chore: set a fixed ubuntu version instead of relying on latest
1 parent 9b03daf commit 941abe1

File tree

12 files changed

+375
-5442
lines changed

12 files changed

+375
-5442
lines changed

.github/workflows/ci.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: CI
2+
on:
3+
push:
4+
branches: [master]
5+
pull_request:
6+
branches: [master]
7+
jobs:
8+
test:
9+
runs-on: ubuntu-20.04
10+
strategy:
11+
matrix:
12+
node-version: [14, 12, 10, 8, 6]
13+
steps:
14+
- name: Setup Node.js ${{ matrix.node-version }}
15+
uses: actions/setup-node@v2-beta
16+
with:
17+
node-version: ${{ matrix.node-version }}
18+
check-latest: true
19+
- name: Checkout Repository
20+
uses: actions/checkout@v2
21+
- name: Install Dependencies
22+
run: npm install
23+
- name: Run Tests
24+
run: npm test
25+
- if: matrix.node-version == 14
26+
name: Generate coverage file
27+
run: npm run test:ci > coverage.lcov
28+
- if: matrix.node-version == 14
29+
name: Send coverage info to Codecov
30+
uses: codecov/codecov-action@v1
31+
with:
32+
file: ./coverage.lcov

.github/workflows/npm-publish.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: NPM Publish
2+
on:
3+
release:
4+
types: [created]
5+
jobs:
6+
publish:
7+
runs-on: ubuntu-20.04
8+
steps:
9+
- name: Setup Node.js 14
10+
uses: actions/setup-node@v2-beta
11+
with:
12+
node-version: 14
13+
check-latest: true
14+
registry-url: https://registry.npmjs.org/
15+
- name: Checkout Repository
16+
uses: actions/checkout@v2
17+
- name: Install Dependencies
18+
run: npm install
19+
- name: Run Tests
20+
run: npm test
21+
- name: Publish Package to NPM Registry
22+
run: npm publish
23+
env:
24+
NODE_AUTH_TOKEN: ${{secrets.NPM_SECRET}}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ package-lock.json
77
yarn.lock
88
/es
99
/lib
10+
/index.js
1011
validator.js
1112
validator.min.js
12-
index.js

.nycrc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,5 @@
55
],
66
"include": [
77
"src/**/*.js"
8-
],
9-
"exclude": [
10-
"validator.js",
11-
"lib/**/*.js"
128
]
139
}

.travis.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 305 additions & 305 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# validator.js
22

33
[![NPM version][npm-image]][npm-url]
4-
[![Build Status](https://travis-ci.org/validatorjs/validator.js.svg?branch=master)](https://travis-ci.org/validatorjs/validator.js)
5-
[![codecov](https://codecov.io/gh/validatorjs/validator.js/branch/master/graph/badge.svg)](https://codecov.io/gh/validatorjs/validator.js)
4+
[![CI][ci-image]][ci-url]
5+
[![Coverage][codecov-image]][codecov-url]
66
[![Downloads][downloads-image]][npm-url]
77
[![Backers on Open Collective](https://opencollective.com/validatorjs/backers/badge.svg)](#backers)
88
[![Sponsors on Open Collective](https://opencollective.com/validatorjs/sponsors/badge.svg)](#sponsors)
@@ -183,7 +183,7 @@ Sanitizer | Description
183183

184184
### XSS Sanitization
185185

186-
XSS sanitization was removed from the library in [2d5d6999](https://github.com/chriso/validator.js/commit/2d5d6999541add350fb396ef02dc42ca3215049e).
186+
XSS sanitization was removed from the library in [2d5d6999](https://github.com/validatorjs/validator.js/commit/2d5d6999541add350fb396ef02dc42ca3215049e).
187187

188188
For an alternative, have a look at Yahoo's [xss-filters library](https://github.com/yahoo/xss-filters) or at [DOMPurify](https://github.com/cure53/DOMPurify).
189189

@@ -253,8 +253,11 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
253253
[npm-url]: https://npmjs.org/package/validator
254254
[npm-image]: http://img.shields.io/npm/v/validator.svg
255255

256-
[travis-url]: https://travis-ci.org/chriso/validator.js
257-
[travis-image]: http://img.shields.io/travis/chriso/validator.js.svg
256+
[codecov-url]: https://codecov.io/gh/validatorjs/validator.js
257+
[codecov-image]: https://codecov.io/gh/validatorjs/validator.js/branch/master/graph/badge.svg
258+
259+
[ci-url]: https://github.com/validatorjs/validator.js/actions?query=workflow%3ACI
260+
[ci-image]: https://github.com/validatorjs/validator.js/workflows/CI/badge.svg?branch=master
258261

259262
[amd]: http://requirejs.org/docs/whyamd.html
260263
[bower]: http://bower.io/

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "validator-js",
33
"main": "validator.js",
4-
"homepage": "https://github.com/chriso/validator.js",
4+
"homepage": "https://github.com/validatorjs/validator.js",
55
"authors": [
66
"Chris O'Hara <[email protected]>"
77
],

0 commit comments

Comments
 (0)