Skip to content

Commit

Permalink
CI Refactor (#257)
Browse files Browse the repository at this point in the history
* ci refactor

* add coverage config

* cleanup

* cleanup

* cleanup

* try again

* try again

* remove min version check

* try to fix windows again

* try again

* try again

* flake

* debug

* debug

* fix pin

* update minimums

* bump min traitlets

* bump min nbconvert

* try again

* add skip

* use base setup dependency type
  • Loading branch information
blink1073 committed Nov 24, 2022
1 parent 765d229 commit afc608c
Show file tree
Hide file tree
Showing 21 changed files with 338 additions and 372 deletions.
39 changes: 0 additions & 39 deletions .circleci/config.yml

This file was deleted.

8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
# Set update schedule for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every weekday
interval: "weekly"
19 changes: 0 additions & 19 deletions .github/workflows/check-release.yml

This file was deleted.

146 changes: 101 additions & 45 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,29 @@ on:
push:
branches: ["main"]
pull_request:
schedule:
- cron: "0 8 * * *"

defaults:
run:
shell: bash -eux {0}

jobs:
pre_commit:
name: pre-commit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- uses: jupyterlab/maintainer-tools/.github/actions/pre-commit@v1

pre-commit:
name: Run pre-commit formatters and linters
test_docs:
name: Test Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- uses: pre-commit/[email protected]
- uses: actions/checkout@v3
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- run: hatch run docs:build

build:
name: Build, test and code coverage
Expand All @@ -25,57 +35,103 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [ '3.7', '3.8', '3.9', '3.10' ]
python-version: [ '3.7', '3.8', '3.9', '3.10', "3.11" ]
exclude:
- os: windows-latest
python-version: 3.8
- os: windows-latest
python-version: 3.9
env:
OS: ${{ matrix.os }}
PYTHON: '3.9'

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v3
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Run the tests
run: hatch run cov:test || hatch run test:test --lf

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Upload coverage to Codecov
run: |
pip install codecov coverage[toml]
codecov
- name: Install dependencies
run: |
pip install .[test]
pip install coverage
- name: Type check
run: mypy nbclient
test_minimum_versions:
name: Test Minimum Versions
timeout-minutes: 20
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
with:
dependency_type: minimum
- name: Run the unit tests
run: |
hatch run test:nowarn || hatch -v run test:nowarn --lf
- name: Run the tests
shell: bash
run: |
args="-vv --maxfail=2 --cov=nbclient --cov-report=xml -W always"
pytest $args || pytest $arg --lf
test_prereleases:
name: Test Prereleases
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
with:
dependency_type: pre
- name: Run the tests
run: |
hatch run test:nowarn || hatch run test:nowarn --lf
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
file: ./coverage.xml
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: false
make_sdist:
name: Make SDist
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- uses: jupyterlab/maintainer-tools/.github/actions/make-sdist@v1

- name: Build documentation
run: |
pip install .[sphinx]
cd docs
make html SPHINXOPTS="-W"
test_sdist:
runs-on: ubuntu-latest
needs: [make_sdist]
name: Install from SDist and Test
timeout-minutes: 20
steps:
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- uses: jupyterlab/maintainer-tools/.github/actions/test-sdist@v1
with:
package_spec: .
test_command: hatch run test:test || hatch run test:test --lf

check-links:
check_links:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- uses: jupyterlab/maintainer-tools/.github/actions/check-links@v1

check_release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Check Release
uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}

tests_check: # This job does nothing and is only used for the branch protection
if: always()
needs:
- build
- pre_commit
- test_docs
- test_minimum_versions
- test_prereleases
- check_links
- check_release
- test_sdist
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
43 changes: 32 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
ci:
autoupdate_schedule: monthly
autofix_prs: true
skip: [check-jsonschema]

repos:

Expand Down Expand Up @@ -39,24 +38,46 @@ repos:
files: \.py$
args: [--profile=black]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.990
hooks:
- id: mypy
additional_dependencies: [jupyter_client, jupyter_core, nbformat, nbconvert]

- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.10.1
hooks:
- id: validate-pyproject
stages: [manual]

- repo: https://github.com/executablebooks/mdformat
rev: 0.7.16
hooks:
- id: mdformat

- repo: https://github.com/asottile/pyupgrade
rev: v3.2.2
hooks:
- id: pyupgrade
args: [--py37-plus]

- repo: https://github.com/PyCQA/doc8
rev: v1.0.0
hooks:
- id: doc8
args: [--max-line-length=200]

- repo: https://github.com/pycqa/flake8
rev: 5.0.4

- repo: https://github.com/john-hen/Flake8-pyproject
rev: 1.1.0.post0
hooks:
- id: flake8
- id: Flake8-pyproject
alias: flake8
additional_dependencies:
["flake8-bugbear==22.6.22", "flake8-implicit-str-concat==0.2.0"]
stages: [manual]

- repo: https://github.com/sirosen/check-jsonschema
rev: 0.18.4
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.19.1
hooks:
- id: check-jsonschema
name: "Check GitHub Workflows"
files: ^\.github/workflows/
types: [yaml]
args: ["--schemafile", "https://json.schemastore.org/github-workflow"]
- id: check-github-workflows
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ python:
- method: pip
path: .
extra_requirements:
- sphinx
- docs
8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
### Merged PRs

- Fix tests for ipywidgets 8 [#246](https://github.com/jupyter/nbclient/pull/246) ([@frenzymadness](https://github.com/frenzymadness))
- [pre-commit.ci] pre-commit autoupdate [#236](https://github.com/jupyter/nbclient/pull/236) ([@pre-commit-ci](https://github.com/pre-commit-ci))
- \[pre-commit.ci\] pre-commit autoupdate [#236](https://github.com/jupyter/nbclient/pull/236) ([@pre-commit-ci](https://github.com/pre-commit-ci))

### Contributors to this release

Expand Down Expand Up @@ -131,7 +131,7 @@

### Merged PRs

- [pre-commit.ci] pre-commit autoupdate [#225](https://github.com/jupyter/nbclient/pull/225) ([@pre-commit-ci](https://github.com/pre-commit-ci))
- \[pre-commit.ci\] pre-commit autoupdate [#225](https://github.com/jupyter/nbclient/pull/225) ([@pre-commit-ci](https://github.com/pre-commit-ci))
- Add error_on_interrupt trait [#224](https://github.com/jupyter/nbclient/pull/224) ([@davidbrochart](https://github.com/davidbrochart))
- Fix typo [#223](https://github.com/jupyter/nbclient/pull/223) ([@davidbrochart](https://github.com/davidbrochart))
- Add on_cell_executed hook [#222](https://github.com/jupyter/nbclient/pull/222) ([@davidbrochart](https://github.com/davidbrochart))
Expand Down Expand Up @@ -197,7 +197,7 @@

### Merged PRs

- Pin ipython<8 in tests [#198](https://github.com/jupyter/nbclient/pull/198) ([@davidbrochart](https://github.com/davidbrochart))
- Pin ipython\<8 in tests [#198](https://github.com/jupyter/nbclient/pull/198) ([@davidbrochart](https://github.com/davidbrochart))
- Clear execution metadata, prefer msg header date when recording times [#195](https://github.com/jupyter/nbclient/pull/195) ([@kevin-bates](https://github.com/kevin-bates))
- Client hooks [#188](https://github.com/jupyter/nbclient/pull/188) ([@devintang3](https://github.com/devintang3))

Expand Down Expand Up @@ -331,7 +331,7 @@ If you were using these versions for the couple days they were up, move to 0.5.0

### Fixes

- Fix `OSError: [WinError 6] The handle is invalid` for windows/python<3.7 [#77](https://github.com/jupyter/nbclient/pull/77)
- Fix `OSError: [WinError 6] The handle is invalid` for windows/python\<3.7 [#77](https://github.com/jupyter/nbclient/pull/77)
- Async wapper Exceptions no longer loose their caused exception information [#65](https://github.com/jupyter/nbclient/pull/65)
- `extra_arguments` are now configurable by config settings [#66](https://github.com/jupyter/nbclient/pull/66)

Expand Down
43 changes: 0 additions & 43 deletions MANIFEST.in

This file was deleted.

Loading

0 comments on commit afc608c

Please sign in to comment.