Skip to content

Commit

Permalink
Merge pull request #31 from ftorradeflot/feature_test_env
Browse files Browse the repository at this point in the history
Feature test environment
  • Loading branch information
ftorradeflot committed Feb 29, 2024
2 parents 6421814 + f4e0a00 commit dc1395d
Show file tree
Hide file tree
Showing 25 changed files with 507 additions and 160 deletions.
10 changes: 10 additions & 0 deletions .github/actions/build-ext/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: "Build"
runs:
using: "composite"
steps:
- name: Build the extension
run: |
set -eux
python -m pip install .
shell: bash

25 changes: 25 additions & 0 deletions .github/actions/post-test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "Post Test"
runs:
using: "composite"
steps:
- name: Install check-manifest
run: python -m pip install -U check-manifest
shell: bash
- name: Install Node (for Playwright)
uses: actions/setup-node@v1
with:
node-version: '16.x'
- name: Install Playwright
run: npx playwright install
shell: bash
- name: extension checks
run: |
jupyter server extension list 2>&1 | grep -ie "rucio_jupyterlab.*OK"
jupyter labextension list 2>&1 | grep -ie "rucio-jupyterlab.*OK"
shell: bash
- name: Browser check
run: python -m jupyterlab.browser_check
shell: bash
- name: Check Manifest.in
run: check-manifest -v
shell: bash
40 changes: 40 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: "Setup"
runs:
using: "composite"
steps:
- name: Install node
uses: actions/setup-node@v1
with:
node-version: '14.x'
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
architecture: 'x64'
- name: Setup pip cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: pip-3.9-${{ hashFiles('package.json') }}
restore-keys: |
pip-3.9-
pip-
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
shell: bash
- name: Setup yarn cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
yarn-
- name: Install Python dependencies
run: python -m pip install -r requirements.txt
shell: bash
- name: Install JS dependencies
run: jlpm
shell: bash

16 changes: 16 additions & 0 deletions .github/actions/test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: "Test"
runs:
using: "composite"
steps:
- name: Run ESLint
run: jlpm run eslint:check
shell: bash
- name: Run Jest
run: jlpm jest
shell: bash
- name: Run Pytest
run: pytest rucio_jupyterlab/tests/
shell: bash
- name: Run Pylint
run: pylint --fail-under=8.5 rucio_jupyterlab/
shell: bash
60 changes: 6 additions & 54 deletions .github/workflows/build-and-publish-tagged.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,61 +9,13 @@ jobs:
name: Build and Publish to PyPI
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Install node
uses: actions/setup-node@v1
with:
node-version: '14.x'
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
architecture: 'x64'
- name: Setup pip cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: pip-3.8-${{ hashFiles('package.json') }}
restore-keys: |
pip-3.8-
pip-
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Setup yarn cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
yarn-
- name: Install Python dependencies
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- uses: ./.github/actions/test
- uses: ./.github/actions/build-ext
- uses: ./.github/actions/post-test
- name: Build sdist
run: |
python -m pip install -U jupyterlab~=3.1 check-manifest
python -m pip install -r requirements.txt
- name: Install JS dependencies
run: jlpm
- name: Run ESLint
run: jlpm run eslint:check
- name: Run Jest
run: jlpm jest
- name: Run Pytest
run: pytest rucio_jupyterlab/tests/
- name: Run Pylint
run: pylint --fail-under=8.5 rucio_jupyterlab/
- name: Build the extension
run: |
set -eux
python -m pip install .
jupyter server extension list 2>&1 | grep -ie "rucio_jupyterlab.*OK"
jupyter labextension list 2>&1 | grep -ie "rucio-jupyterlab.*OK"
python -m pip uninstall jupyter_server_terminals
python -m jupyterlab.browser_check
check-manifest -v
pip install build
python -m build --sdist
- name: Publish distribution to PyPI
Expand Down
63 changes: 5 additions & 58 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,62 +11,9 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Install node
uses: actions/setup-node@v1
with:
node-version: '14.x'
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
architecture: 'x64'
- name: Setup pip cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: pip-3.8-${{ hashFiles('package.json') }}
restore-keys: |
pip-3.8-
pip-
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Setup yarn cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
yarn-
- name: Install Python dependencies
run: |
python -m pip install -U jupyterlab~=3.1 check-manifest
python -m pip install -r requirements.txt
- name: Install JS dependencies
run: jlpm
- name: Run ESLint
run: jlpm run eslint:check
- name: Run Jest
run: jlpm jest
- name: Run Pytest
run: pytest rucio_jupyterlab/tests/
- name: Run Pylint
run: pylint --fail-under=8.5 rucio_jupyterlab/
- name: Install Node (for Playwright)
uses: actions/setup-node@v1
with:
node-version: '16.x'
- name: Install Playwright
run: npx playwright install
- name: Build the extension
run: |
set -eux
python -m pip install .
jupyter server extension list 2>&1 | grep -ie "rucio_jupyterlab.*OK"
jupyter labextension list 2>&1 | grep -ie "rucio-jupyterlab.*OK"
python -m jupyterlab.browser_check
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- uses: ./.github/actions/test
- uses: ./.github/actions/build-ext
- uses: ./.github/actions/post-test

check-manifest -v
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "rucio"]
path = docker/test_env/rucio
url = git@github.com:rucio/rucio.git
[submodule "docker/test_env/rucio"]
path = docker/test_env/rucio
url = https://github.com/rucio/rucio.git
36 changes: 0 additions & 36 deletions Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ global-exclude .git
global-exclude .ipynb_checkpoints

exclude Dockerfile
exclude docker/*
recursive-exclude docker *
exclude jest.config.js
exclude requirements.txt
exclude rucio_jupyterlab/tests/*
Expand Down
4 changes: 0 additions & 4 deletions docker/configure.sh

This file was deleted.

40 changes: 40 additions & 0 deletions docker/container/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
FROM jupyter/docker-stacks-foundation:python-3.9
LABEL maintainer="Muhammad Aditya Hilmy <mhilmy@hey.com>, Francesc Torradeflot <torradeflot@pic.es>"

ENV CONTAINER_PURPOSE="test"
ARG NB_USER="jovyan"
ARG NB_UID="1000"
ARG NB_GID="100"

USER $NB_UID

RUN mamba install -y -n base -c conda-forge \
python-gfal2 \
nodejs=14 \
pip \
&& mamba clean --all -f -y

USER root

COPY . /rucio-jupyterlab
WORKDIR /rucio-jupyterlab

RUN fix-permissions /rucio-jupyterlab \
&& sed -i -e 's/\r$/\n/' /rucio-jupyterlab/docker/container/configure.sh

COPY docker/container/jupyter_server_config.py $HOME/.jupyter/jupyter_server_config.py
RUN fix-permissions $HOME/.jupyter
RUN mkdir -p /opt/rucio/etc \
&& chown -R ${NB_UID}:${NB_GID} /opt/rucio/etc

USER $NB_UID

RUN /rucio-jupyterlab/docker/container/install_extension.sh

ENV JUPYTER_ENABLE_LAB=yes

WORKDIR $HOME
ENTRYPOINT ["/rucio-jupyterlab/docker/container/docker-entrypoint.sh"]
CMD ["/rucio-jupyterlab/docker/container/configure.sh", "/rucio-jupyterlab/docker/container/start_notebook.sh"]

USER ${NB_UID}
43 changes: 43 additions & 0 deletions docker/container/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Rucio jupyterlab extension docker image

## Building the image

### Base image: jupyter/docker-stacks-foundation

We rely on the `docker-stacks-foundation` image from the
[Jupyter Docker Stacks repository](https://github.com/jupyter/docker-stacks/tree/main).

It is an image containing a minimal conda/mamba environment, we want to use this image to make
sure the extension works in a "clean" environment.

### Building a custom base image

In our case we want to set the python version to 3.9, and there's no image publicly available with this version.

So we clone the [Jupyter Docker Stacks repository](https://github.com/jupyter/docker-stacks/tree/main)

git clone git@github.com:jupyter/docker-stacks.git jupyter-docker-stacks
cd jupyter-docker-stacks/images/docker-stacks-foundation/

Tune the Dockerfile to install python=3.9, and build/tag the image that will be used as the basis
for our `rucio-jupyterlab` image.

docker build . -t jupyter/docker-stacks-foundation:python-3.9

### Building the `rucio-jupyterlab` docker image

From the root folder of the project, run

docker build . -t rucio-jupyterlab -f docker/container/Dockerfile

## Using the image

### Standalone

Check the instructions in [the main README](../../README.md) to see how to use the image
standalone, that is without the rest of the Rucio development environment

### Inside Rucio's development environment

Check the instructions on [how to use the test environment](../test_env/README.md) to
see how to use this image together with the Rucio development environment.
Loading

0 comments on commit dc1395d

Please sign in to comment.