-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update workflow permissions and badges
- Loading branch information
1 parent
8522c50
commit 70a0857
Showing
5 changed files
with
181 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,11 +45,61 @@ jobs: | |
- name: Test with pytest | ||
run: | | ||
source .venv/bin/activate | ||
pytest --cov-report xml --cov=src/ tests/ | ||
pytest --cov-report html --cov=src/ tests/ | ||
rm htmlcov/.gitignore | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v3 | ||
- name: Publish coverage report | ||
if: ${{ github.ref == 'refs/heads/main' && matrix.python-version == '3.10' }} | ||
uses: JamesIves/github-pages-deploy-action@v4 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
file: ./coverage.xml | ||
verbose: true | ||
branch: gh-pages | ||
folder: htmlcov | ||
target-folder: _coverage | ||
|
||
- name: Extract coverage percent | ||
if: ${{ github.ref == 'refs/heads/main' && matrix.python-version == '3.10' }} | ||
run: | | ||
echo "COVERAGE=$(grep -oP 'pc_cov">\K([0-9]+)' htmlcov/index.html)" >> $GITHUB_ENV | ||
- name: Generate coverage badge | ||
if: ${{ github.ref == 'refs/heads/main' && matrix.python-version == '3.10' }} | ||
uses: knightdave/[email protected] | ||
with: | ||
file: docs/_badges/coverage.svg | ||
label: coverage | ||
value: ${{ env.COVERAGE }} | ||
value_format: "%d%%" | ||
anybadge_args: 50=red 60=orange 80=yellow 100=green | ||
template: docs/_badges/template.svg | ||
overwrite: true | ||
|
||
- name: Generate passing badge | ||
if: success() | ||
uses: knightdave/[email protected] | ||
with: | ||
file: docs/_badges/build.svg | ||
label: build | ||
value: passing | ||
color: green | ||
template: docs/_badges/template.svg | ||
overwrite: true | ||
|
||
- name: Generate failing badge | ||
if: failure() | ||
uses: knightdave/[email protected] | ||
with: | ||
file: docs/_badges/build.svg | ||
label: build | ||
value: failing | ||
color: red | ||
template: docs/_badges/template.svg | ||
overwrite: true | ||
|
||
- name: Publish badge | ||
if: success() || failure() | ||
uses: JamesIves/github-pages-deploy-action@v4 | ||
with: | ||
branch: gh-pages | ||
folder: docs/_badges | ||
target-folder: _badges | ||
clean: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,4 +51,62 @@ jobs: | |
uses: JamesIves/github-pages-deploy-action@v4 | ||
with: | ||
branch: gh-pages | ||
folder: docs/_build/html/ | ||
folder: docs/_build/html | ||
clean-exclude: | | ||
_badges | ||
_coverage | ||
- name: Generate style badge | ||
uses: knightdave/[email protected] | ||
with: | ||
file: docs/_badges/style.svg | ||
label: code style | ||
value: black | ||
color: black | ||
template: docs/_badges/template.svg | ||
overwrite: true | ||
|
||
- name: Extract license | ||
run: | | ||
echo "LICENSE=$(grep -oP 'license = "\K([A-z-0-9]+)(?=")' pyproject.toml)" >> $GITHUB_ENV | ||
- name: Generate license badge | ||
uses: knightdave/[email protected] | ||
with: | ||
file: docs/_badges/license.svg | ||
label: license | ||
value: ${{ env.LICENSE }} | ||
color: yellowgreen | ||
template: docs/_badges/template.svg | ||
overwrite: true | ||
|
||
- name: Generate passing badge | ||
if: success() | ||
uses: knightdave/[email protected] | ||
with: | ||
file: docs/_badges/documentation.svg | ||
label: docs | ||
value: passing | ||
color: green | ||
template: docs/_badges/template.svg | ||
overwrite: true | ||
|
||
- name: Generate failing badge | ||
if: failure() | ||
uses: knightdave/[email protected] | ||
with: | ||
file: docs/_badges/documentation.svg | ||
label: docs | ||
value: failing | ||
color: red | ||
template: docs/_badges/template.svg | ||
overwrite: true | ||
|
||
- name: Publish badge | ||
if: success() || failure() | ||
uses: JamesIves/github-pages-deploy-action@v4 | ||
with: | ||
branch: gh-pages | ||
folder: docs/_badges | ||
target-folder: _badges | ||
clean: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,3 +53,34 @@ jobs: | |
run: | | ||
source .venv/bin/activate | ||
mypy src | ||
- name: Generate passing badge | ||
if: success() | ||
uses: knightdave/[email protected] | ||
with: | ||
file: docs/_badges/lint.svg | ||
label: lint | ||
value: passing | ||
color: green | ||
template: docs/_badges/template.svg | ||
overwrite: true | ||
|
||
- name: Generate failing badge | ||
if: failure() | ||
uses: knightdave/[email protected] | ||
with: | ||
file: docs/_badges/lint.svg | ||
label: lint | ||
value: failing | ||
color: red | ||
template: docs/_badges/template.svg | ||
overwrite: true | ||
|
||
- name: Publish badge | ||
if: success() || failure() | ||
uses: JamesIves/github-pages-deploy-action@v4 | ||
with: | ||
branch: gh-pages | ||
folder: docs/_badges | ||
target-folder: _badges | ||
clean: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,11 @@ jobs: | |
|
||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
id-token: write | ||
contents: write | ||
pull-requests: read | ||
|
||
steps: | ||
|
||
- name: Checkout the repo | ||
|
@@ -65,7 +70,6 @@ jobs: | |
tag: ${{ env.RELEASE_VERSION }} | ||
name: ${{ env.RELEASE_VERSION }} | ||
body: ${{ steps.build_changelog.outputs.changelog }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v4 | ||
|
@@ -84,5 +88,23 @@ jobs: | |
- name: Publish package | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
|
||
- name: Generate version badge | ||
if: success() | ||
uses: knightdave/[email protected] | ||
with: | ||
file: docs/_badges/version.svg | ||
label: version | ||
value: ${{ env.RELEASE_VERSION }} | ||
color: teal | ||
template: docs/_badges/template.svg | ||
overwrite: true | ||
|
||
- name: Publish badge | ||
if: success() | ||
uses: JamesIves/github-pages-deploy-action@v4 | ||
with: | ||
password: ${{ secrets.PYPI_TOKEN }} | ||
branch: gh-pages | ||
folder: docs/_badges | ||
target-folder: _badges | ||
clean: false |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.