Skip to content

Commit

Permalink
Merge pull request #7 from luispabon/github-action
Browse files Browse the repository at this point in the history
Add github action to run tests
  • Loading branch information
luispabon authored Nov 17, 2021
2 parents e448fe5 + b987bbb commit 018ea2b
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 55 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: "Test application"

on:
push:
branches:
- master
pull_request:
branches:
- master

# Allow workflow to be manually run from the GitHub UI
workflow_dispatch:

jobs:
tests:
timeout-minutes: 10
runs-on: ubuntu-latest
strategy:
matrix:
node_container:
- node:12-alpine
- node:14-alpine
- node:16-alpine

env:
NODE_CONTAINER: ${{ matrix.node_container }}

steps:
- name: Checkout
uses: actions/checkout@v1

- name: Initialise environment
run: make install

- name: Linting
run: make lint

- name: Unit tests
run: make test

- uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
verbose: false
16 changes: 10 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
NODE_CONTAINER?=node:16-alpine

NODE_RUN=docker run --rm -v "$(PWD):/workdir" -w "/workdir" --rm $(NODE_CONTAINER)

install:
$(NODE_RUN) yarn install

lint:
yarn prettier -c src/ tests/
$(NODE_RUN) yarn prettier -c src/ tests/

lint-fix:
yarn prettier -w src/ tests/
$(NODE_RUN) yarn prettier -w src/ tests/

test:
yarn test

upload-coverage:
yarn coverage
$(NODE_RUN) yarn test

publish:
docker-run-root node:alpine sh -c "/usr/local/bin/npm adduser; /usr/local/bin/npm publish"
Expand Down
45 changes: 0 additions & 45 deletions concourse/pipeline-pull-requests.yaml

This file was deleted.

6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,15 @@
"superagent": "^3.5.0 || ^4.0 || ^5.0 || ^6.0"
},
"devDependencies": {
"codecov": "^3.7.2",
"express": "^4.17.1",
"mocha": "^8.1.3",
"mocha": "^9.1.3",
"mocha-lcov-reporter": "^1.3.0",
"nyc": "^15.1.0",
"prettier": "^2.1.1",
"should": "^13.2.3",
"superagent": "^3.5.0 || ^4.0 || ^5.0 || ^6.0"
},
"scripts": {
"test": "node_modules/.bin/nyc --reporter=lcov mocha --color --recursive --timeout=20000 tests/",
"coverage": "codecov"
"test": "node_modules/.bin/nyc --reporter=lcov mocha --color --recursive --timeout=20000 tests/"
}
}

0 comments on commit 018ea2b

Please sign in to comment.