Skip to content

Commit 4b85505

Browse files
committed
[skip ci] ci: Refactor workflows so that they are usable by forks
1 parent 469d1e5 commit 4b85505

File tree

17 files changed

+491
-224
lines changed

17 files changed

+491
-224
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/.github/ @thomass-dev @rouk1 @augustebaum

.github/actions/sphinx/deploy/action.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ inputs:
1414
required: false
1515
default: scaleway
1616
BUCKET:
17-
required: false
18-
default: prod-probabl-skore
17+
required: true
1918
SOURCE:
2019
required: true
2120
DESTINATION:
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: acquire-pr-context
2+
description: |
3+
Acquire the PR number and the PR commit HEAD sha, after a "workflow_run" event.
4+
5+
The "workflow_run" context differs from the "pull_request" context and doesn't contain
6+
PR basic information. This action intends to provide some missing information in the
7+
"workflow_run" context, without having to explicitly record them in the workflow that
8+
triggered the "workflow_run" event.
9+
10+
outputs:
11+
pr-number:
12+
description: "The PR number"
13+
value: ${{ steps.acquire-pr-context.outputs.number }}
14+
pr-head-sha:
15+
description: "The PR commit HEAD sha"
16+
value: ${{ steps.acquire-pr-context.outputs.head-sha }}
17+
18+
runs:
19+
using: composite
20+
steps:
21+
- id: acquire-pr-context
22+
shell: bash
23+
run: |-
24+
gh pr view \
25+
--repo "${REPOSITORY}" "${BRANCH}" \
26+
--json 'number,headRefOid' \
27+
--jq '"number=\(.number)\nhead-sha=\(.headRefOid)"' \
28+
\
29+
>> "${GITHUB_OUTPUT}"
30+
env:
31+
GH_TOKEN: ${{ github.token }}
32+
REPOSITORY: ${{ github.repository }}
33+
BRANCH: |-
34+
${{
35+
(github.event.workflow_run.head_repository.fork == true)
36+
&& format('{0}:{1}', github.event.workflow_run.head_repository.owner.login, github.event.workflow_run.head_branch)
37+
|| github.event.workflow_run.head_branch
38+
}}

.github/workflows/backend.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: backend
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'skore/src/**'
7+
- 'skore/tests/**'
8+
- 'skore/pyproject.toml'
9+
- 'skore/requirements*.txt'
10+
- '.github/workflows/backend.yml'
11+
push:
12+
branches:
13+
- main
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: true
18+
19+
permissions:
20+
contents: read
21+
22+
defaults:
23+
run:
24+
shell: "bash"
25+
26+
jobs:
27+
backend-lint:
28+
runs-on: "ubuntu-latest"
29+
steps:
30+
- name: Checkout code
31+
uses: actions/checkout@v4
32+
33+
- name: Setup Python
34+
uses: actions/setup-python@v5
35+
with:
36+
python-version: "3.12"
37+
cache: pip
38+
39+
- name: Install dependencies
40+
run: python -m pip install --upgrade pip pre-commit
41+
42+
- name: Lint
43+
working-directory: skore/
44+
run: pre-commit run --all-files ruff
45+
46+
backend-test:
47+
strategy:
48+
fail-fast: true
49+
matrix:
50+
os: ["ubuntu-latest", "windows-latest"]
51+
python: ["3.9", "3.10", "3.11", "3.12"]
52+
include:
53+
- os: "ubuntu-latest"
54+
python: "3.12"
55+
coverage: true
56+
runs-on: ${{ matrix.os }}
57+
steps:
58+
- name: Checkout code
59+
uses: actions/checkout@v4
60+
61+
- name: Setup Python
62+
uses: actions/setup-python@v5
63+
with:
64+
python-version: ${{ matrix.python }}
65+
cache: pip
66+
67+
- name: Install dependencies
68+
run: python -m pip install --upgrade pip build
69+
70+
- name: Build
71+
working-directory: skore/
72+
run: python -m build
73+
74+
- name: Install
75+
working-directory: skore/
76+
run: wheel=(dist/*.whl); python -m pip install "${wheel}[test]"
77+
78+
- name: Test without coverage
79+
if: ${{ ! matrix.coverage }}
80+
timeout-minutes: 10
81+
working-directory: skore/
82+
run: python -m pytest -n auto --no-cov src/ tests/
83+
84+
- name: Test with coverage
85+
if: ${{ matrix.coverage }}
86+
timeout-minutes: 10
87+
working-directory: skore/
88+
run: |
89+
mkdir coverage
90+
python -m pytest -n auto --junitxml=coverage/coverage.xml --cov=skore src/ tests/ | tee coverage/coverage.txt
91+
92+
- name: Upload coverage reports
93+
if: ${{ matrix.coverage && (github.event_name == 'pull_request') }}
94+
uses: actions/upload-artifact@v4
95+
with:
96+
name: backend-coverage
97+
path: skore/coverage/

.github/workflows/ci.yml

Lines changed: 0 additions & 69 deletions
This file was deleted.

.github/workflows/frontend.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: frontend
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'skore-ui/**'
7+
- '.github/workflows/frontend.yml'
8+
push:
9+
branches:
10+
- main
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
permissions:
17+
contents: read
18+
19+
defaults:
20+
run:
21+
shell: "bash"
22+
23+
jobs:
24+
frontend-lint:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Checkout code
28+
uses: actions/checkout@v4
29+
30+
- name: Setup Node
31+
uses: actions/setup-node@v4
32+
with:
33+
node-version: '20'
34+
cache: 'npm'
35+
cache-dependency-path: skore-ui/package-lock.json
36+
37+
- name: Lint
38+
working-directory: skore-ui/
39+
run: |
40+
npm install
41+
npm run type-check
42+
npm run lint
43+
npm run format
44+
npm run style-lint
45+
46+
frontend-test:
47+
runs-on: ubuntu-latest
48+
steps:
49+
- name: Checkout code
50+
uses: actions/checkout@v4
51+
52+
- name: Setup Node
53+
uses: actions/setup-node@v4
54+
with:
55+
node-version: '20'
56+
cache: 'npm'
57+
cache-dependency-path: skore-ui/package-lock.json
58+
59+
- name: Test with coverage
60+
working-directory: skore-ui/
61+
run: |
62+
npm install
63+
npm run test:unit:coverage
64+
65+
- name: Upload coverage reports
66+
if: ${{ github.event_name == 'pull_request' }}
67+
uses: actions/upload-artifact@v4
68+
with:
69+
name: frontend-coverage
70+
path: skore-ui/coverage/
71+
72+
frontend-build:
73+
runs-on: ubuntu-latest
74+
steps:
75+
- name: Checkout code
76+
uses: actions/checkout@v4
77+
78+
- name: Setup Node
79+
uses: actions/setup-node@v4
80+
with:
81+
node-version: '20'
82+
cache: 'npm'
83+
cache-dependency-path: skore-ui/package-lock.json
84+
85+
- name: Build
86+
working-directory: skore-ui/
87+
run: |
88+
npm install
89+
npm run build

.github/workflows/lint.yml

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,40 @@
1-
name: Reusable lint workflow
1+
name: lint
22

3-
on: [workflow_call]
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
permissions:
14+
contents: read
15+
16+
defaults:
17+
run:
18+
shell: "bash"
419

520
jobs:
6-
lint-all-files:
21+
lint:
722
runs-on: ubuntu-latest
823
steps:
9-
- uses: actions/checkout@v4
10-
- uses: actions/setup-python@v5
24+
- name: Checkout code
25+
uses: actions/checkout@v4
26+
27+
- name: Setup Python
28+
uses: actions/setup-python@v5
1129
with:
12-
python-version: '3.12'
13-
cache: 'pip'
14-
- name: Lint all files
15-
run: |
16-
python -m pip install --upgrade pip
17-
python -m pip install --upgrade pre-commit
30+
python-version: "3.12"
31+
cache: pip
32+
33+
- name: Install dependencies
34+
run: python -m pip install --upgrade pip pre-commit
1835

36+
- name: Lint
37+
run: |
1938
pre-commit run --all-files check-yaml
2039
pre-commit run --all-files check-toml
2140
pre-commit run --all-files check-added-large-files

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
name: Add PR assignee
1+
name: add assignee in PR
22

33
on:
4-
pull_request:
4+
pull_request_target:
55
types: [opened]
66

7+
permissions: {}
8+
79
jobs:
8-
add-pr-assignee:
10+
add-assignee:
911
runs-on: ubuntu-latest
1012
permissions:
1113
pull-requests: write

0 commit comments

Comments
 (0)