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

Commit 5f3d206

Browse files
committed
feat: build for release
0 parents  commit 5f3d206

File tree

884 files changed

+739337
-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.

884 files changed

+739337
-0
lines changed

INTERNAL-NOTES.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Internal Notes
2+
3+
## How to check for release version
4+
5+
```
6+
pnpm dlx release-please release-pr --token="<insert-github-token>" --repo-url=paambaati/codeclimate-action --trace --dry-run
7+
```

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