From d3a8c8bcb60a4aad6401c372394a4a8f14ab2f9b Mon Sep 17 00:00:00 2001 From: Thomas Jarrand Date: Thu, 24 Sep 2020 15:44:44 +0200 Subject: [PATCH] Added Github workflows for lint, test and publish --- .github/workflows/publish.yaml | 24 ++++++++++++++++++++++++ .github/workflows/tests.yaml | 31 +++++++++++++++++++++++++++++++ Makefile | 11 +++++------ package-lock.json | 2 +- package.json | 1 + 5 files changed, 62 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/publish.yaml create mode 100644 .github/workflows/tests.yaml diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..9fdf61d --- /dev/null +++ b/.github/workflows/publish.yaml @@ -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 }} diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml new file mode 100644 index 0000000..5adf0e1 --- /dev/null +++ b/.github/workflows/tests.yaml @@ -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 diff --git a/Makefile b/Makefile index 53f1a67..3053309 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ install: npm install -# Launch watch +# Launch watcher watch: npm run watch @@ -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 diff --git a/package-lock.json b/package-lock.json index a2db5c3..3c3c6b5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@elao/container.js", - "version": "3.0.0", + "version": "3.0.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 62aa17b..3dce005 100644 --- a/package.json +++ b/package.json @@ -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": {