Skip to content

Commit

Permalink
Coverage badge workflow update.
Browse files Browse the repository at this point in the history
  • Loading branch information
yhtang committed Nov 18, 2021
1 parent a21e421 commit 14e5e5e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 31 deletions.
47 changes: 17 additions & 30 deletions .github/workflows/badge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
name: Badge
on:
push:
# branches:
# - master
# - develop
branches:
- master
- develop
workflow_dispatch:
jobs:
coverage:
Expand All @@ -13,38 +13,25 @@ jobs:
steps:
- name: Check out repository
uses: actions/checkout@v2
- id: tox
name: Launch Tox environment
uses: yhtang/tox-github-action@master
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
tox_env: coverage
- id: test
name: test command
python-version: 3.8
- name: Install dependencies
run: |
echo "::set-output name=test::ABC"
- name: Get coverage number
# run: >
# echo "${{ steps.tox.outputs }}"
# | awk '/^TOTAL\s+[0-9]+\s+[0-9]+\s+([0-9]+%)/ { print "::set-env name=COVERAGE::"$4 }'
run: |
echo "TEST1______________________________"
echo "${{ steps.tox.outputs }}"
echo "TEST2______________________________"
echo ${{ steps.tox.outputs }}
echo "TEST3______________________________"
echo ${{ join(steps.tox.outputs.*, '\n') }}
echo "TEST4______________________________"
echo ${{ join(steps.test.outputs.*, '\n') }}
echo "TEST*______________________________"
echo | awk '{ print "A="3 }' >> $GITHUB_ENV
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Obtain coverage number
run: >
tox -e coverage
| awk '/^TOTAL\s+[0-9]+\s+[0-9]+\s+([0-9]+%)/ { print "COVERAGE="$4 }'
>> $GITHUB_ENV
- name: Create badge endpoint
uses: schneegans/[email protected]
with:
auth: ${{ secrets.CI_COVERAGE_BADGE_GIST }}
gistID: 839011f3f7a6bab680b18cbd9a45d2d3
# filename: coverage-${{ github.ref }}.json
filename: badge.json
label: code coverage
# message: $COVERAGE
message: ${{ env.A }}
filename: coverage-${{ github.ref_name }}.json
label: coverage
message: ${{ env.COVERAGE }}
color: blue
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# FunFact

[![CI](https://github.com/yhtang/FunFact/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/yhtang/FunFact/actions/workflows/ci.yml)[![PyPI version](https://badge.fury.io/py/funfact.svg)](https://badge.fury.io/py/funfact)
[![CI](https://github.com/yhtang/FunFact/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/yhtang/FunFact/actions/workflows/ci.yml)
![Coverage](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/yhtang/839011f3f7a6bab680b18cbd9a45d2d3/raw/coverage-develop.json)
[![PyPI version](https://badge.fury.io/py/funfact.svg)](https://badge.fury.io/py/funfact)
[![Documentation Status](https://readthedocs.org/projects/funfact/badge/?version=latest)](https://funfact.readthedocs.io/en/latest/?badge=latest)
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)

Expand Down

0 comments on commit 14e5e5e

Please sign in to comment.