mirror of
https://github.com/codecov/codecov-action.git
synced 2026-04-20 20:32:35 +08:00
Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d5749ba79a | ||
|
|
b4c0b83601 | ||
|
|
3cde50f4f1 | ||
|
|
10e590a5de | ||
|
|
af19dcb193 | ||
|
|
77e74f257f | ||
|
|
1c4a4261fa | ||
|
|
cb218a0977 | ||
|
|
e78f79e460 | ||
|
|
899e5c913e | ||
|
|
886c7c8bc8 | ||
|
|
75d10d924b | ||
|
|
e61b738355 | ||
|
|
cbad155b75 | ||
|
|
9e1c456662 | ||
|
|
392e5b2711 | ||
|
|
bd5538d84a | ||
|
|
9d47efe7b9 | ||
|
|
6aa7ac1896 | ||
|
|
c2a68071b3 | ||
|
|
8273bebacc | ||
|
|
6728012add |
23
.github/workflows/main.yml
vendored
Normal file
23
.github/workflows/main.yml
vendored
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
name: Example workflow for Codecov
|
||||||
|
on: [push]
|
||||||
|
jobs:
|
||||||
|
run:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@master
|
||||||
|
|
||||||
|
# - name: Setup Python
|
||||||
|
# uses: actions/setup-python@master
|
||||||
|
|
||||||
|
# - name: Generate coverage report
|
||||||
|
# run: |
|
||||||
|
# pip install pytest
|
||||||
|
# pip install pytest-cov
|
||||||
|
# pytest --cov=./ --cov-report=xml
|
||||||
|
|
||||||
|
- name: Upload coverage to Codecov
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
token: ${{secrets.CODECOV_TOKEN}}
|
||||||
|
flags: unittest
|
||||||
|
name: codecov-1
|
||||||
17
Dockerfile
17
Dockerfile
@@ -1,12 +1,15 @@
|
|||||||
# Codecov @codecov
|
# Codecov @codecov
|
||||||
|
|
||||||
FROM alpine:3.10
|
FROM debian:stretch-slim
|
||||||
|
|
||||||
WORKDIR /app
|
RUN apt-get update && apt-get install -y \
|
||||||
COPY . /app
|
ca-certificates \
|
||||||
|
curl \
|
||||||
|
git \
|
||||||
|
mercurial \
|
||||||
|
--no-install-recommends && rm -r /var/lib/apt/lists/*
|
||||||
|
|
||||||
RUN apk add --no-cache curl bash git
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
|
RUN chmod +x /entrypoint.sh
|
||||||
|
|
||||||
RUN chmod +x /app/entrypoint.sh
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|
||||||
ENTRYPOINT [ "/app/entrypoint.sh" ]
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
# Codecov GitHub Action
|
# Codecov GitHub Action
|
||||||
|
|
||||||
|
[](https://github.com/marketplace/actions/codecov)
|
||||||
### Easily upload coverage reports to Codecov from GitHub Actions
|
### Easily upload coverage reports to Codecov from GitHub Actions
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
@@ -10,7 +12,7 @@ Inside your `.github/workflows/workflow.yml` file:
|
|||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@master
|
- uses: actions/checkout@master
|
||||||
- uses: actions/codecov-action@v1.0.0
|
- uses: codecov/codecov-action@v1.0.3
|
||||||
with:
|
with:
|
||||||
token: ${{secrets.CODECOV_TOKEN}} #required
|
token: ${{secrets.CODECOV_TOKEN}} #required
|
||||||
file: ./coverage.xml #optional
|
file: ./coverage.xml #optional
|
||||||
@@ -50,7 +52,7 @@ jobs:
|
|||||||
pip install pytest-cov
|
pip install pytest-cov
|
||||||
pytest --cov=./ --cov-report=xml
|
pytest --cov=./ --cov-report=xml
|
||||||
- name: Upload coverage to Codecov
|
- name: Upload coverage to Codecov
|
||||||
uses: codecov/codecov-action@v1.0.0
|
uses: codecov/codecov-action@v1.0.3
|
||||||
with:
|
with:
|
||||||
token: ${{secrets.CODECOV_TOKEN}}
|
token: ${{secrets.CODECOV_TOKEN}}
|
||||||
file: ./coverage.xml
|
file: ./coverage.xml
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ inputs:
|
|||||||
required: false
|
required: false
|
||||||
token:
|
token:
|
||||||
description: 'Repository upload token - get it from codecov.io'
|
description: 'Repository upload token - get it from codecov.io'
|
||||||
required: false
|
required: true
|
||||||
file:
|
file:
|
||||||
description: 'Path to coverage file to upload'
|
description: 'Path to coverage file to upload'
|
||||||
required: false
|
required: false
|
||||||
|
|||||||
44
entrypoint.sh
Normal file → Executable file
44
entrypoint.sh
Normal file → Executable file
@@ -1,38 +1,20 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
# Codecov @codecov
|
# Codecov @codecov
|
||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
if [ $# -eq 0 ]
|
if [ "x$INPUT_FILE" != 'x' ]; then
|
||||||
then
|
curl -s https://codecov.io/bash | bash -s -- \
|
||||||
echo "Please provide an upload token from codecov.io"
|
-f "$INPUT_FILE" \
|
||||||
exit 1
|
-t "$INPUT_TOKEN" \
|
||||||
elif [ "x$INPUT_TOKEN" != "x" ] && [ "x$INPUT_FILE" != "x" ] && [ "x$INPUT_FLAGS" != "x" ] && [ "x$INPUT_NAME" != "x" ]
|
-n "$INPUT_NAME" \
|
||||||
then
|
-F "$INPUT_FLAGS" \
|
||||||
bash <(curl -s https://codecov.io/bash) -t $INPUT_TOKEN -f $INPUT_FILE -F $INPUT_FLAGS -n $INPUT_NAME
|
-Z || echo 'Codecov upload failed'
|
||||||
elif [ "x$INPUT_TOKEN" != "x" ] && [ "x$INPUT_FILE" != "x" ] && [ "x$INPUT_FLAGS" != "x" ]
|
|
||||||
then
|
|
||||||
bash <(curl -s https://codecov.io/bash) -t $INPUT_TOKEN -f $INPUT_FILE -F $INPUT_FLAGS
|
|
||||||
elif [ "x$INPUT_TOKEN" != "x" ] && [ "x$INPUT_FILE" != "x" ] && [ "x$INPUT_NAME" != "x" ]
|
|
||||||
then
|
|
||||||
bash <(curl -s https://codecov.io/bash) -t $INPUT_TOKEN -f $INPUT_FILE -n $INPUT_NAME
|
|
||||||
elif [ "x$INPUT_TOKEN" != "x" ] && [ "x$INPUT_NAME" != "x" ] && [ "x$INPUT_FLAGS" != "x" ]
|
|
||||||
then
|
|
||||||
bash <(curl -s https://codecov.io/bash) -t $INPUT_TOKEN -n $INPUT_NAME -F $INPUT_FLAGS
|
|
||||||
elif [ "x$INPUT_TOKEN" != "x" ] && [ "x$INPUT_FILE" != "x" ]
|
|
||||||
then
|
|
||||||
bash <(curl -s https://codecov.io/bash) -t $INPUT_TOKEN -f $INPUT_FILE
|
|
||||||
elif [ "x$INPUT_TOKEN" != "x" ] && [ "x$INPUT_FLAGS" != "x" ]
|
|
||||||
then
|
|
||||||
bash <(curl -s https://codecov.io/bash) -t $INPUT_TOKEN -F $INPUT_FLAGS
|
|
||||||
elif [ "x$INPUT_TOKEN" != "x" ] && [ "x$INPUT_NAME" != "x" ]
|
|
||||||
then
|
|
||||||
bash <(curl -s https://codecov.io/bash) -t $INPUT_TOKEN -n $INPUT_NAME
|
|
||||||
elif [ "x$INPUT_TOKEN" != "x" ]
|
|
||||||
then
|
|
||||||
bash <(curl -s https://codecov.io/bash) -t $INPUT_TOKEN
|
|
||||||
else
|
else
|
||||||
echo "Please provide an upload token from codecov.io with valid arguments"
|
curl -s https://codecov.io/bash | bash -s -- \
|
||||||
exit 1
|
-t "$INPUT_TOKEN" \
|
||||||
|
-n "$INPUT_NAME" \
|
||||||
|
-F "$INPUT_FLAGS" \
|
||||||
|
-Z || echo 'Codecov upload failed'
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user