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

Implement initial version #1

Merged
merged 10 commits into from
Nov 12, 2019
Merged
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
25 changes: 25 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"root": true,
"env": {
"commonjs": true,
"es6": true,
"node": true,
"jest/globals": true
},
"extends": [
"airbnb-base",
"plugin:jest/all"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaVersion": 2018
},
"plugins": ["jest"],
"rules": {
"no-console": "off",
"quotes": ["error", "single", {"allowTemplateLiterals": true}]
}
}
34 changes: 34 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: build
on: [pull_request]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1

- uses: actions/cache@v1
id: cache
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: Install
# if: steps.cache.outputs.cache-hit != 'true'
run: npm install

- name: Test
run: npm test

- name: Lint
run: npm run lint

- name: Monitor coverage
id: coverage-monitor
uses: ./
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
clover_file: "logs/clover.xml"
32 changes: 32 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: 'Coverage monitor'
description: 'A GitHub Action that monitor coverage.'
inputs:
github_token:
description: "The GITHUB_TOKEN secret."
required: true
clover_file:
description: "Path to Clover XML file."
required: true
check:
description: "Whether check the coverage thresholds."
required: true
default: true
comment:
description: "Whether comment the coverage report."
required: true
default: true
threshold_alert:
description: "Mark the build as unstable when coverage is less than this threshold."
required: false
default: 50
threshold_warning:
description: "Warning when coverage is less than this threshold."
required: false
default: 90
status_context:
description: "A string label to differentiate this status from the status of other systems."
required: false
default: 'Coverage Report'
runs:
using: 'node12'
main: 'dist/index.js'
7 changes: 7 additions & 0 deletions build/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

change=$(git diff --name-only | grep "src.*\.js")

if [[ -n ${change} ]]; then
npm run build
fi
Loading