ci: Use github actions
This commit is contained in:
parent
5ce0c267f4
commit
255764de09
|
@ -1,29 +0,0 @@
|
|||
version: 2
|
||||
jobs:
|
||||
build:
|
||||
working_directory: ~/mern-starter # directory where steps will run
|
||||
docker: # run the steps with Docker
|
||||
- image: circleci/node:10.15.0
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: update-npm
|
||||
command: 'sudo npm install -g npm@latest'
|
||||
- restore_cache: # special step to restore the dependency cache
|
||||
key: dependency-cache-{{ checksum "package.json" }}
|
||||
- run:
|
||||
name: install-deps
|
||||
command: npm install
|
||||
- save_cache: # special step to save the dependency cache
|
||||
key: dependency-cache-{{ checksum "package.json" }}
|
||||
paths:
|
||||
- ./node_modules
|
||||
- run: # lint
|
||||
name: lint
|
||||
command: npm run lint
|
||||
- run: # run tests with code coverage
|
||||
name: test-code-coverage
|
||||
command: npm run coverage
|
||||
- run: # run coveralls report
|
||||
name: test-report-coveralls
|
||||
command: npm run coveralls
|
|
@ -0,0 +1,45 @@
|
|||
name: Node.js CI
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [10.x, 12.x, 14.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- name: Cache node modules
|
||||
uses: actions/cache@v2
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
||||
${{ runner.os }}-build-
|
||||
${{ runner.os }}-
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
|
||||
- name: Run linter
|
||||
run: npm run lint
|
||||
|
||||
- name: Run test with coverage
|
||||
run: npm run coverage
|
||||
|
||||
- name: Coveralls
|
||||
uses: coverallsapp/github-action@master
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
@ -84,6 +84,7 @@
|
|||
"**/*.d.ts"
|
||||
],
|
||||
"reporter": [
|
||||
"lcov",
|
||||
"text-summary",
|
||||
"html"
|
||||
]
|
||||
|
|
Reference in New Issue