Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
05a193447f | ||
|
|
4f0c9c0d44 | ||
|
|
77edb1a506 |
@@ -1,4 +1,4 @@
|
|||||||
name: Test Python Package
|
name: Python Test
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -7,41 +7,11 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
python-test:
|
||||||
runs-on: ubuntu-latest
|
uses: brian/CI-templates/.gitea/workflows/python/[email protected]
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Python
|
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
with:
|
||||||
python-version: ${{ inputs.python-version }}
|
python-version: ${{ vars.PYTHON_VERSION }}
|
||||||
|
coverage-package: "elprisenligenu"
|
||||||
- name: Install uv
|
api-url: ${{ vars.API_URL }}
|
||||||
run: pip install uv
|
secrets:
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
env:
|
|
||||||
UV_LINK_MODE: copy
|
|
||||||
run: uv sync --all-extras
|
|
||||||
|
|
||||||
- name: Run pytest
|
|
||||||
env:
|
|
||||||
PYTHONPATH: .
|
|
||||||
run: uv run pytest --cov=python_repositories --cov-report=term-missing > coverage.txt
|
|
||||||
|
|
||||||
- name: Post coverage summary to PR
|
|
||||||
env:
|
|
||||||
API_URL: ${{ vars.API_URL }}
|
|
||||||
REPO_OWNER: ${{ github.repository_owner }}
|
|
||||||
REPO_NAME: ${{ github.event.repository.name }}
|
|
||||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
||||||
CI_RUNNER_TOKEN: ${{ secrets.CI_RUNNER_TOKEN }}
|
CI_RUNNER_TOKEN: ${{ secrets.CI_RUNNER_TOKEN }}
|
||||||
run: |
|
|
||||||
COVERAGE=$(cat coverage.txt)
|
|
||||||
COMMENT_BODY="**Test Coverage Report:**\n\`\`\`\n$COVERAGE\n\`\`\`"
|
|
||||||
curl -s -X POST "$API_URL/repos/$REPO_OWNER/$REPO_NAME/issues/$PR_NUMBER/comments" \
|
|
||||||
-H "Authorization: token $CI_RUNNER_TOKEN" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d "{\"body\": \"$COMMENT_BODY\"}"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user