Skip to content

Commit

Permalink
Try to be smarter
Browse files Browse the repository at this point in the history
  • Loading branch information
fcollonval committed Aug 20, 2023
1 parent 05aa8a6 commit c7de99d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
34 changes: 15 additions & 19 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ jobs:
set -eux
tmpfolder=$(mktemp -d)
python -m copier copy -l -d author_name="My Name" -d labextension_name="${NAME}" -d python_name="${PYNAME}" -d repository="https://github.com/test/lab-extension" -d venv="none" --vcs-ref HEAD --UNSAFE . $tmpfolder
YARN_ENABLE_IMMUTABLE_INSTALLS=false python -m copier copy -l -d author_name="My Name" -d labextension_name="${NAME}" -d python_name="${PYNAME}" -d repository="https://github.com/test/lab-extension" -d venv="none" --vcs-ref HEAD --UNSAFE . $tmpfolder
pushd $tmpfolder
YARN_ENABLE_IMMUTABLE_INSTALLS=false python bootstrap.py
./scripts/pre-commit
jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "${NAME}.*OK"
Expand Down Expand Up @@ -88,9 +88,9 @@ jobs:
set -eux
tmpfolder=$(mktemp -d)
python -m copier copy -l -d author_name="My Name" -d test=n -d repository="https://github.com/test/lab-extension" -d venv="none" --vcs-ref HEAD --UNSAFE . myextension
YARN_ENABLE_IMMUTABLE_INSTALLS=false python -m copier copy -l -d author_name="My Name" -d test=n -d repository="https://github.com/test/lab-extension" -d venv="none" --vcs-ref HEAD --UNSAFE . $tmpfolder
pushd $tmpfolder
YARN_ENABLE_IMMUTABLE_INSTALLS=false python bootstrap.py
./scripts/pre-commit
jupyter labextension list
Expand Down Expand Up @@ -131,9 +131,9 @@ jobs:
set -eux
tmpfolder=$(mktemp -d)
python -m copier copy -l -d author_name="My Name" -d has_settings=y -d repository="https://github.com/test/lab-extension" -d venv="none" --vcs-ref HEAD --UNSAFE . $tmpfolder
YARN_ENABLE_IMMUTABLE_INSTALLS=false python -m copier copy -l -d author_name="My Name" -d has_settings=y -d repository="https://github.com/test/lab-extension" -d venv="none" --vcs-ref HEAD --UNSAFE . $tmpfolder
pushd $tmpfolder
YARN_ENABLE_IMMUTABLE_INSTALLS=false python bootstrap.py
# It is not easily possible to get this version compatible with linter rules
jlpm lint
./scripts/pre-commit
Expand Down Expand Up @@ -175,14 +175,14 @@ jobs:
- name: Create server extension pip install
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: false
COPIER_SKIP_INSTALL_TASK: '1'
run: |
tmpfolder=$(mktemp -d)
python -m copier copy -l -d kind=server -d author_name="My Name" -d repository="https://github.com/test/lab-extension" -d venv="none" --vcs-ref HEAD --UNSAFE . $tmpfolder
cd $tmpfolder
cat pyproject.toml
pip install .
YARN_ENABLE_IMMUTABLE_INSTALLS=false pip install .
pip install "jupyterlab>=4.0.0,<5"
- name: Check pip install method
Expand All @@ -201,14 +201,11 @@ jobs:
shell: bash

- name: Create server extension pip develop
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: false
run: |
tmpfolder=$(mktemp -d)
python -m copier copy -l -d kind=server -d author_name="My Name" -d repository="https://github.com/test/lab-extension" -d venv="none" --vcs-ref HEAD --UNSAFE . $tmpfolder
YARN_ENABLE_IMMUTABLE_INSTALLS=false python -m copier copy -l -d kind=server -d author_name="My Name" -d repository="https://github.com/test/lab-extension" -d venv="none" --vcs-ref HEAD --UNSAFE . $tmpfolder
cd $tmpfolder
python bootstrap.py
# Check unit tests are passing
python -m pytest -vv -r ap --cov myextension
Expand Down Expand Up @@ -245,15 +242,15 @@ jobs:
- name: Install server extension from a tarball
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: false
COPIER_SKIP_INSTALL_TASK: '1'
run: |
tmpfolder=$(mktemp -d)
python -m copier copy -l -d kind=server -d author_name="My Name" -d repository="https://github.com/test/lab-extension" -d venv="none" --vcs-ref HEAD --UNSAFE . $tmpfolder
cd $tmpfolder
python -m pip install "jupyterlab>=4.0.0,<5"
jupyter lab clean --all
python -m build $tmpfolder
YARN_ENABLE_IMMUTABLE_INSTALLS=false python -m build $tmpfolder
cd dist
python -m pip install myextension-0.1.0.tar.gz
Expand Down Expand Up @@ -350,9 +347,8 @@ jobs:
run: |
set -eux
mkdir mytheme
python -m copier copy -l -d kind=theme -d author_name="My Name" -d repository="https://github.com/test/lab-extension" -d venv="none" --vcs-ref HEAD --UNSAFE . mytheme
YARN_ENABLE_IMMUTABLE_INSTALLS=false python -m copier copy -l -d kind=theme -d author_name="My Name" -d repository="https://github.com/test/lab-extension" -d venv="none" --vcs-ref HEAD --UNSAFE . mytheme
pushd mytheme
YARN_ENABLE_IMMUTABLE_INSTALLS=false python bootstrap.py
./scripts/pre-commit
jupyter labextension list
Expand Down Expand Up @@ -393,9 +389,8 @@ jobs:
set -eux
tmpfolder=$(mktemp -d)
python -m copier copy -l -d kind=mimerenderer -d viewer_name="My Viewer" -d mimetype="application/vnd.my_org.my_type" -d mimetype_name="my_type" -d file_extension=".my_type" -d author_name="My Name" -d repository="https://github.com/test/lab-extension" -d venv="none" --vcs-ref HEAD --UNSAFE . $tmpfolder
YARN_ENABLE_IMMUTABLE_INSTALLS=false python -m copier copy -l -d kind=mimerenderer -d viewer_name="My Viewer" -d mimetype="application/vnd.my_org.my_type" -d mimetype_name="my_type" -d file_extension=".my_type" -d author_name="My Name" -d repository="https://github.com/test/lab-extension" -d venv="none" --vcs-ref HEAD --UNSAFE . $tmpfolder
pushd $tmpfolder
YARN_ENABLE_IMMUTABLE_INSTALLS=false python bootstrap.py
./scripts/pre-commit
Expand Down Expand Up @@ -436,7 +431,7 @@ jobs:
run: |
tmpfolder=$(mktemp -d)
python -m copier copy -l -d kind=server -d author_name="My Name" -d repository="https://github.com/test/lab-extension" --vcs-ref HEAD --UNSAFE . $tmpfolder
YARN_ENABLE_IMMUTABLE_INSTALLS=false python -m copier copy -l -d kind=server -d author_name="My Name" -d repository="https://github.com/test/lab-extension" --vcs-ref HEAD --UNSAFE . $tmpfolder
- name: Check conda environment
shell: bash -el {0}
Expand Down Expand Up @@ -480,6 +475,7 @@ jobs:
- name: Create pure frontend extension
env:
KIND: ${{ matrix.kind }}
COPIER_SKIP_INSTALL_TASK: '1'
run: |
set -eux
tmpfolder=$(mktemp -d)
Expand Down
4 changes: 4 additions & 0 deletions template/bootstrap.py.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ def install_extension():
if not answer.lower().startswith('y'):
return
{% endif %}
if os.environ("COPIER_SKIP_INSTALL_TASK", "0") != "0":
print("Skipping installation task")
return

print("\nInstalling the extension in development mode...")

# Force uninstalling the extension to avoid trouble when installing in dev mode
Expand Down

0 comments on commit c7de99d

Please sign in to comment.