Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace circleci with gh actions #121

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: push

on:
push:
branches:
- master
pull_request:
paths-ignore:
- '**/*.md'
release:
types:
- created
env:
CHROME_BIN: "/usr/bin/google-chrome"
NODE_ENV: test

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bradennapier/eslint-plus-action@v3.4.2
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x, 16.x, 18.x, 20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: install dependencies
run: npm ci
- name: Create mongoDB Docker container
run: |
sudo docker run -d -p 27017:27017 mongo:4.4.10-focal
: ${MONGO_HOST:=localhost}
: ${MONGO_PORT:=27017}

until nc -z $MONGO_HOST $MONGO_PORT
do
echo "Waiting for Mongo ($MONGO_HOST:$MONGO_PORT) to start..."
sleep 0.5
done
- name: run unit tests
env:
REPORTER: mocha-circleci-reporter
MOCHA_FILE: junit/test-results.xml
run: npm test
#- name: coveralls
# run: cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure() # run this step even if previous step failed
with:
# Name of the check run which will be created
name: Unit Test report ${{ matrix.node-version }}
path: junit/test-results.json
reporter: mocha-json
- name: Authenticate with registry
if: github.event_name == 'release'
run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/repo/.npmrc
- name: Publish package
run: npm publish
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"Jussi Vatjus-Anttila <jussiva@gmail.com>"
],
"scripts": {
"test": "mocha -R list",
"test": "mocha",
"lint": "./node_modules/eslint/bin/eslint.js .",
"snyk-protect": "snyk protect",
"prepublish": "npm run snyk-protect"
Expand Down
Loading