Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Add mypy #1194

Draft
wants to merge 21 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .git_archival.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node: $Format:%H$
node-date: $Format:%cI$
describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$
ref-names: $Format:%D$
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
World\ population.ipynb linguist-documentation
.git_archival.txt export-subst
5 changes: 1 addition & 4 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
codecov:
notify:
after_n_builds: 16

comment:
after_n_builds: 16
wait_for_ci: true

coverage:
status:
Expand Down
39 changes: 24 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,16 @@ on:
push:
paths-ignore:
- "CHANGELOG.md"
branches: [main]
branches: [ main ]
pull_request:
branches: [main]
branches: [ main ]
schedule:
- cron: "0 11 * * 4"

permissions:
# All nested workflows will inherit these permissions and so no need to declare
# in each step file
contents: read
# Cannot use it in codeql nested workflow without declaring it on
# top level workflow
# Ref: https://docs.github.com/en/actions/using-workflows/reusing-workflows#access-and-permissions
security-events: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -33,28 +29,41 @@ jobs:
pre-commit:
uses: ./.github/workflows/step_pre-commit.yml

codeql:
needs: [pre-commit]
static-analysis:
needs: [ pre-commit ]
uses: ./.github/workflows/step_static-analysis.yml
permissions:
contents: read
security-events: write

test-pip:
needs: [codeql]
needs: [ pre-commit ]
uses: ./.github/workflows/step_tests-pip.yml

test-unit-functional-integration:
needs: [codeql]
uses: ./.github/workflows/step_test_unit_functional.yml
coverage:
needs: [ test-pip ]
uses: ./.github/workflows/step_coverage.yml

test-conda:
needs: [codeql]
needs: [ test-pip ]
uses: ./.github/workflows/step_tests-conda.yml

test-ui:
needs: [codeql]
needs: [ test-pip ]
uses: ./.github/workflows/step_tests-ui.yml

build:
needs: [test-pip, test-conda, test-unit-functional-integration, test-ui]
needs: [ test-pip, test-conda, test-ui ]
uses: ./.github/workflows/step_build.yml
with:
upload: ${{ inputs.upload-build-artifacts || false }}

pass:
name: Pass
needs: [ pre-commit, static-analysis, test-pip, coverage, test-conda, test-ui, build ]
runs-on: ubuntu-latest
steps:
- uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
if: always()
2 changes: 1 addition & 1 deletion .github/workflows/comment-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
name: Comment PR
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Comment PR
uses: thollander/actions-comment-pull-request@v2
Expand Down
61 changes: 0 additions & 61 deletions .github/workflows/publish.yml

This file was deleted.

92 changes: 92 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+dev[0-9]+"
workflow_dispatch:
inputs:
skip-tests:
type: boolean
description: Skip
default: false
ref:
type: string
description: Tag to release
required: true

permissions:
contents: read

jobs:
pre-commit:
uses: ./.github/workflows/step_pre-commit.yml
if: "! inputs.skip-tests"

test-pip:
needs: [ pre-commit ]
uses: ./.github/workflows/step_tests-pip.yml
if: "! inputs.skip-tests"

test-conda:
needs: [ test-pip ]
uses: ./.github/workflows/step_tests-conda.yml
if: "! inputs.skip-tests"

test-ui:
needs: [ test-pip ]
uses: ./.github/workflows/step_tests-ui.yml
if: "! inputs.skip-tests"

test-status:
needs: [ pre-commit, test-pip, test-conda, test-ui ]
runs-on: ubuntu-latest
steps:
- uses: re-actors/alls-green@release/v1
with:
allowed-skips: pre-commit, test-pip, test-conda, test-ui
jobs: ${{ toJSON(needs) }}
if: always()

build:
needs: [ test-status ]
uses: ./.github/workflows/step_build.yml
with:
upload: true
ref: ${{ inputs.ref }}

publish:
needs: [ build ]
runs-on: ubuntu-latest

environment:
name: pypi
url: https://pypi.org/p/jupytext

permissions:
contents: read
id-token: write

steps:
- uses: actions/download-artifact@v3
with:
name: dist
path: dist
- name: Publish
uses: pypa/gh-action-pypi-publish@release/v1

release:
needs: [ publish ]
name: Create release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- uses: softprops/action-gh-release@v1
with:
name: Jupytext ${{ inputs.ref || github.ref_name }}
draft: true
prerelease: ${{ contains(inputs.ref || github.ref, 'rc') }}
generate_release_notes: true
41 changes: 12 additions & 29 deletions .github/workflows/step_build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: build
run-name: Build test
run-name: Build package

on:
workflow_call:
Expand All @@ -9,46 +9,29 @@ on:
required: false
default: false
description: Upload build artifacts
ref:
type: string
description: Tag to build

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-build
cancel-in-progress: true
permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}

- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
with:
python_version: "3.x"

- name: Build package
run: |
python -m pip install build wheel

# NOTE: These builds and verifications of the builds can be done more
# robustly with jupyter-releaser.
#
# Removed the check on size of package as we are distributing tests/ with
# sdist now and they are around 8MB. Seems like original check was to make
# sure we are not distributing node_modules and we are quite safe with that
# with hatch build system.
#
# Build jupytext package
python -m build

# Build lab extension(s)
npm pack --pack-destination dist jupyterlab/packages/*

# Check that the lab is there
if (($(tar -tf dist/*.tar.gz | grep jupyterlab/jupyterlab_jupytext/labextension/package.json$ | wc -l)==0)); then echo "Missing jupyterlab_jupytext" && exit 1; fi

# Install package and extension
python -m pip install dist/*.tar.gz

echo "Install went OK"
run: hatch build

- name: Archive build artifacts
uses: actions/upload-artifact@v3
Expand Down
Original file line number Diff line number Diff line change
@@ -1,41 +1,40 @@
name: test-categories
run-name: Run Unit/Functional/Integration and External tests using Pip
name: coverage
run-name: Check coverage

on:
workflow_call:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-test_classification
cancel-in-progress: true
permissions:
contents: read

jobs:
test-pip:
continue-on-error: ${{ matrix.experimental || false }}
coverage:
name: >
${{ matrix.coverage }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
python-version: [ "3.11" ]
coverage: [unit, functional, integration, external]

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
with:
python_version: ${{ matrix.python-version }}
python_version: 3.x

- name: Install from source
run: HATCH_BUILD_HOOKS_ENABLE=false python -m pip install -e '.[test-cov,test-${{ matrix.coverage }}]' markdown-it-py~=3.0
run: HATCH_BUILD_HOOKS_ENABLE=false python -m pip install -e '.[test-cov,test-${{ matrix.coverage }}]'

- name: Install a Jupyter Kernel
run: python -m ipykernel install --name python_kernel --user

- name: Run the tests
run: pytest tests/${{ matrix.coverage }} --cov
run: pytest tests/${{ matrix.coverage }} -n logical --cov --cov-report=xml

- name: Upload the coverage
uses: codecov/codecov-action@v3
Expand Down
Loading
Loading