Skip to content

Commit b74bb25

Browse files
committed
feat: build for release
0 parents  commit b74bb25

File tree

813 files changed

+692490
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

813 files changed

+692490
-0
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 Ganesh "GP" Prasannah `<[email protected]>`
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# codeclimate-action
2+
3+
[![Test Coverage](https://api.codeclimate.com/v1/badges/8f2233d4c51c92ad427c/test_coverage)](https://codeclimate.com/github/paambaati/codeclimate-action/test_coverage)
4+
[![Build Status](https://github.com/paambaati/codeclimate-action/actions/workflows/ci.yml/badge.svg)](https://github.com/paambaati/codeclimate-action/actions/workflows/ci.yml)
5+
[![MIT License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
6+
7+
A GitHub action that publishes your code coverage to [Code Climate](http://codeclimate.com/).
8+
9+
## Usage
10+
11+
This action requires that you set the [`CC_TEST_REPORTER_ID`](https://docs.codeclimate.com/docs/configuring-test-coverage) environment variable. You can find it under Repo Settings in your Code Climate project.
12+
13+
### Inputs
14+
15+
| Input | Default | Description |
16+
| ------------------- | --------------- | ---------------------------------------------------------------------------------- |
17+
| `coverageCommand` | | The actual command that should be executed to run your tests and capture coverage. |
18+
| `workingDirectory` | | Specify a custom working directory where the coverage command should be executed. |
19+
| `debug` | `false` | Enable Code Coverage debug output when set to `true`. |
20+
| `coverageLocations` | | Locations to find code coverage as a multiline string.<br>Each line should be of the form `<location>:<type>`.<br>`type` can be any one of `clover, cobertura, coverage.py, excoveralls, gcov, gocov, jacoco, lcov, lcov-json, simplecov, xccov`. See examples below. |
21+
| `prefix` | `undefined` | See [`--prefix`](https://docs.codeclimate.com/docs/configuring-test-coverage) |
22+
| `verifyDownload` | `true` | Verifies the downloaded Code Climate reporter binary's checksum and GPG signature. See [Verifying binaries](https://github.com/codeclimate/test-reporter#verifying-binaries) |
23+
24+
> **Note**
25+
> If you are a Ruby developer using [SimpleCov](https://github.com/simplecov-ruby/simplecov), other users have recommended installing an additional gem – `gem "simplecov_json_formatter"` – this gem fixes `json` error from the default `coverage/.resultset.json` output from SimpleCov.
26+
27+
#### Example
28+
29+
```yaml
30+
steps:
31+
- name: Test & publish code coverage
32+
uses: paambaati/[email protected]
33+
env:
34+
CC_TEST_REPORTER_ID: <code_climate_reporter_id>
35+
with:
36+
coverageCommand: npm run coverage
37+
debug: true
38+
```
39+
40+
#### Example with only upload
41+
42+
When you've already generated the coverage report in a previous step and wish to just upload the coverage data to Code Climate, you can leave out the `coverageCommand` option.
43+
44+
```yaml
45+
steps:
46+
- name: Test & publish code coverage
47+
uses: paambaati/[email protected]
48+
env:
49+
CC_TEST_REPORTER_ID: <code_climate_reporter_id>
50+
```
51+
52+
#### Example with wildcard (glob) pattern
53+
54+
This action supports basic glob patterns to search for files matching given patterns. It uses [`@actions/glob`](https://github.com/actions/toolkit/tree/master/packages/glob#basic) to expand the glob patterns.
55+
56+
```yaml
57+
steps:
58+
- name: Test & publish code coverage
59+
uses: paambaati/[email protected]
60+
env:
61+
CC_TEST_REPORTER_ID: <code_climate_reporter_id>
62+
with:
63+
coverageCommand: yarn run coverage
64+
coverageLocations: |
65+
${{github.workspace}}/*.lcov:lcov
66+
```
67+
68+
#### Example with Jacoco
69+
70+
```yaml
71+
steps:
72+
- name: Test & publish code coverage
73+
uses: paambaati/[email protected]
74+
env:
75+
# Set CC_TEST_REPORTER_ID as secret of your repo
76+
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
77+
JACOCO_SOURCE_PATH: "${{github.workspace}}/src/main/java"
78+
with:
79+
# The report file must be there, otherwise Code Climate won't find it
80+
coverageCommand: mvn test
81+
coverageLocations: ${{github.workspace}}/target/site/jacoco/jacoco.xml:jacoco
82+
```
83+
84+
#### Example of multiple test coverages for monorepo with Jest
85+
86+
Let's say you have a monorepo with two folders —`client` and `server`, both with their own coverage folders and a `yarn coverage` script which runs Jest within both folders.
87+
88+
```json
89+
"scripts": {
90+
"coverage": "yarn client coverage && yarn server coverage"
91+
}
92+
```
93+
94+
First be sure that paths in your `coverage/lcov.info` are correct; they should be either absolute or relative to the **root** of the monorepo. Open `lcov.info` and search for any path. For example —
95+
96+
```lcov
97+
SF:src/server.ts
98+
```
99+
100+
If you find a *relative* path like this (happens for Jest 25+), it's incorrect as it is relative to the sub-package. This can be fixed by configuring Jest to set the root of your monorepo —
101+
102+
```javascript
103+
// server/jest.config.js
104+
module.exports = {
105+
...
106+
coverageReporters: [['lcov', { projectRoot: '..' }]]
107+
...
108+
};
109+
```
110+
111+
```yaml
112+
steps:
113+
- name: Test & publish code coverage
114+
uses: paambaati/[email protected]
115+
env:
116+
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
117+
with:
118+
coverageCommand: yarn run coverage
119+
coverageLocations: |
120+
${{github.workspace}}/client/coverage/lcov.info:lcov
121+
${{github.workspace}}/server/coverage/lcov.info:lcov
122+
```
123+
124+
Example projects
125+
126+
1. [paambaati/websight](https://github.com/paambaati/websight/blob/5ab56bcc365ee73dd7937e87267db30f6357c4cd/.github/workflows/ci.yml#L33-L50)
127+
128+
2. [MartinNuc/coverage-ga-test](https://github.com/MartinNuc/coverage-ga-test/blob/master/.github/workflows/ci.yaml)

action.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: 'Code Climate Coverage Action'
2+
description: 'Publish code coverage to Code Climate'
3+
author: 'GP <[email protected]>'
4+
branding:
5+
icon: 'code'
6+
color: 'gray-dark'
7+
inputs:
8+
coverageCommand:
9+
required: false
10+
description: 'Coverage command to execute'
11+
default: ''
12+
workingDirectory:
13+
required: false
14+
description: 'Custom working directory for executing the coverage command'
15+
default: ''
16+
debug:
17+
required: false
18+
description: 'Enable debugging logs for the Code Climate test reporter'
19+
default: 'false'
20+
coverageLocations:
21+
required: false
22+
description: 'Locations to find code coverage (Used for builds from multiple locations)'
23+
default: ''
24+
prefix:
25+
required: false
26+
description: 'See https://docs.codeclimate.com/docs/configuring-test-coverage'
27+
default: ''
28+
verifyDownload:
29+
required: false
30+
description: 'Verify the downloaded reporter''s checksum and GPG signature'
31+
default: 'true'
32+
runs:
33+
using: 'node20'
34+
main: 'lib/main.js'

0 commit comments

Comments
 (0)