From 63d3123b6d8270010431097ac022c23f88a8faf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Wed, 28 Jun 2023 09:59:25 -0400 Subject: [PATCH 1/4] drop "Unit tests" step in CircleCI workflow we already run the unit tests in the `jl_test`, we save 2-3 minutes of CI time by dropping `ci_prepare.jl` and replacing it by `Pkg.instantiate()` --- .circleci/config.yml | 6 +----- test/ci_prepare.jl | 11 ----------- 2 files changed, 1 insertion(+), 16 deletions(-) delete mode 100644 test/ci_prepare.jl diff --git a/.circleci/config.yml b/.circleci/config.yml index 99497ab..2d8a472 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -33,14 +33,10 @@ jobs: echo "CIRCLE_REPOSITORY_URL: ${CIRCLE_REPOSITORY_URL}" echo $CIRCLE_JOB > circlejob.txt - - run: - name: 🔎 Unit tests - command: | - julia test/ci_prepare.jl - - run: name: ⚙️ Integration tests command: | + julia --project -e 'import Pkg; Pkg.instantiate(); Pkg.update();' python -m venv venv . venv/bin/activate pip install --upgrade pip wheel diff --git a/test/ci_prepare.jl b/test/ci_prepare.jl deleted file mode 100644 index 4f0a674..0000000 --- a/test/ci_prepare.jl +++ /dev/null @@ -1,11 +0,0 @@ -using Pkg -Pkg.update() -Pkg.develop(path = ".") -Pkg.add("DashBase") -Pkg.add("PlotlyBase") -Pkg.add("PlotlyJS") -Pkg.add("HTTP") -Pkg.instantiate() -Pkg.build("Dash") -Pkg.build("HTTP") -Pkg.test("Dash", coverage=true) From 97f4f6d605012443f6d5650d7fa8fcf39232950c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Wed, 28 Jun 2023 10:39:54 -0400 Subject: [PATCH 2/4] drop `export PATH` statement inside the "Integration tests" command block, as it is now useless. --- .circleci/config.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2d8a472..2d5a34b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -42,7 +42,6 @@ jobs: pip install --upgrade pip wheel git clone --depth 1 https://github.com/plotly/dash.git -b dev dash-main cd dash-main && pip install -e .[ci,dev,testing] --progress-bar off && cd .. - export PATH=$PATH:/home/circleci/.local/bin/ pytest --headless --nopercyfinalize --junitxml=test-reports/dashjl.xml --percy-assets=test/assets/ test/integration/ - store_artifacts: path: test-reports From 5bafe939392e712f3d05a8b24ced37b8b52490ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Wed, 21 Jun 2023 15:38:55 -0400 Subject: [PATCH 3/4] add `dash-main` to gitignore the `dash-main` folder the repo root is used during the integration tests to install the python testing deps --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 6c1cf3c..faf99d4 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ venv *.pyc tmp gen_resources/build +dash-main From cedb6448a8a3a05e0e1f48ff71da406511c4b1cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Wed, 28 Jun 2023 12:17:19 -0400 Subject: [PATCH 4/4] update docker image README so that it includes info on when and how to update the image and how to run the integration tests locally. --- build/README.md | 82 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 73 insertions(+), 9 deletions(-) diff --git a/build/README.md b/build/README.md index 24a62eb..19fd63e 100644 --- a/build/README.md +++ b/build/README.md @@ -1,20 +1,84 @@ -# plotly/julia:ci +# Docker image for running integration tests -#### This Dockerfile is currently used to support integration and unit tests for [Dash.jl](https://github.com/plotly/Dash.jl). +As CircleCI does not have Julia [Orbs](https://circleci.com/orbs/) yet, we rely +on a custom docker image to have access to Python, headless Chrome and Julia +in the same container. -## Usage +Since , we tag the build images +as [`etpinard/dashjl-tests`](https://hub.docker.com/r/etpinard/dashjl-tests). We +previously used the [`plotly/julia:ci`](https://hub.docker.com/r/plotly/julia/tags) image. -This image is pulled from within Dash.jl's [config.yml](https://github.com/plotly/Dash.jl/blob/dev/.circleci/config.yml): +## When should we update the docker image? + +The integration tests rely on the Python version of [dash](https://github.com/plotly/dash) +and its [testing framework](https://github.com/plotly/dash/tree/dev/dash/testing). + +So, we should use the latest CircleCI python + browsers image latest Python version +that is included in the [dash CircleCI config](https://github.com/plotly/dash/blob/dev/.circleci/config.yml) +as our base image. + +We should also update the Julia version from time to time. It might be nice to +run the integration tests on multiple Julia versions eventually. + +## How to update the docker image? + +Ask for push rights on docker hub first, then + +```sh +cd Dash.jl/build +docker build -t etpinard:dashjl-tests: . +docker push etpinard:dashjl-test: +``` + +where `` is the semver tag for the new image. + +## CircleCI usage + +This image is pulled from within Dash.jl's [CircleCI config.yml](../.circleci/config.yml): ```yaml docker: - - image: plotly/julia:ci + - image: etpinard/dashjl-tests: ``` -## Publication details +where `` is the latest tag listed on . + +## Local usage + +````sh +# grab a copy of the python (main) dash repo +cd Dash.jl +git clone --depth 1 https://github.com/plotly/dash.git -b dev dash-main + +# start `dashjl-tests` +docker run -t -d --name dashjl-tests -v .:/home/circleci/project etpinard/dashjl-tests: -[plotly/julia:ci](https://hub.docker.com/r/plotly/julia/tags) +# ssh into it as root (some python deps need that unfortunately) +docker exec -u 0 -it dashjl-tests bash -## Limitations +# [on 1st session] install pip deps +cd /home/circleci/project/dash-main +pip install --upgrade pip wheel +pip install -e .[ci,dev,testing] --progress-bar off -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. +# [on 1st session] install chrome +cd /home/circleci +wget https://raw.githubusercontent.com/CircleCI-Public/browser-tools-orb/main/src/scripts/install-chrome.sh +chmod +x install-chrome.sh +ORB_PARAM_CHANNEL="stable" ORB_PARAM_CHROME_VERSION="latest" ./install-chrome.sh + +# [on 1st session] install chromedriver +cd /home/circleci +wget https://raw.githubusercontent.com/CircleCI-Public/browser-tools-orb/main/src/scripts/install-chromedriver.sh +chmod +x ./install-chromedriver.sh +ORB_PARAM_DRIVER_INSTALL_DIR=/usr/local/bin/ ./install-chromedriver.sh + +# [on 1st session] instantiate julia deps +cd /home/circleci/project/ +julia --project -e 'import Pkg; Pkg.instantiate()' + +# update julia deps then run integration tests +cd /home/circleci/project/ +julia --project -e 'import Pkg; Pkg.update()' +pytest --headless --nopercyfinalize --percy-assets=test/assets/ test/integration/ +```