Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ianwremmel committed Jul 13, 2019
1 parent 439ee30 commit ca92869
Show file tree
Hide file tree
Showing 7 changed files with 184 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/main.workflow
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
workflow "Validate Commit Messages" {
on = "push"
resolves = "Prevent Fixup Commits"
}

action "Prevent Fixup Commits" {
uses = "ianwremmel/prevent-fixup-commits@v1.0.0"
}
20 changes: 20 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"arrowParens": "always",
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "es5",
"bracketSpacing": false,
"jsxBracketSameLine": false,
"proseWrap": "always",
"overrides": [
{
"files": "*.md",
"options": {
"tabWidth": 4
}
}
]
}
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM bash:5.0.7

LABEL version="1.0.0"
LABEL repository="http://github.com/check-run-reporter/action"
LABEL homepage="http://github.com/check-run-reporter/action"
LABEL maintainer="Ian Remmel, LLC <support@check-run-reporter.com>"

LABEL com.github.actions.name="Check Run Reporter"
LABEL com.github.actions.description="Upload structure reports to check-run-reporter.com"
LABEL com.github.actions.icon="check"
LABEL com.github.actions.color="orange"

RUN apk add curl

COPY "entrypoint" "/entrypoint"
ENTRYPOINT ["/entrypoint"]
CMD ["entrypoint"]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2019 Ian Remmel, LLC

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
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 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.
76 changes: 76 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# GitHub Actions for Check Run Reporter _(check-run-reporter/action)_

> A GitHub action for uploading structured test reports to
> [check-run-reporter.com](https://www.check-run-reporter.com).
## Usage

First, get your `CHECK_RUN_REPORTER_REPO_TOKEN` from
[check-run-reporter.com](https://check-run-reporter.com/repos) and set it as a
[secret in your GitHub repo](https://developer.github.com/actions/managing-workflows/storing-secrets/).

Use `CHECK_RUN_REPORTER_LABEL` and `CHECK_RUN_REPORTER_REPORT_GLOB` to tell the
action where your report(s) are and how to label them when they're uploaded. The
example below shows how you might configure a JavaScript project to upload
multiple JUnit reports.

```hcl
workflow "Test" {
on = "push"
resolves = "Report"
}
action "Install" {
uses = "actions/npm@master"
args = "ci"
}
action "Test" {
needs "Install"
uses "actions/npm@master"
args = "test"
env = {
REPORT_DIR = "reports/junit"
}
}
action "Report" {
uses = "check-run-reporter/actions"
secrets = ["CHECK_RUN_REPORTER_REPO_TOKEN"]
env = {
CHECK_RUN_REPORTER_LABEL = "Unit Tests"
CHECK_RUN_REPORTER_REPORT_GLOB = "reports/junit/**/*.xml"
}
}
```

> You can declare the action multiple times if you'd like to do separate
> submissions with different labels (for example, you want separate style report
> and test report submissions).
## API

`CHECK_RUN_REPORTER_REPO_TOKEN`: (required, secret) The token used to
authenticate the report submission to check-run-reporter.com.
`CHECK_RUN_REPORTER_LABEL`: (optional, environment) The label used for the
submitted reports `CHECK_RUN_REPORTER_REPORT_GLOB`: (required, environment) A
bash-style (`shopt -s globstar`) shell glob for identifying all of the reports
to submit.

## Maintainers

[Ian Remmel](https://github.com/ianwremmel)

## Contributing

We welcome pull requests, but for anything more than a minor tweak, please
create an issue for so we can discuss whether the change is the right direction
for the project.

## License

[MIT](LICENSE) &copy; Ian Remmel, LLC 2019
32 changes: 32 additions & 0 deletions entrypoint
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash

set -euo pipefail
shopt -s globstar

log () {
echo "$@"
}

if [ "$CHECK_RUN_REPORTER_REPO_TOKEN" == '' ]; then
log 'CHECK_RUN_REPORTER_REPO_TOKEN is required'
exit 1
fi

if [ "$CHECK_RUN_REPORTER_REPORT_GLOB" == '' ]; then
log 'CHECK_RUN_REPORTER_REPORT_GLOB is required'
exit 1
fi

CHECK_RUN_REPORTER_LABEL="${CHECK_RUN_REPORTER_LABEL:-'Checks'}"

CMD='curl https://www.check-run-reporter.com/api/v1/submissions'
CMD+=" --user token:$CHECK_RUN_REPORTER_REPO_TOKEN"
CMD+=" -F root=$(pwd)"
CMD+=" -F sha=$GITHUB_SHA"
CMD+=" -F label=$CHECK_RUN_REPORTER_LABEL"

for FILE in $CHECK_RUN_REPORTER_REPORT_GLOB; do
CMD+=" -F $FILE"
done

$CMD
10 changes: 10 additions & 0 deletions playground.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

set -euo pipefail
shopt -s globstar

GLOB='**/*'

for FILE in $GLOB; do
echo $FILE
done

0 comments on commit ca92869

Please sign in to comment.