diff --git a/.github/codecov.yml b/.github/codecov.yml new file mode 100644 index 0000000..c203f26 --- /dev/null +++ b/.github/codecov.yml @@ -0,0 +1,27 @@ +# This is the configuration for codecov.yml -- remember to validate it. +# +# cat .github/codecov.yml | curl --data-binary @- https://codecov.io/validate + +codecov: + notify: + wait_for_ci: false + require_ci_to_pass: false + +coverage: + status: + patch: + default: + target: 95% + project: + default: false + docstringify: + target: 95% + paths: + - "!tests/.*" + tests: + target: 100% + paths: + - "tests/.*" + +comment: + layout: "reach, diff, files" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1b04030..067abb5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -# This workflow builds docstringify on Mac, Linux, and Windows for +# This workflow builds Docstringify on Mac, Linux, and Windows for # multiple versions of Python to confirm it can be properly installed. # # Based on https://github.com/stefmolin/data-morph/blob/main/.github/workflows/ci.yml @@ -66,4 +66,12 @@ jobs: run: python -m pip install --group dev - name: Validate pre-commit hook - run: pre-commit try-repo . docstringify + run: pre-commit try-repo . docstringify --all-files + + - name: Run tests + run: pytest + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5.3.1 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/codecov-validate.yml b/.github/workflows/codecov-validate.yml new file mode 100644 index 0000000..1e2ee5e --- /dev/null +++ b/.github/workflows/codecov-validate.yml @@ -0,0 +1,34 @@ +# This workflow checks that the codecov.yml file is valid, if it is included in the PR. +# +# Author: Stefanie Molin + +name: Validate codecov config + +on: + pull_request: + paths: + - '.github/codecov.yml' + schedule: + - cron: '21 21 21 * *' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + # check that the codecov.yml configuration is valid + codecov: + runs-on: ubuntu-latest + name: Validate codecov.yml + steps: + - name: Checkout Code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: 0 + - name: Validate with codecov API + run: | + response=$(cat .github/codecov.yml | curl --data-binary @- https://codecov.io/validate) + echo $response + if [[ $response = Error* ]]; then + exit 1 + fi