PyOpenSci Review - Documentation Updates #341
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: Ensure Sufficient Coverage | |
on: | |
pull_request: | |
branches: [main] | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
if: contains(github.event.pull_request.labels.*.name, 'PR Ready for Review') | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash -el {0} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
python-version: "3.10" | |
- name: Install Dependencies | |
run: | | |
python -m pip install -e .[molecules] | |
python -m pip install coverage | |
- name: Run Tests | |
run: | | |
coverage run --source=. --omit=astartes/__init__.py,setup.py,test/*,astartes/samplers/sampler.py -m unittest discover -v | |
- name: Show Coverage | |
run: | | |
coverage report -m > temp.txt | |
cat temp.txt | |
python .github/workflows/coverage_helper.py | |
echo "COVERAGE_PERCENT=$(cat temp2.txt)" >> $GITHUB_ENV | |
- name: Request Changes via Review | |
if: ${{ env.COVERAGE_PERCENT < 90 }} | |
uses: andrewmusgrave/[email protected] | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
event: REQUEST_CHANGES | |
body: "Increase test coverage from ${{ env.COVERAGE_PERCENT }}% to at least 90% before merging." | |
- name: Approve PR if Coverage Sufficient | |
if: ${{ env.COVERAGE_PERCENT > 89 }} | |
uses: andrewmusgrave/[email protected] | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
event: APPROVE | |
body: "Test coverage meets or exceeds 90% threshold (currently ${{ env.COVERAGE_PERCENT }}%)." |