extended to support das data request #34
Workflow file for this run
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: Run Pytest | |
on: [ push, pull_request ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash -el {0} | |
strategy: | |
matrix: | |
python-version: [ "3.11" ] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pytest pytest-cov python-dateutil==2.8.2 pint==0.21 importlib-metadata==6.7.0 | |
#- name: Install conda env | |
# uses: conda-incubator/setup-miniconda@v2 | |
# with: | |
# auto-update-conda: true | |
# python-version: ${{ matrix.python-version }} | |
# channels: conda-forge | |
#- name: Install dependencies with conda | |
# run: | | |
# conda install pytest python-dateutil==2.8.2 pint==0.21 | |
- name: Test with pytest | |
working-directory: python/idsse_common/test | |
run: | | |
pytest --cov=../idsse/common --cov-report=term --junitxml=./pytest.xml | tee ./coverage.txt | |
- name: Pytest coverage comment | |
if: ${{ github.ref == 'refs/heads/main' }} | |
id: coverageComment | |
uses: MishaKav/pytest-coverage-comment@main | |
with: | |
hide-comment: true | |
pytest-coverage-path: python/idsse_common/test/coverage.txt | |
- name: Update Readme with Coverage Html | |
if: ${{ github.ref == 'refs/heads/main' }} | |
run: | | |
sed -i '/<!-- Pytest Coverage Comment:Begin -->/,/<!-- Pytest Coverage Comment:End -->/c\<!-- Pytest Coverage Comment:Begin -->\n\${{ steps.coverageComment.outputs.coverageHtml }}\n<!-- Pytest Coverage Comment:End -->' ./README.md | |
- name: Commit & Push changes to Readme | |
if: ${{ github.ref == 'refs/heads/main' }} | |
uses: actions-js/push@master | |
with: | |
message: Update coverage on Readme | |
github_token: ${{ secrets.GITHUB_TOKEN }} |