Merge pull request #61 from jbellister-slac/update_demo #120
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
name: Tests | |
on: [push, pull_request] | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
python-version: [3.9] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
mamba-version: "*" | |
channels: conda-forge | |
activate-environment: lume-services-dev | |
environment-file: dev-environment.yml | |
#- name: flake8 | |
# shell: bash -l {0} | |
# run: | | |
# flake8 . | |
- name: Install lume-services | |
shell: bash -l {0} | |
run: | | |
pip install -e . | |
- run: mkdir coverage | |
- name: Run Tests | |
shell: bash -l {0} | |
run: | | |
pytest --cov-report term --cov=lume_services --junitxml=./coverage/pytest.xml | tee ./coverage/pytest-coverage.txt | |
- name: store coverage files | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage | |
path: coverage | |
coverage: | |
if: always() | |
runs-on: ubuntu-latest | |
needs: test | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@v3 | |
- name: get coverage files | |
uses: actions/download-artifact@v3 | |
with: | |
name: coverage | |
path: coverage | |
- name: Pytest coverage comment | |
id: coverageComment | |
uses: MishaKav/pytest-coverage-comment@main | |
with: | |
pytest-coverage-path: ./coverage/pytest-coverage.txt | |
junitxml-path: ./coverage/pytest.xml | |
- name: Check the output coverage | |
run: | | |
echo "Coverage Percantage - ${{ steps.coverageComment.outputs.coverage }}" | |
echo "Coverage Color - ${{ steps.coverageComment.outputs.color }}" | |
echo "Coverage Html - ${{ steps.coverageComment.outputs.coverageHtml }}" | |
echo "Coverage Warnings - ${{ steps.coverageComment.outputs.warnings }}" | |
echo "Coverage Errors - ${{ steps.coverageComment.outputs.errors }}" | |
echo "Coverage Failures - ${{ steps.coverageComment.outputs.failures }}" | |
echo "Coverage Skipped - ${{ steps.coverageComment.outputs.skipped }}" | |
echo "Coverage Tests - ${{ steps.coverageComment.outputs.tests }}" | |
echo "Coverage Time - ${{ steps.coverageComment.outputs.time }}" | |
echo "Not Success Test Info - ${{ steps.coverageComment.outputs.notSuccessTestInfo }}" | |
- name: Create the Badge | |
if: ${{ github.repository == 'slaclab/lume-services' }} | |
uses: schneegans/dynamic-badges-action@v1.4.0 | |
with: | |
auth: ${{ secrets.PYTEST_COVERAGE_COMMENT }} | |
gistID: 61dce43449fc0509f34520fd7efc41b1 | |
filename: slaclab-lume-services-coverage.json | |
label: Coverage Report | |
message: ${{ steps.coverageComment.outputs.coverage }} | |
color: ${{ steps.coverageComment.outputs.color }} | |
namedLogo: python |