-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Modularize CI pipeline and test Python >= 3.11 (#402)
- Remove reference of `Makefile` in workflow's instructions to build front-end - Use matrix to test back-end on all versions of python `>=3.11` - Trigger CI tasks at job level instead of workflow level - Use one and only entry-point to define if pipeline succeed `ci-all-green` --- Example: https://github.com/probabl-ai/skore/actions/runs/11146672648 ![image](https://github.com/user-attachments/assets/294b9b89-0e86-43ae-a432-320d1ece016f)
- Loading branch information
1 parent
ca5f789
commit 9880d1e
Showing
5 changed files
with
121 additions
and
45 deletions.
There are no files selected for viewing
4 changes: 3 additions & 1 deletion
4
.github/workflows/pull-request.yml → .github/workflows/add-pr-assignee.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,75 @@ | ||
name: Backend | ||
name: Reusable backend workflow | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- 'src/**' | ||
- 'tests/**' | ||
- 'pyproject.toml' | ||
- 'Makefile' | ||
- 'requirements*.txt' | ||
- '.github/workflows/backend.yml' | ||
|
||
permissions: | ||
contents: read | ||
on: [workflow_call] | ||
|
||
jobs: | ||
lint-backend: | ||
build-frontend: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
python-version: '3.12' | ||
cache: 'pip' | ||
- name: Lint backend | ||
node-version: '20' | ||
cache: 'npm' | ||
cache-dependency-path: frontend/package-lock.json | ||
- shell: bash | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install --upgrade pre-commit | ||
cd frontend | ||
pre-commit run --all-files ruff | ||
npm install | ||
npm run build | ||
npm run build:lib -- --emptyOutDir false | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: frontend-package-distributions | ||
path: frontend/dist | ||
|
||
test-backend: | ||
runs-on: ubuntu-latest | ||
needs: build-frontend | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
python-version: ['3.11', '3.12'] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.12' | ||
python-version: ${{ matrix.python-version }} | ||
cache: 'pip' | ||
- name: Build frontend and share library | ||
shell: bash | ||
run: make build-frontend | ||
- name: Build package distributions | ||
|
||
- name: Lint | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install --upgrade pre-commit | ||
pre-commit run --all-files ruff | ||
- name: Download package distributions | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: frontend-package-distributions | ||
path: src/skore/ui/static | ||
|
||
- name: Build | ||
run: | | ||
python -m pip install --upgrade build | ||
python -m build | ||
- name: Install | ||
run: | | ||
python -m pip install dist/*.whl --no-dependencies | ||
python -m pip install -r requirements.txt -r requirements-test.txt | ||
- name: Pytest | ||
- name: Test | ||
timeout-minutes: 5 | ||
run: python -m pytest | ||
|
||
cleanup: | ||
runs-on: ubuntu-latest | ||
if: always() | ||
needs: test-backend | ||
steps: | ||
- uses: geekyeggo/delete-artifact@v5 | ||
with: | ||
name: frontend-package-distributions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: CI | ||
|
||
on: [pull_request] | ||
|
||
jobs: | ||
changes: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
backend: ${{ steps.filter.outputs.backend }} | ||
frontend: ${{ steps.filter.outputs.frontend }} | ||
permissions: | ||
pull-requests: read | ||
steps: | ||
- uses: dorny/paths-filter@v3 | ||
id: filter | ||
with: | ||
filters: | | ||
backend: | ||
- 'src/**' | ||
- 'tests/**' | ||
- 'pyproject.toml' | ||
- 'requirements*.txt' | ||
- '.github/workflows/backend.yml' | ||
frontend: | ||
- 'frontend/**' | ||
- '.github/workflows/frontend.yml' | ||
lint-all-files: | ||
uses: ./.github/workflows/lint.yml | ||
permissions: | ||
contents: read | ||
|
||
lint-and-test-backend: | ||
needs: [lint-all-files, changes] | ||
if: ${{ needs.changes.outputs.backend == 'true' }} | ||
uses: ./.github/workflows/backend.yml | ||
permissions: | ||
contents: read | ||
|
||
lint-and-test-frontend: | ||
needs: [lint-all-files, changes] | ||
if: ${{ needs.changes.outputs.frontend == 'true' }} | ||
uses: ./.github/workflows/frontend.yml | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
|
||
ci-all-green: | ||
needs: | ||
- lint-all-files | ||
- lint-and-test-backend | ||
- lint-and-test-frontend | ||
if: ${{ always() }} | ||
runs-on: Ubuntu-latest | ||
steps: | ||
- shell: bash | ||
run: | | ||
[[ ${{ contains(needs.*.result, 'failure') }} = false ]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters