diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 000000000..c05b5fe93 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +/.github/ @thomass-dev @rouk1 @augustebaum diff --git a/.github/workflows/backend.yml b/.github/workflows/backend.yml index 8201a3aa7..8f177dac4 100644 --- a/.github/workflows/backend.yml +++ b/.github/workflows/backend.yml @@ -1,68 +1,83 @@ -name: Reusable skore workflow +# THIS +# IS +# DOCUMENTATION +# REUSABLE WORKFLOW + +name: backend on: [workflow_call] defaults: run: shell: "bash" - working-directory: "./skore" jobs: - test-skore: + lint-backend: + runs-on: "ubuntu-latest" + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + cache: pip + + - name: Install dependencies + run: python -m pip install --upgrade pip pre-commit + + - name: Lint + working-directory: skore/ + run: pre-commit run --all-files ruff + + test-backend: strategy: fail-fast: true matrix: os: ["ubuntu-latest", "windows-latest"] - python-version: ["3.9", "3.10", "3.11", "3.12"] + python: ["3.9", "3.10", "3.11", "3.12"] + coverage: [false] + include: + - os: "ubuntu-latest" + python: "3.12" + coverage: true runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - cache: "pip" - - name: - timeout-minutes: 10 - run: | - # Install dependencies - python -m pip install --upgrade pip - python -m pip install --upgrade pre-commit - python -m pip install --upgrade build + - name: Checkout code + uses: actions/checkout@v4 - # Lint - pre-commit run --all-files ruff + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python }} + cache: pip - # Build - python -m build + - name: Install dependencies + run: python -m pip install --upgrade pip build - # Install - wheel=(dist/*.whl); python -m pip install "${wheel}[test]" + - name: Build + working-directory: skore/ + run: python -m build - # Test - python -m pytest --no-cov src/ tests/ -n auto + - name: Install + working-directory: skore/ + run: wheel=(dist/*.whl); python -m pip install "${wheel}[test]" - coverage-skore: - runs-on: ubuntu-latest - if: ${{ github.event_name == 'pull_request' }} - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: 3.12 - cache: "pip" - - name: pytest coverage + - name: Test with/without coverage + timeout-minutes: 10 + working-directory: skore/ run: | - # Install dependencies - python -m pip install --upgrade pip - python -m pip install --upgrade pre-commit - python -m pip install --upgrade build - python -m pip install -e .[test] + if [ ${{ matrix.coverage }} = false ] ; then + python -m pytest -n auto --no-cov src/ tests/ + else + mkdir coverage + python -m pytest -n auto --junitxml=coverage/coverage.xml --cov=skore src/ tests/ | tee coverage/coverage.txt + fi - # run coverage - python -m pytest -n auto --junitxml=coverage.xml --cov=skore src/ tests/ | tee pytest-coverage.txt - - name: Pytest coverage comment - uses: MishaKav/pytest-coverage-comment@main + - name: Upload coverage reports + if: matrix.coverage == 'true' + uses: actions/upload-artifact@v4 with: - pytest-coverage-path: ./skore/pytest-coverage.txt - junitxml-path: ./skore/coverage.xml - title: pytest coverage report + name: backend-coverage + path: skore/coverage/ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e3db1d26d..129c39dc2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,3 +1,7 @@ +# THIS +# IS +# DOCUMENTATION + name: CI on: @@ -10,6 +14,8 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +permissions: {} + jobs: changes: runs-on: ubuntu-latest @@ -29,39 +35,37 @@ jobs: - 'skore/tests/**' - 'skore/pyproject.toml' - 'skore/requirements*.txt' - - '.github/workflows/skore.yml' + - '.github/workflows/backend.yml' skore-ui: - 'skore-ui/**' - - '.github/workflows/skore-ui.yml' + - '.github/workflows/frontend.yml' lint-all-files: uses: ./.github/workflows/lint.yml permissions: contents: read - lint-and-test-skore: + lint-and-test-backend: 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 + if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'pull_request' && needs.changes.outputs.skore == 'true') + uses: ./.github/workflows/backend.yml permissions: contents: read - pull-requests: write - lint-and-test-skore-ui: + lint-and-test-frontend: needs: [lint-all-files, changes] - if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'pull_request' && needs.changes.outputs.skore-ui == 'true') }} - uses: ./.github/workflows/skore-ui.yml + if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'pull_request' && needs.changes.outputs.skore-ui == 'true') + uses: ./.github/workflows/frontend.yml permissions: contents: read - pull-requests: write ci-all-green: needs: - changes - lint-all-files - - lint-and-test-skore - - lint-and-test-skore-ui - if: ${{ always() }} + - lint-and-test-backend + - lint-and-test-frontend + if: always() runs-on: Ubuntu-latest steps: - shell: bash diff --git a/.github/workflows/skore-ui.yml b/.github/workflows/frontend.yml similarity index 50% rename from .github/workflows/skore-ui.yml rename to .github/workflows/frontend.yml index 6f1b63876..8032d490f 100644 --- a/.github/workflows/skore-ui.yml +++ b/.github/workflows/frontend.yml @@ -1,23 +1,32 @@ -name: Reusable skore-ui workflow +# THIS +# IS +# DOCUMENTATION +# REUSABLE WORKFLOW + +name: frontend on: [workflow_call] defaults: run: shell: 'bash' - working-directory: './skore-ui' jobs: - lint-skore-ui: + lint-frontend: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 with: node-version: '20' cache: 'npm' cache-dependency-path: skore-ui/package-lock.json - - name: Lint skore-ui + + - name: Lint + working-directory: skore-ui/ run: | npm install npm run type-check @@ -25,38 +34,46 @@ jobs: npm run format npm run style-lint - test-skore-ui: + test-frontend: runs-on: ubuntu-latest - needs: lint-skore-ui steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 with: node-version: '20' cache: 'npm' cache-dependency-path: skore-ui/package-lock.json - - name: Test skore-ui + + - name: Test with coverage + working-directory: skore-ui/ run: | npm install npm run test:unit:coverage - - name: Report coverage - if: always() - uses: davelosert/vitest-coverage-report-action@v2 + + - name: Upload coverage reports + uses: actions/upload-artifact@v4 with: - working-directory: ./skore-ui - pr-number: ${{ github.event.number }} + name: frontend-coverage + path: skore-ui/coverage/ - build-skore-ui: + build-frontend: runs-on: ubuntu-latest - needs: test-skore-ui steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 with: node-version: '20' cache: 'npm' cache-dependency-path: skore-ui/package-lock.json - - name: Build skore-ui + + - name: Build + working-directory: skore-ui/ run: | npm install npm run build diff --git a/.github/workflows/add-pr-assignee.yml b/.github/workflows/pr-add-assignee.yml similarity index 97% rename from .github/workflows/add-pr-assignee.yml rename to .github/workflows/pr-add-assignee.yml index 6a78b0c45..562f5bb81 100644 --- a/.github/workflows/add-pr-assignee.yml +++ b/.github/workflows/pr-add-assignee.yml @@ -4,6 +4,8 @@ on: pull_request_target: types: [opened] +permissions: {} + jobs: add-pr-assignee: runs-on: ubuntu-latest diff --git a/.github/workflows/lint-pr-title.yml b/.github/workflows/pr-lint-title.yml similarity index 100% rename from .github/workflows/lint-pr-title.yml rename to .github/workflows/pr-lint-title.yml