Skip to content

Commit

Permalink
Added Github workflows for lint, test and publish
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Jarrand committed Sep 24, 2020
1 parent 7a0f99c commit d3a8c8b
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 7 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Publish package to NPM

on:
release:
types: [created]

jobs:
build:
name: Publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v1
with:
registry-url: 'https://registry.npmjs.org'

- name: Build
run: make install build

- name: Publish package to npm
run: npm publish . --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
31 changes: 31 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Tests

on:
push:
branches:
- master
pull_request:

jobs:
tests:
name: Tests
runs-on: ubuntu-latest
steps:
## https://github.com/actions/checkout
- name: Checkout
uses: actions/checkout@v2

# https://github.com/actions/setup-node
- name: Setup node
uses: actions/setup-node@v1

- name: Install dependencies
run: |
echo "::group::npm install"
npm install --color=always --no-progress
echo "::endgroup::"
- name: Lint
run: |
echo "::group::Lint JS"
make lint@integration
11 changes: 5 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
install:
npm install

# Launch watch
# Launch watcher
watch:
npm run watch

Expand All @@ -15,12 +15,11 @@ build:

# Lint and code style fix
lint:
npm run fix

lint@integration:
npm run lint

# Test
# Run tests
test: build
npm run test

# Publish package
publish: build
npm publish . --access public
2 changes: 1 addition & 1 deletion package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"watch": "webpack --watch --mode=development",
"build": "webpack --mode=production",
"test": "jest",
"fix": "eslint src/* --ext .js,.json",
"lint": "eslint src/* --ext .js,.json --fix"
},
"devDependencies": {
Expand Down

0 comments on commit d3a8c8b

Please sign in to comment.