-
Notifications
You must be signed in to change notification settings - Fork 8
114 lines (95 loc) · 4.14 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: CI
on:
push:
branches: ["main"]
pull_request:
schedule:
- cron: "0 0 * * *"
defaults:
run:
shell: bash -eux {0}
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
# This will be used by the base setup action
python-version: ["3.8", "3.11"]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Install dependencies
run: |
python -m pip install cookiecutter build jupyter_server
- name: Install Package
run: |
# Trick to use custom parameters
python -c "from cookiecutter.main import cookiecutter; import json; f=open('cookiecutter.json'); d=json.load(f); f.close(); d['author_name']='foo'; d['author_email']='[email protected]'; cookiecutter('.', extra_context=d, no_input=True)"
cd my_server_extension
cat pyproject.toml
pip install ".[test]"
- name: Test Installed Package
run: |
set -eux
jupyter server extension list
jupyter server extension list 2>&1 | grep -ie "my_server_extension.*OK"
pushd my_server_extension
python -m pytest
popd
pip uninstall -y my_server_extension
jupyter server extension list 2>&1 | grep -ie "my_server_extension.*OK" && exit 1
rm -rf my_server_extension
- name: Install Editable Package
run: |
# Trick to use custom parameters
python -c "from cookiecutter.main import cookiecutter; import json; f=open('cookiecutter.json'); d=json.load(f); f.close(); d['author_name']='foo'; d['author_email']='[email protected]'; cookiecutter('.', extra_context=d, no_input=True)"
cd my_server_extension
cat pyproject.toml
pip install -e .
# Pre-commit check in the extension dir
git init && git add .
pip install pre-commit
pre-commit run --all-files --hook-stage=manual || pre-commit run --all-files --hook-stage=manual
- name: Test Editable Install
run: |
jupyter server extension list
jupyter server extension list 2>&1 | grep -ie "my_server_extension.*OK"
pip uninstall -y my_server_extension
jupyter server extension list 2>&1 | grep -ie "my_server_extension.*OK" && exit 1
pip uninstall -y my_server_extension
rm -rf my_server_extension
- name: Build and Install from Sdist
run: |
# Trick to use custom parameters
python -c "from cookiecutter.main import cookiecutter; import json; f=open('cookiecutter.json'); d=json.load(f); f.close(); d['author_name']='foo'; d['author_email']='[email protected]'; cookiecutter('.', extra_context=d, no_input=True)"
cd my_server_extension
python -m build --sdist .
pip install dist/*.tar.gz
# Copy the sdist so we can upload it
cp dist/*.tar.gz ../my_server_extension.tar.gz
- name: Test Sdist Install
run: |
jupyter server extension list
jupyter server extension list 2>&1 | grep -ie "my_server_extension.*OK"
pip uninstall -y my_server_extension
jupyter server extension list 2>&1 | grep -ie "my_server_extension.*OK" && exit 1
pip uninstall -y my_server_extension
rm -rf my_server_extension
- name: Run the linters
run: |
# Trick to use custom parameters
python -c "from cookiecutter.main import cookiecutter; import json; f=open('cookiecutter.json'); d=json.load(f); f.close(); d['author_name']='foo'; d['author_email']='[email protected]'; cookiecutter('.', extra_context=d, no_input=True)"
cd my_server_extension
bash ./.github/workflows/lint.sh
cd ..
pip uninstall -y my_server_extension
rm -rf my_server_extension
- uses: actions/upload-artifact@v2
if: startsWith(runner.os, 'Linux')
with:
name: my_server_extension-sdist
path: my_server_extension.tar.gz