Skip to content
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
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

58 changes: 0 additions & 58 deletions .eslintrc.json

This file was deleted.

91 changes: 91 additions & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Quality audit

on: [pull_request]

env:
GHR_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
eslint:
name: eslint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v4
with:
node-version: 24
- name: Install JS dependencies
run: npm install
- name: Run ESLint
uses: reviewdog/action-eslint@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-check

misspell:
name: check / misspell
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: misspell
uses: reviewdog/action-misspell@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-annotations
fail_level: any
locale: "US"
exclude: |
./node_modules/*
./eslint*
./dist/*
./yarn.lock

shellcheck:
name: runner / shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: shellcheck
uses: reviewdog/action-shellcheck@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-annotations
fail_level: any
path: "."
pattern: "*.sh"
exclude: "./.git/*"

yamllint:
name: check / yamllint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: yamllint
uses: reviewdog/action-yamllint@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-annotations
fail_level: any
yamllint_flags: '-d "{extends: default, rules: {truthy: disable}}" .'

actionlint:
name: runner / actionlint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: reviewdog/action-actionlint@v1
with:
reporter: github-pr-annotations
fail_level: error
level: warning

alex:
name: runner / alex
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: reviewdog/action-alex@v1
with:
reporter: github-pr-annotations
fail_level: error
level: warning
55 changes: 55 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: release
on:
push:
branches:
- main
tags:
- 'v*.*.*'
pull_request:
types:
- labeled

jobs:
release:
if: github.event.action != 'labeled'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7

# Bump version on merging Pull Requests with specific labels.
# (bump:major,bump:minor,bump:patch)
- id: bumpr
if: "!startsWith(github.ref, 'refs/tags/')"
uses: haya14busa/action-bumpr@v1

# Update corresponding major and minor tag.
# e.g. Update v1 and v1.2 when releasing v1.2.3
- uses: haya14busa/action-update-semver@v1
if: "!steps.bumpr.outputs.skip"
with:
tag: ${{ steps.bumpr.outputs.next_version }}

# Get tag name.
- id: tag
uses: haya14busa/action-cond@v1
with:
cond: "${{ startsWith(github.ref, 'refs/tags/') }}"
if_true: ${{ github.ref }}
if_false: ${{ steps.bumpr.outputs.next_version }}

# Create release.
- if: "steps.tag.outputs.value != ''"
env:
TAG_NAME: ${{ steps.tag.outputs.value }}
BODY: ${{ steps.bumpr.outputs.message }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "${TAG_NAME}" -t "Release ${TAG_NAME/refs\/tags\//}" --notes "${BODY}"

release-check:
if: github.event.action == 'labeled'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Post bumpr status comment
uses: haya14busa/action-bumpr@v1
7 changes: 4 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "build-test"
name: "Build test"
on:
pull_request:
push:
Expand All @@ -7,14 +7,15 @@ jobs:
build: # make sure build/ci work properly
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v7
- run: |
npm install
npm run all

test: # make sure the action works on a clean machine without building
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v7
- uses: ./
with:
resultPath: dummy_coverage/.last_run.json
Expand Down
10 changes: 1 addition & 9 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@ build/Release
# Dependency directories
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

Expand Down Expand Up @@ -94,6 +88,4 @@ typings/
.DS_Store
Thumbs.db

# Ignore built ts files
__tests__/runner/*
lib/**/*
test/runner/*
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run pack
2 changes: 1 addition & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"trailingComma": "none",
"bracketSpacing": false,
"arrowParens": "avoid",
"parser": "typescript"
"parser": "babel"
}
8 changes: 2 additions & 6 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
"[javascript]": {
"editor.formatOnSave": false
},
"[typescript]": {
"editor.formatOnSave": false
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"typescript.tsdk": "node_modules/typescript/lib"
"source.fixAll.eslint": "explicit"
}
}
11 changes: 5 additions & 6 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

The MIT License (MIT)
MIT License

Copyright (c) 2018 GitHub, Inc. and contributors

Expand All @@ -10,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
65 changes: 50 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,69 @@
# Simplecov Report
# Simplecov Report Action

A GitHub Action that report simplecov coverage.
GitHub Action to post SimpleCov coverage on pull requests and fail when coverage is below a threshold.

![Demo](https://i.gyazo.com/c4e572c91fe8048c95392ea3ddce79f5.png)
## What it does

## Usage:
- Reads coverage from `coverage/.last_run.json` by default.
- Supports both `result.covered_percent` and `result.line`.
- Creates or updates one PR comment titled `Simplecov Report`.
- Fails the workflow if coverage is below `failedThreshold`.

The action works only with `pull_request` event.
## Inputs

### Inputs
- `token`: GitHub token (usually `${{ secrets.GITHUB_TOKEN }}`).
- `failedThreshold`: Minimum accepted coverage, default `90`.
- `resultPath`: Coverage file path, default `coverage/.last_run.json`.

- `token` - The GITHUB_TOKEN secret.
- `failedThreshold` - Failed threshold. (default: `90`)
- `resultPath` - Path to last_run json file. (default: `coverage/.last_run.json`)
## Usage

## Example
This action is intended for `pull_request` workflows.

```yaml
name: Tests
name: test

on:
pull_request:

jobs:
build:
rspec:
runs-on: ubuntu-latest
steps:
- name: Test
- uses: actions/checkout@v4

- name: Run tests
run: bundle exec rspec

- name: Simplecov Report
uses: aki77/simplecov-report-action@v1
- name: Report SimpleCov
uses: codeur/simplecov-report-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
failedThreshold: 90
resultPath: coverage/.last_run.json
```

## Dev

Local development commands:

```bash
npm install
```

```bash
npm run lint
```

```bash
npm run test
```

```bash
npm run pack
```

Run everything used in CI build job:

```bash
npm run all
```
3 changes: 0 additions & 3 deletions __tests__/main.test.ts

This file was deleted.

Loading
Loading