Skip to content

Commit b277a50

Browse files
Merge branch 'probabl-ai:main' into issues_1364
2 parents a43b36e + c548583 commit b277a50

File tree

45 files changed

+907
-118
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+907
-118
lines changed

.github/dependabot.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ updates:
1919
patterns:
2020
- "*"
2121

22-
# It uses `skore/ci/requirements/python*/.python-version` to specify the python
23-
# version used to update `skore/ci/requirements/**/test-requirements.txt`
22+
# It uses `ci/requirements/**/.python-version` to specify the python version used to
23+
# update `ci/requirements/**/test-requirements.txt`

.github/workflows/pr-add-assignee.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: add assignee in PR
1+
name: pr-add-assignee
22

33
on:
44
pull_request_target:
@@ -7,7 +7,7 @@ on:
77
permissions: {}
88

99
jobs:
10-
add-assignee:
10+
pr-add-assignee:
1111
runs-on: ubuntu-latest
1212
permissions:
1313
pull-requests: write

.github/workflows/pr-cleanup.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: cleanup PR
1+
name: pr-cleanup
22

33
on:
44
pull_request_target:
@@ -11,7 +11,7 @@ defaults:
1111
shell: "bash"
1212

1313
jobs:
14-
clean-artifacts:
14+
pr-clean-artifacts:
1515
if: always()
1616
runs-on: ubuntu-latest
1717
permissions:
@@ -55,7 +55,7 @@ jobs:
5555
HEAD_REPOSITORY_ID: ${{ github.event.pull_request.head.repo.id }}
5656
HEAD_BRANCH: ${{ github.head_ref }}
5757

58-
clean-documentation-preview:
58+
pr-clean-documentation-preview:
5959
if: always()
6060
runs-on: ubuntu-latest
6161
steps:
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
name: display backend coverage in PR
1+
name: pr-display-code-coverage
22

33
on:
44
workflow_run:
5-
workflows: [backend]
5+
workflows: [skore, skore-remote-project]
66
types: [completed]
77

88
concurrency:
9-
group: ${{ github.workflow }}-${{ github.ref }}
9+
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.workflow_run.name }}
1010
cancel-in-progress: true
1111

1212
permissions: {}
1313

1414
jobs:
15-
display-backend-coverage:
15+
pr-display-code-coverage:
1616
if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }}
1717
runs-on: ubuntu-latest
1818
permissions:
@@ -21,24 +21,26 @@ jobs:
2121
pull-requests: write
2222
steps:
2323
- name: Checkout code
24-
uses: actions/checkout@v4
24+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
25+
with:
26+
sparse-checkout: .github
2527

2628
- name: Acquire PR context
2729
id: acquire-pr-context
2830
uses: ./.github/actions/workflow-run/context
2931

3032
- name: Download coverage reports
31-
uses: actions/download-artifact@v4
33+
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
3234
with:
33-
name: backend-coverage
35+
name: ${{ github.event.workflow_run.name }}-coverage
3436
path: coverage/
3537
github-token: ${{ github.token }}
3638
run-id: ${{ github.event.workflow_run.id }}
3739

3840
- name: Display coverage reports
39-
uses: MishaKav/pytest-coverage-comment@main
41+
uses: MishaKav/pytest-coverage-comment@81882822c5b22af01f91bd3eacb1cefb6ad73dc2 # v1.1.53
4042
with:
4143
issue-number: ${{ steps.acquire-pr-context.outputs.pr-number }}
4244
pytest-coverage-path: coverage/coverage.txt
4345
junitxml-path: coverage/coverage.xml
44-
title: Coverage Report for backend
46+
title: Coverage Report for `${{ github.event.workflow_run.name }}`

.github/workflows/pr-lint-title.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: lint title in PR
1+
name: pr-lint-title
22

33
on:
44
pull_request:
@@ -8,7 +8,7 @@ permissions:
88
pull-requests: read
99

1010
jobs:
11-
lint-title:
11+
pr-lint-title:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- uses: actions/setup-node@v4

.github/workflows/pr-serve-documentation-preview.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: serve documentation preview in PR
1+
name: pr-serve-documentation-preview
22

33
on:
44
workflow_run:
@@ -12,7 +12,7 @@ concurrency:
1212
permissions: {}
1313

1414
jobs:
15-
serve-documentation-preview:
15+
pr-serve-documentation-preview:
1616
if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }}
1717
runs-on: ubuntu-latest
1818
permissions:
Lines changed: 229 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
name: skore-remote-project
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
merge_group:
9+
types: [checks_requested]
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
permissions: {}
16+
17+
defaults:
18+
run:
19+
shell: "bash"
20+
21+
jobs:
22+
skore-remote-project-changes:
23+
runs-on: ubuntu-latest
24+
outputs:
25+
changes: ${{ steps.filter.outputs.skore-remote-project }}
26+
permissions:
27+
pull-requests: read
28+
steps:
29+
- name: Checkout code
30+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
31+
32+
- name: Define if at least one file has changed
33+
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
34+
id: filter
35+
with:
36+
filters: |
37+
skore-remote-project:
38+
- '.github/workflows/skore-remote-project.yml'
39+
- 'ci/requirements/skore-remote-project/**'
40+
- 'skore-remote-project/**'
41+
42+
skore-remote-project-lint:
43+
runs-on: "ubuntu-latest"
44+
needs: [skore-remote-project-changes]
45+
if: ${{ (github.event_name == 'push') || (needs.skore-remote-project-changes.outputs.changes == 'true') }}
46+
permissions:
47+
contents: read
48+
steps:
49+
- name: Checkout code
50+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
51+
52+
- name: Setup Python
53+
uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
54+
with:
55+
python-version: "3.12"
56+
cache: pip
57+
58+
- name: Install dependencies
59+
run: python -m pip install --upgrade pip pre-commit
60+
61+
- name: Lint
62+
working-directory: skore-remote-project/
63+
run: |
64+
pre-commit run --all-files ruff
65+
pre-commit run --all-files mypy
66+
67+
skore-remote-project-lockfiles:
68+
runs-on: "ubuntu-latest"
69+
needs: [skore-remote-project-changes]
70+
if: ${{ (contains(fromJSON('["pull_request", "merge_group"]'), github.event_name)) && (needs.skore-remote-project-changes.outputs.changes == 'true') }}
71+
permissions:
72+
contents: read
73+
steps:
74+
- name: Checkout code
75+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
76+
with:
77+
fetch-depth: 2
78+
79+
- name: Check lockfiles are not obsolete
80+
run: |
81+
set -eu
82+
83+
# Check if `pyproject.toml` has changed in this pull-request
84+
# ├── False
85+
# │ └── Exit 0
86+
# └── True
87+
# └── Check if lockfiles have changed in this pull-request
88+
# ├── True
89+
# │ └── Exit 0
90+
# └── False
91+
# └── Recompile lockfiles and check if they have to change
92+
# ├── False
93+
# │ └── Exit 0
94+
# └── True
95+
# └── Exit 1
96+
97+
changes=$(git diff --name-only HEAD^1 HEAD)
98+
99+
if
100+
(echo "${changes}" | grep -qE "skore-remote-project/pyproject.toml") &&
101+
(echo "${changes}" | (! grep -qE "ci/requirements/skore-remote-project/.*/test-requirements.txt"))
102+
then
103+
curl -LsSf https://astral.sh/uv/0.6.16/install.sh | sh
104+
bash ci/pip-compile.sh skore-remote-project
105+
106+
if (git diff --name-only | grep -qE "ci/requirements/skore-remote-project/.*/test-requirements.txt"); then
107+
echo '::error title=skore-remote-project-lockfiles::Lockfiles obsolete, please execute `$ bash ci/pip-compile.sh skore-remote-project`'
108+
exit 1
109+
fi
110+
fi
111+
112+
skore-remote-project-test:
113+
needs: [skore-remote-project-changes]
114+
if: ${{ (github.event_name == 'push') || (needs.skore-remote-project-changes.outputs.changes == 'true') }}
115+
strategy:
116+
fail-fast: false
117+
matrix:
118+
os: ["ubuntu-latest", "windows-latest"]
119+
python: ["3.9", "3.10", "3.11", "3.12"]
120+
scikit-learn: ["1.6"]
121+
include:
122+
- os: "ubuntu-latest"
123+
python: "3.12"
124+
scikit-learn: "1.4"
125+
- os: "ubuntu-latest"
126+
python: "3.12"
127+
scikit-learn: "1.5"
128+
- os: "ubuntu-latest"
129+
python: "3.12"
130+
scikit-learn: "1.6"
131+
coverage: true
132+
runs-on: ${{ matrix.os }}
133+
permissions:
134+
contents: read
135+
steps:
136+
- name: Checkout code
137+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
138+
139+
- name: Setup Python
140+
uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
141+
id: setup-python
142+
with:
143+
python-version: ${{ matrix.python }}
144+
check-latest: True
145+
cache: pip
146+
147+
- name: Restore python-venv
148+
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
149+
id: cache-python-venv
150+
with:
151+
path: 'skore-remote-project/venv'
152+
key: >-
153+
python-venv
154+
-${{ matrix.os }}
155+
-${{ steps.setup-python.outputs.python-version }}
156+
-${{ hashFiles(format('ci/requirements/skore-remote-project/python-{0}/scikit-learn-{1}/test-requirements.txt', matrix.python, matrix.scikit-learn)) }}
157+
158+
- name: Setup python-venv
159+
working-directory: "skore-remote-project/"
160+
run: |
161+
set -eu
162+
163+
# Ensure venv is created
164+
python -m venv venv
165+
166+
# Activate venv for each step depending on the OS
167+
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
168+
echo "${GITHUB_WORKSPACE}/skore-remote-project/venv/bin" >> ${GITHUB_PATH}
169+
echo "VIRTUAL_ENV=${GITHUB_WORKSPACE}/skore-remote-project/venv" >> ${GITHUB_ENV}
170+
else
171+
echo "${GITHUB_WORKSPACE}\\skore-remote-project\\venv\\Scripts" >> ${GITHUB_PATH}
172+
echo "VIRTUAL_ENV=${GITHUB_WORKSPACE}\\skore-remote-project\\venv" >> ${GITHUB_ENV}
173+
fi
174+
175+
- name: Install dependencies in python-venv
176+
working-directory: ${{ format('ci/requirements/skore-remote-project/python-{0}/scikit-learn-{1}', matrix.python, matrix.scikit-learn) }}
177+
if: steps.cache-python-venv.outputs.cache-hit != 'true'
178+
run: |
179+
python -m pip install --upgrade pip build
180+
python -m pip install --requirement test-requirements.txt
181+
182+
- name: Save python-venv
183+
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
184+
if: steps.cache-python-venv.outputs.cache-hit != 'true'
185+
with:
186+
path: 'skore-remote-project/venv'
187+
key: ${{ steps.cache-python-venv.outputs.cache-primary-key }}
188+
189+
- name: Build
190+
working-directory: skore-remote-project/
191+
run: python -m build
192+
193+
- name: Install
194+
working-directory: skore-remote-project/dist/
195+
run: wheel=(*.whl); python -m pip install --force-reinstall --no-deps "${wheel}"
196+
197+
- name: Test without coverage
198+
if: ${{ ! matrix.coverage }}
199+
timeout-minutes: 10
200+
working-directory: skore-remote-project/
201+
run: python -m pytest -n auto src/ tests/ --no-cov
202+
203+
- name: Test with coverage
204+
if: ${{ matrix.coverage }}
205+
timeout-minutes: 10
206+
working-directory: skore-remote-project/
207+
run: |
208+
mkdir coverage
209+
python -m pytest -n auto src/ tests/ --junitxml=coverage/coverage.xml --cov-config=pyproject.toml --cov | tee coverage/coverage.txt
210+
211+
- name: Upload coverage reports
212+
if: ${{ matrix.coverage && (github.event_name == 'pull_request') }}
213+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
214+
with:
215+
name: skore-remote-project-coverage
216+
path: skore-remote-project/coverage/
217+
218+
skore-remote-project:
219+
needs:
220+
- skore-remote-project-changes
221+
- skore-remote-project-lint
222+
- skore-remote-project-lockfiles
223+
- skore-remote-project-test
224+
if: ${{ always() }}
225+
runs-on: Ubuntu-latest
226+
steps:
227+
- shell: bash
228+
run: |
229+
[[ ${{ contains(needs.*.result, 'failure') }} = false ]]

0 commit comments

Comments
 (0)