Skip to content

Commit

Permalink
ci: Fix skore workflow to send coverage report even on PR from forks
Browse files Browse the repository at this point in the history
  • Loading branch information
thomass-dev committed Dec 18, 2024
1 parent 47a7b9f commit c622923
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 70 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- 'skore/tests/**'
- 'skore/pyproject.toml'
- 'skore/requirements*.txt'
- '.github/workflows/skore.yml'
- '.github/workflows/skore-test.yml'
skore-ui:
- 'skore-ui/**'
- '.github/workflows/skore-ui.yml'
Expand All @@ -42,7 +42,7 @@ jobs:
lint-and-test-skore:
needs: [lint-all-files, changes]
if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'pull_request' && needs.changes.outputs.skore == 'true') }}
uses: ./.github/workflows/skore.yml
uses: ./.github/workflows/skore-test.yml
permissions:
contents: read
pull-requests: write
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/skore-send-coverage-artifact.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name:

on:
workflow_run:
workflows: ["Reusable skore workflow"]
types:
- completed

permissions:
pull-requests: write

jobs:
send-coverage-message:
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
steps:
- name: Download coverage reports
uses: actions/download-artifact@v4
with:
name: python-coverage
path: coverage/
- name: Send
uses: MishaKav/pytest-coverage-comment@main
with:
pytest-coverage-path: coverage/coverage.txt
junitxml-path: coverage/coverage.xml
title: pytest coverage report
54 changes: 54 additions & 0 deletions .github/workflows/skore-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Reusable skore workflow

on: [workflow_call]

defaults:
run:
shell: "bash"

jobs:
test-skore:
strategy:
fail-fast: true
matrix:
os: ["ubuntu-latest", "windows-latest"]
python: ["3.9", "3.10", "3.11", "3.12"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: "pip"
- name: Setup
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade pre-commit
python -m pip install --upgrade build
- name: Lint
working-directory: skore/
run: pre-commit run --all-files ruff
- name: Build
working-directory: skore/
run: python -m build
- name: Install
working-directory: skore/
run: wheel=(dist/*.whl); python -m pip install "${wheel}[test]"
- name: Test without coverage
if: matrix.os != 'ubuntu-latest' || matrix.python != '3.12'
timeout-minutes: 10
working-directory: skore/
run: python -m pytest --no-cov src/ tests/
- name: Test with coverage
if: matrix.os == 'ubuntu-latest' && matrix.python == '3.12'
timeout-minutes: 10
working-directory: skore/
run: |
mkdir coverage
python -m pytest --junitxml=coverage/coverage.xml --cov=skore src/ tests/ | tee coverage/coverage.txt
- name: Upload coverage reports
if: matrix.os == 'ubuntu-latest' && matrix.python == '3.12'
uses: actions/upload-artifact@v4
with:
name: python-coverage
path: skore/coverage/
68 changes: 0 additions & 68 deletions .github/workflows/skore.yml

This file was deleted.

0 comments on commit c622923

Please sign in to comment.