Skip to content

Commit

Permalink
Create CI workflow to test skore on all versions of python >=3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
thomass-dev committed Sep 27, 2024
1 parent 0cf8b93 commit 267fe0c
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 33 deletions.
68 changes: 51 additions & 17 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,48 +5,82 @@ on:
paths:
- 'src/**'
- 'tests/**'
- pyproject.toml
- Makefile
- requirements*.txt
- .github/workflows/backend.yml
- 'pyproject.toml'
- 'requirements*.txt'
- '.github/workflows/backend.yml'

permissions:
contents: read

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"
- 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
continue-on-error: ${{ matrix.python-version != '3.12' }}
strategy:
fail-fast: true
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Build frontend and share library
shell: bash
run: make build-frontend
- name: Build package distributions
python-version: ${{ matrix.python-version }}
cache: 'pip'

- 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
23 changes: 17 additions & 6 deletions .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ on:
pull_request:
paths:
- 'frontend/**'
- Makefile
- .github/workflows/frontend.yml
- '.github/workflows/frontend.yml'

permissions:
contents: read
Expand All @@ -18,7 +17,9 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
node-version: 20
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Lint frontend
run: |
cd frontend
Expand All @@ -35,10 +36,13 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
node-version: 20
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Test frontend
run: |
cd frontend
npm install
npm run test:unit:coverage
- name: Report coverage
Expand All @@ -55,7 +59,14 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
node-version: 20
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Build frontend
shell: bash
run: make build-frontend
run: |
cd frontend
npm install
npm run build
npm run build:lib -- --emptyOutDir false
21 changes: 11 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@ serve-ui:
--timeout-graceful-shutdown 0

build-frontend:
# build the SPA
cd frontend && npm install
cd frontend && npm run build
# empty app static folder
rm -rf src/skore/ui/static
cp -a frontend/dist/. src/skore/ui/static
# build the sharing library
cd frontend && npm run build:lib
cp -a frontend/dist/. src/skore/ui/static
# clean up
# cleanup
rm -rf frontend/dist
rm -rf src/skore/ui/static
# build
(\
cd frontend;\
npm install;\
npm run build;\
npm run build:lib -- --emptyOutDir false;\
)
# move
mv frontend/dist/ src/skore/ui/static

0 comments on commit 267fe0c

Please sign in to comment.