|
1 |
| -# plotly/julia:ci |
| 1 | +# Docker image for running integration tests |
2 | 2 |
|
3 |
| -#### This Dockerfile is currently used to support integration and unit tests for [Dash.jl](https://github.com/plotly/Dash.jl). |
| 3 | +As CircleCI does not have Julia [Orbs](https://circleci.com/orbs/) yet, we rely |
| 4 | +on a custom docker image to have access to Python, headless Chrome and Julia |
| 5 | +in the same container. |
4 | 6 |
|
5 |
| -## Usage |
| 7 | +Since <https://github.com/plotly/Dash.jl/pull/207>, we tag the build images |
| 8 | +as [`etpinard/dashjl-tests`](https://hub.docker.com/r/etpinard/dashjl-tests). We |
| 9 | +previously used the [`plotly/julia:ci`](https://hub.docker.com/r/plotly/julia/tags) image. |
6 | 10 |
|
7 |
| -This image is pulled from within Dash.jl's [config.yml](https://github.com/plotly/Dash.jl/blob/dev/.circleci/config.yml): |
| 11 | +## When should we update the docker image? |
| 12 | + |
| 13 | +The integration tests rely on the Python version of [dash](https://github.com/plotly/dash) |
| 14 | +and its [testing framework](https://github.com/plotly/dash/tree/dev/dash/testing). |
| 15 | + |
| 16 | +So, we should use the latest CircleCI python + browsers image latest Python version |
| 17 | +that is included in the [dash CircleCI config](https://github.com/plotly/dash/blob/dev/.circleci/config.yml) |
| 18 | +as our base image. |
| 19 | + |
| 20 | +We should also update the Julia version from time to time. It might be nice to |
| 21 | +run the integration tests on multiple Julia versions eventually. |
| 22 | + |
| 23 | +## How to update the docker image? |
| 24 | + |
| 25 | +Ask for push rights on docker hub first, then |
| 26 | + |
| 27 | +```sh |
| 28 | +cd Dash.jl/build |
| 29 | +docker build -t etpinard:dashjl-tests:<x.y.z> . |
| 30 | +docker push etpinard:dashjl-test:<x.y.z> |
| 31 | +``` |
| 32 | + |
| 33 | +where `<x.y.z>` is the semver tag for the new image. |
| 34 | + |
| 35 | +## CircleCI usage |
| 36 | + |
| 37 | +This image is pulled from within Dash.jl's [CircleCI config.yml](../.circleci/config.yml): |
8 | 38 |
|
9 | 39 | ```yaml
|
10 | 40 | docker:
|
11 |
| - - image: plotly/julia:ci |
| 41 | + - image: etpinard/dashjl-tests:<x.y.z> |
12 | 42 | ```
|
13 | 43 |
|
14 |
| -## Publication details |
| 44 | +where `<x.y.z>` is the latest tag listed on <https://hub.docker.com/r/etpinard/dashjl-tests/tags>. |
| 45 | + |
| 46 | +## Local usage |
| 47 | + |
| 48 | +````sh |
| 49 | +# grab a copy of the python (main) dash repo |
| 50 | +cd Dash.jl |
| 51 | +git clone --depth 1 https://github.com/plotly/dash.git -b dev dash-main |
| 52 | + |
| 53 | +# start `dashjl-tests` |
| 54 | +docker run -t -d --name dashjl-tests -v .:/home/circleci/project etpinard/dashjl-tests:<x.y.z> |
15 | 55 |
|
16 |
| -[plotly/julia:ci](https://hub.docker.com/r/plotly/julia/tags) |
| 56 | +# ssh into it as root (some python deps need that unfortunately) |
| 57 | +docker exec -u 0 -it dashjl-tests bash |
17 | 58 |
|
18 |
| -## Limitations |
| 59 | +# [on 1st session] install pip deps |
| 60 | +cd /home/circleci/project/dash-main |
| 61 | +pip install --upgrade pip wheel |
| 62 | +pip install -e .[ci,dev,testing] --progress-bar off |
19 | 63 |
|
20 |
| -The current revision of this Dockerfile fixes the Julia version at a given release, so only manual updating is possible. The image is based on `circleci/python:3.7-stretch-node-browsers` rather than the [docker-library](https://github.com/docker-library/julia) or [julia-latest](https://hub.docker.com/_/julia?tab=tags) images. |
| 64 | +# [on 1st session] install chrome |
| 65 | +cd /home/circleci |
| 66 | +wget https://raw.githubusercontent.com/CircleCI-Public/browser-tools-orb/main/src/scripts/install-chrome.sh |
| 67 | +chmod +x install-chrome.sh |
| 68 | +ORB_PARAM_CHANNEL="stable" ORB_PARAM_CHROME_VERSION="latest" ./install-chrome.sh |
| 69 | + |
| 70 | +# [on 1st session] install chromedriver |
| 71 | +cd /home/circleci |
| 72 | +wget https://raw.githubusercontent.com/CircleCI-Public/browser-tools-orb/main/src/scripts/install-chromedriver.sh |
| 73 | +chmod +x ./install-chromedriver.sh |
| 74 | +ORB_PARAM_DRIVER_INSTALL_DIR=/usr/local/bin/ ./install-chromedriver.sh |
| 75 | + |
| 76 | +# [on 1st session] instantiate julia deps |
| 77 | +cd /home/circleci/project/ |
| 78 | +julia --project -e 'import Pkg; Pkg.instantiate()' |
| 79 | + |
| 80 | +# update julia deps then run integration tests |
| 81 | +cd /home/circleci/project/ |
| 82 | +julia --project -e 'import Pkg; Pkg.update()' |
| 83 | +pytest --headless --nopercyfinalize --percy-assets=test/assets/ test/integration/ |
| 84 | +``` |
0 commit comments