Skip to content
This repository was archived by the owner on Jul 23, 2025. It is now read-only.

Commit 538a634

Browse files
committed
feat: build for release
0 parents  commit 538a634

2,693 files changed

Lines changed: 506616 additions & 0 deletions

File tree

Some content is hidden

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

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 GP ✅
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: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
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/workflows/PR%20Checks/badge.svg)](https://actions-badge.atrox.dev/paambaati/codeclimate-action/goto)
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+
#### Example
25+
26+
```yaml
27+
steps:
28+
- name: Test & publish code coverage
29+
uses: paambaati/codeclimate-action@v3.1.1
30+
env:
31+
CC_TEST_REPORTER_ID: <code_climate_reporter_id>
32+
with:
33+
coverageCommand: npm run coverage
34+
debug: true
35+
```
36+
37+
#### Example with only upload
38+
39+
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.
40+
41+
```yaml
42+
steps:
43+
- name: Test & publish code coverage
44+
uses: paambaati/codeclimate-action@v3.1.1
45+
env:
46+
CC_TEST_REPORTER_ID: <code_climate_reporter_id>
47+
```
48+
49+
#### Example with wildcard (glob) pattern
50+
51+
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.
52+
53+
```yaml
54+
steps:
55+
- name: Test & publish code coverage
56+
uses: paambaati/codeclimate-action@v3.1.1
57+
env:
58+
CC_TEST_REPORTER_ID: <code_climate_reporter_id>
59+
with:
60+
coverageCommand: yarn run coverage
61+
coverageLocations: |
62+
${{github.workspace}}/*.lcov:lcov
63+
```
64+
65+
#### Example with Jacoco
66+
67+
```yaml
68+
steps:
69+
- name: Test & publish code coverage
70+
uses: paambaati/codeclimate-action@v3.1.1
71+
env:
72+
# Set CC_TEST_REPORTER_ID as secret of your repo
73+
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
74+
JACOCO_SOURCE_PATH: "${{github.workspace}}/src/main/java"
75+
with:
76+
# The report file must be there, otherwise Code Climate won't find it
77+
coverageCommand: mvn test
78+
coverageLocations: ${{github.workspace}}/target/site/jacoco/jacoco.xml:jacoco
79+
```
80+
81+
#### Example of multiple test coverages for monorepo with Jest
82+
83+
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.
84+
85+
```json
86+
"scripts": {
87+
"coverage": "yarn client coverage && yarn server coverage"
88+
}
89+
```
90+
91+
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 —
92+
93+
```lcov
94+
SF:src/server.ts
95+
```
96+
97+
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 —
98+
99+
```javascript
100+
// server/jest.config.js
101+
module.exports = {
102+
...
103+
coverageReporters: [['lcov', { projectRoot: '..' }]]
104+
...
105+
};
106+
```
107+
108+
```yaml
109+
steps:
110+
- name: Test & publish code coverage
111+
uses: paambaati/codeclimate-action@v3.1.1
112+
env:
113+
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
114+
with:
115+
coverageCommand: yarn run coverage
116+
coverageLocations: |
117+
${{github.workspace}}/client/coverage/lcov.info:lcov
118+
${{github.workspace}}/server/coverage/lcov.info:lcov
119+
```
120+
121+
Example projects
122+
123+
1. [paambaati/websight](https://github.com/paambaati/websight/blob/89f03007680531587dd5ff5c673e6d813a298d8c/.github/workflows/ci.yml#L33-L50)
124+
125+
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 <me@httgp.com>'
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: 'node16'
34+
main: 'lib/main.js'

0 commit comments

Comments
 (0)