From 4f0c9c0d44894ad9c8fe8a6a410e8c66be61a304 Mon Sep 17 00:00:00 2001 From: Brian Bjarke Jensen Date: Thu, 30 Oct 2025 00:09:14 +0100 Subject: [PATCH] referenced pytest CI template --- .gitea/workflows/python-pytest.yml | 49 ++++++------------------------ 1 file changed, 9 insertions(+), 40 deletions(-) diff --git a/.gitea/workflows/python-pytest.yml b/.gitea/workflows/python-pytest.yml index 094b2c9..62fe210 100644 --- a/.gitea/workflows/python-pytest.yml +++ b/.gitea/workflows/python-pytest.yml @@ -1,4 +1,4 @@ -name: Test Python Package +name: Python Test on: push: @@ -7,42 +7,11 @@ on: pull_request: jobs: - test: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: ${{ inputs.python-version }} - - - name: Install uv - run: pip install uv - - - 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 - if: github.event_name == 'pull_request' - 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 }} - 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\"}" + python-test: + uses: brian/CI-templates/.gitea/workflows/python/pytest.yml@v1.0.0 + with: + python-version: ${{ vars.PYTHON_VERSION }} + coverage-package: "data_store" + api-url: ${{ vars.API_URL }} + secrets: + CI_RUNNER_TOKEN: ${{ secrets.CI_RUNNER_TOKEN }}