From 63cfdd8fedc4a58a170d4417afa378d6bbae47ef Mon Sep 17 00:00:00 2001
From: James Cryer <366068+jamescryer@users.noreply.github.com>
Date: Sun, 20 Jun 2021 20:00:33 +0100
Subject: [PATCH] Github actions (#210)

---
 .dockerignore                 |  1 +
 .eslintignore                 | 10 +++--
 .github/workflows/node.js.yml | 85 +++++++++++++++++++++++++++++++++++
 .gitignore                    |  2 +-
 .npmignore                    |  1 +
 .travis.yml                   | 11 -----
 README.md                     | 12 +++--
 dockerfile                    |  2 +-
 nodejs-tests/resemble.test.js |  1 +
 package.json                  |  5 ++-
 10 files changed, 107 insertions(+), 23 deletions(-)
 create mode 100644 .github/workflows/node.js.yml
 delete mode 100644 .travis.yml

diff --git a/.dockerignore b/.dockerignore
index 861ab53..e99314a 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -6,3 +6,4 @@ index.html
 bower.json
 README.md
 coverage
+.github
\ No newline at end of file
diff --git a/.eslintignore b/.eslintignore
index 19f6263..1418cae 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -1,4 +1,6 @@
-/node_modules
-/libs
-/demoassets
-/coverage
+./node_modules/**
+**/node_modules/**
+libs/**
+demoassets/**
+coverage/**
+.github/**
\ No newline at end of file
diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml
new file mode 100644
index 0000000..88705c2
--- /dev/null
+++ b/.github/workflows/node.js.yml
@@ -0,0 +1,85 @@
+name: Node.js CI
+
+on:
+    push:
+        branches: [master]
+    pull_request:
+        branches: [master]
+
+jobs:
+    codacy-analysis-cli:
+        name: Codacy Analysis CLI
+        runs-on: ubuntu-latest
+        steps:
+            - name: Checkout code
+              uses: actions/checkout@main
+
+            - name: Run Codacy Analysis CLI
+              uses: codacy/codacy-analysis-cli-action@master
+
+    coverage:
+        runs-on: windows-latest
+        name: codacy-coverage-reporter
+        steps:
+            - uses: actions/checkout@v2
+
+            - name: Set up Node.js
+              uses: actions/setup-node@v1
+              with:
+                  node-version: 16
+
+            - name: Install Node.js dependencies
+              run: npm ci
+
+            - name: Test
+              run: npm run test:coverage
+
+            - name: Run codacy-coverage-reporter
+              uses: codacy/codacy-coverage-reporter-action@v1
+              with:
+                  project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
+                  coverage-reports: coverage/lcov.info
+
+    lint:
+        name: Run linters
+        runs-on: ubuntu-latest
+
+        steps:
+            - uses: actions/checkout@v2
+
+            - name: Set up Node.js
+              uses: actions/setup-node@v1
+              with:
+                  node-version: 16
+
+            - name: Install Node.js dependencies
+              run: npm ci --ignore-scripts
+
+            - name: Run linters
+              uses: wearerequired/lint-action@v1
+              with:
+                  auto_fix: false
+                  eslint: true
+                  prettier: false
+
+    build:
+        runs-on: windows-latest
+
+        strategy:
+            matrix:
+                node-version: [12.x, 14.x]
+                # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
+
+        steps:
+            - uses: actions/checkout@v2
+
+            - name: Use Node.js ${{ matrix.node-version }}
+              uses: actions/setup-node@v2
+              with:
+                  node-version: ${{ matrix.node-version }}
+
+            - name: Install
+              run: npm ci
+
+            - name: Test
+              run: npm test
diff --git a/.gitignore b/.gitignore
index 428a1df..ce8f4bd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,3 @@
 .idea
 node_modules
-coverage
+coverage
\ No newline at end of file
diff --git a/.npmignore b/.npmignore
index c382fb0..84fb435 100644
--- a/.npmignore
+++ b/.npmignore
@@ -11,3 +11,4 @@ dockerfile
 .travis.yml
 memory-leak-test.js
 coverage
+.github
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index e5926e4..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-before_script:
-  - 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then npm install codacy-coverage --save; fi'
-script:
-  - 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then npm run test:codacy-coverage; fi'
-  - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then npm run test; fi'
-sudo: required
-language: node_js
-node_js:
-  - 8
-  - lts/*
-  - node
\ No newline at end of file
diff --git a/README.md b/README.md
index c91613a..1ab33f7 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,15 @@
+**Low-maintainance mode**: Two to four times a year the library author will spend some time to keep the library useful. Feel free to raise issues and contribute improvements, but please be aware that it may be sometime before a response is given.
+
+---
+
 <h1 align="center"><img src="https://raw.github.com/rsmbl/Resemble.js/master/demoassets/resemble.png" alt="Resemble.js" width="256"/></h1>
 
 <p align="center">
-    <a href="https://travis-ci.org/rsmbl/Resemble.js"><img alt="Build Status" src="https://travis-ci.org/rsmbl/Resemble.js.svg?branch=master" /></a>
-    <a href="https://www.codacy.com/app/jamescryer/Resemble.js?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=rsmbl/Resemble.js&amp;utm_campaign=Badge_Grade"><img alt="Code Health" src="https://api.codacy.com/project/badge/Grade/1e0972581406417e9914bc58f57704b3" /></a>
-    <a href="https://www.codacy.com/app/jamescryer/Resemble.js?utm_source=github.com&utm_medium=referral&utm_content=rsmbl/Resemble.js&utm_campaign=Badge_Coverage"><img alt="Coverage" src="https://api.codacy.com/project/badge/Coverage/9223d8d37c99428c8c06b889470327a5" /></a>
-    <a href="https://opensource.org/licenses/MIT"><img alt="Build Status" src="https://img.shields.io/badge/License-MIT-yellow.svg" /></a>
+    <a href="https://github.com/rsmbl/Resemble.js/actions"><img alt="Build Status" src="(https://github.com/rsmbl/Resemble.js/actions/workflows/node.js.yml/badge.svg" /></a>
+    <a href="https://www.codacy.com/gh/rsmbl/Resemble.js/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=rsmbl/Resemble.js&amp;utm_campaign=Badge_Grade"><img alt="Code Health" src="https://app.codacy.com/project/badge/Grade/97c5e9c42bcf4b4bbc2271882f18c502" /></a>
+    <a href="https://opensource.org/licenses/MIT"><img alt="MIT License" src="https://img.shields.io/badge/License-MIT-yellow.svg" /></a>
     <a href="https://www.npmjs.com/package/resemblejs"><img alt="NPM Downloads" src="https://img.shields.io/npm/dm/resemblejs.svg" /></a>
+
 </p>
 
 <p align="center">
diff --git a/dockerfile b/dockerfile
index f1ed903..a470503 100644
--- a/dockerfile
+++ b/dockerfile
@@ -1,4 +1,4 @@
-FROM node:12
+FROM node:16
 
 RUN apt-get update \
     && apt-get install -qq libcairo2-dev libjpeg-dev libpango1.0-dev libgif-dev librsvg2-dev build-essential g++
diff --git a/nodejs-tests/resemble.test.js b/nodejs-tests/resemble.test.js
index 7d707ea..2d3e7f5 100644
--- a/nodejs-tests/resemble.test.js
+++ b/nodejs-tests/resemble.test.js
@@ -172,6 +172,7 @@ describe("resemble", () => {
                         left: 20,
                         top: 200,
                         right: 350,
+
                         bottom: 250
                     }
                 ]
diff --git a/package.json b/package.json
index fc3a1a0..2c65ed3 100644
--- a/package.json
+++ b/package.json
@@ -23,10 +23,11 @@
     "homepage": "https://github.com/rsmbl/Resemble.js",
     "scripts": {
         "test": "jest nodejs-tests",
-        "test:codacy-coverage": "jest nodejs-tests --coverage && cat ./coverage/lcov.info | codacy-coverage",
+        "test:coverage": "jest nodejs-tests --coverage",
         "test:watch": "jest --watch nodejs-tests",
         "test:debug": "node --inspect node_modules/jest/bin/jest --watch --runInBand nodejs-tests",
-        "lint": "eslint **/*.js --fix"
+        "lint": "eslint **/*.js --fix",
+        "lint-ci": "eslint -c ./.eslintrc --ignore-path ./.eslintignore **/*.js"
     },
     "husky": {
         "hooks": {
