Skip to content

Commit

Permalink
Merge pull request #33 from codecov/node-action
Browse files Browse the repository at this point in the history
Convert action from docker to javascript
  • Loading branch information
ibrahim0814 committed Nov 19, 2019
2 parents 8d062b2 + e6cea4a commit aea8376
Show file tree
Hide file tree
Showing 11 changed files with 34,694 additions and 60 deletions.
Binary file added .DS_Store
Binary file not shown.
92 changes: 92 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# react / gatsby
public/

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ The following is a set of guidelines for contributing to this repository, which

## What does this repo do?

This repo is a GitHub Action, meaning it integrates with the GitHub Actions CI/CD pipeline. It's meant to take formatted reports with code coverage stats and upload them to codecov.io. What's essentially happening in the background is that Actions is spinning up a Linux Docker container with the contents of this repository. Inside that container, we then call a shell scipt that runs Codecov's Bash uploader.
This repo is a GitHub Action, meaning it integrates with the GitHub Actions CI/CD pipeline. It's meant to take formatted reports with code coverage stats and upload them to codecov.io. Our Node action uses the Actions toolkit to make system calls that allow us to run Codecov's bash uploader inside of Node. Essentially what we're doing in this action is downloading Codecov's bash uploader script from codecov.io/bash, saving it as a file in the current directory, executing the file via `exec` calls, then removing the script from the current directory.

## PRs and Support
## PRs, Issues, and Support

Feel free to clone, modify code and request a PR to this repository. All PRs will be reviewed by the Codecov team. If your PR has been sitting for a while or if you have any questions, ping us at [email protected]
Feel free to clone, modify code and request a PR to this repository. All PRs and issues will be reviewed by the Codecov team. If your PR/issue has been sitting for a while or if you have any questions, ping us at [email protected]
15 changes: 0 additions & 15 deletions Dockerfile

This file was deleted.

35 changes: 20 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,51 @@
# Codecov GitHub Action

[![GitHub Marketplace](https://img.shields.io/badge/Marketplace-v1.0.3-undefined.svg?logo=github&logoColor=white&style=flat)](https://github.com/marketplace/actions/codecov)
[![GitHub Marketplace](https://img.shields.io/badge/Marketplace-v1.0.4-undefined.svg?logo=github&logoColor=white&style=flat)](https://github.com/marketplace/actions/codecov)
### Easily upload coverage reports to Codecov from GitHub Actions

## Usage

To integrate Codecov with your Actions pipeline, specify the name of this repository with a tag number as a `step` within your `workflow.yml` file. This Action also requires you to [provide an upload token](https://docs.codecov.io/docs/frequently-asked-questions#section-where-is-the-repository-upload-token-found-) from [codecov.io](https://www.codecov.io) (tip: in order to avoid exposing your token, store it as a `secret`). Optionally, you can choose to include three additional inputs to customize the upload context.
To integrate Codecov with your Actions pipeline, specify the name of this repository with a tag number as a `step` within your `workflow.yml` file. This Action also requires you to [provide an upload token](https://docs.codecov.io/docs/frequently-asked-questions#section-where-is-the-repository-upload-token-found-) from [codecov.io](https://www.codecov.io) (tip: in order to avoid exposing your token, store it as a `secret`). Optionally, you can choose to include up to four additional inputs to customize the upload context.

Inside your `.github/workflows/workflow.yml` file:

```yaml
steps:
- uses: actions/checkout@master
- uses: codecov/codecov-action@v1.0.3
- uses: codecov/codecov-action@v1
with:
token: ${{secrets.CODECOV_TOKEN}} #required
token: ${{ secrets.CODECOV_TOKEN }} #required
file: ./coverage.xml #optional
flags: unittests #optional
name: codecov-umbrella #optional
yml: ./codecov.yml #optional
```
>**Note**: This assumes that you've set your Codecov token inside *Settings > Secrets* as `CODECOV_TOKEN`. If not, you can [get an upload token](https://docs.codecov.io/docs/frequently-asked-questions#section-where-is-the-repository-upload-token-found-) for your specific repo on [codecov.io](https://www.codecov.io).
## Arguments

Codecov's Action currently supports four inputs from the user: `token`, `file`, `flags`, and `name`. These inputs, along with their descriptions and usage contexts, are listed in the table below:
Codecov's Action currently supports five inputs from the user: `token`, `file`, `flags`,`name`, and `yml`. These inputs, along with their descriptions and usage contexts, are listed in the table below:

| Input | Description | Usage |
| :---: | :---: | :---: |
| `token` | Used to authorize coverage report uploads | *Required* |
| `file` | Location of the coverage report | Optional
| `flags` | Flag upload under a certain group | Optional
| `name` | Custom defined name for the upload | Optional
| `file` | Path to the coverage report(s) | Optional
| `flags` | Flag the upload to group coverage metrics (unittests, uitests, etc.) | Optional
| `name` | Custom defined name for the build | Optional
| `yml` | Path to codecov.yml config file | Optional

### Example `workflow.yml` with Codecov Action
> **Note**: This is a Docker based action and will only run on Linux based systems (e.g Ubuntu). Windows and macOS builds are currently not supported.
>**Note**: The latest release of this Action adds support for macOS and Windows builds!
```yaml
name: Example workflow for Codecov
on: [push]
jobs:
run:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@master
- name: Setup Python
Expand All @@ -52,14 +57,14 @@ jobs:
pip install pytest
pip install pytest-cov
pytest --cov=./ --cov-report=xml
- name: Upload coverage to Codecov
if: runner.os == 'Linux'
uses: codecov/[email protected]
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{secrets.CODECOV_TOKEN}}
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
name: codecov-umbrella
yml: ./codecov.yml
```
## Contributing

Expand Down
12 changes: 5 additions & 7 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@ inputs:
flags:
description: 'Flag upload to group coverage metrics (e.g. unittests | integration | ui,chrome)'
required: false
yml:
description: 'Specify the location of the .codecov.yml config file'
required: false
branding:
color: 'red'
icon: 'umbrella'
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.name }}
- ${{ inputs.token }}
- ${{ inputs.file }}
- ${{ inputs.flags }}
using: 'node12'
main: 'dist/index.js'

0 comments on commit aea8376

Please sign in to comment.