HTTP Utils and PathBuilder mods #419
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: | |
branches: | |
- 'main' | |
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 python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pytest pytest_httpserver requests==2.31.0 pylint==2.17.5 python-dateutil==2.8.2 pint==0.21 importlib-metadata==6.7.0 jsonschema==4.19.0 pika==1.3.1 pyproj==3.6.1 numpy==1.26.2 shapely==2.0.2 netcdf4==1.6.3 h5netcdf==1.1.0 pytest-cov==4.1.0 pillow==10.2.0 python-logging-rabbitmq==2.3.0 | |
- name: Set PYTHONPATH for pytest | |
run: | | |
echo "PYTHONPATH=python/idsse_common/idsse/common" >> $GITHUB_ENV | |
- name: Checkout idss-engine-commons | |
uses: actions/checkout@v2 | |
with: | |
repository: NOAA-GSL/idss-engine-commons | |
path: commons/ | |
- name: Install IDSSE python commons | |
working-directory: commons/python/idsse_common | |
run: pip install . | |
- name: Checkout idsse-testing | |
uses: actions/checkout@v2 | |
with: | |
repository: NOAA-GSL/idsse-testing | |
ref: main | |
path: testing/ | |
- name: Install IDSSE python testing | |
working-directory: testing/python | |
run: pip install . | |
- name: Test with pytest | |
working-directory: python/idsse_common | |
# run Pytest, exiting nonzero if pytest throws errors (otherwise "| tee" obfuscates) | |
run: | | |
set -o pipefail; | |
pytest ./test --cov=./idsse/common --cov-report=term --junitxml=./test/pytest.xml | tee ./test/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 }} |