diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..2e7b2d4 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,4 @@ +[coverage:run] +relative_files = true +omit = + tests/* \ No newline at end of file diff --git a/.github/workflows/.cov.yml b/.github/workflows/.cov.yml new file mode 100644 index 0000000..d8a54b7 --- /dev/null +++ b/.github/workflows/.cov.yml @@ -0,0 +1,49 @@ +name: + cov + +on: + push + +jobs: + cov-job: + runs-on: ubuntu-latest + name: checking coverage + permissions: + pull-requests: write + contents: write + steps: + - uses: actions/checkout@v3 + + - name: set up python + id: setup-python + uses: actions/setup-python@v4 + with: + python-version: 3 + + - name: installing uv + run: pip install uv + + - name: syncing uv + run: uv sync --all-extras + + - name: activating uv venv + run: source .venv/bin/activate && coverage run -m pytest + +# - name: launching coverage +# run: coverage run -m pytest + + - name: cov_comment + id: coverage_comment + uses: py-cov-action/python-coverage-comment-action@v3 + with: + GITHUB_TOKEN: ${{ github.token }} + MINIMUM_GREEN: 90 + + - name: Store Pull Request comment to be posted + uses: actions/upload-artifact@v4 + if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true' + with: + # If you use a different name, update COMMENT_ARTIFACT_NAME accordingly + name: python-coverage-comment-action + # If you use a different name, update COMMENT_FILENAME accordingly + path: python-coverage-comment-action.txt \ No newline at end of file diff --git a/README.md b/README.md index fadc3a7..61e1936 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # sqlmodelgen +![Coverage badge](https://raw.githubusercontent.com/nucccc/sqlmodelgen/python-coverage-comment-action-data/badge.svg) + `sqlmodelgen` is a library to generate models for the **sqlmodel** library ([repo](https://github.com/fastapi/sqlmodel), [official docs](https://sqlmodel.tiangolo.com/)). It accepts in input the following sources: