Skip to content

Commit 2f8bc22

Browse files
authored
Merge pull request #211 from plotly/better-circleci-tests
Faster CircleCI tests + better docker image docs
2 parents 5ae3857 + cedb644 commit 2f8bc22

File tree

4 files changed

+75
-26
lines changed

4 files changed

+75
-26
lines changed

.circleci/config.yml

+1-6
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,15 @@ jobs:
3333
echo "CIRCLE_REPOSITORY_URL: ${CIRCLE_REPOSITORY_URL}"
3434
echo $CIRCLE_JOB > circlejob.txt
3535
36-
- run:
37-
name: 🔎 Unit tests
38-
command: |
39-
julia test/ci_prepare.jl
40-
4136
- run:
4237
name: ⚙️ Integration tests
4338
command: |
39+
julia --project -e 'import Pkg; Pkg.instantiate(); Pkg.update();'
4440
python -m venv venv
4541
. venv/bin/activate
4642
pip install --upgrade pip wheel
4743
git clone --depth 1 https://github.com/plotly/dash.git -b dev dash-main
4844
cd dash-main && pip install -e .[ci,dev,testing] --progress-bar off && cd ..
49-
export PATH=$PATH:/home/circleci/.local/bin/
5045
pytest --headless --nopercyfinalize --junitxml=test-reports/dashjl.xml --percy-assets=test/assets/ test/integration/
5146
- store_artifacts:
5247
path: test-reports

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ venv
1313
*.pyc
1414
tmp
1515
gen_resources/build
16+
dash-main

build/README.md

+73-9
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,84 @@
1-
# plotly/julia:ci
1+
# Docker image for running integration tests
22

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.
46

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.
610

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):
838

939
```yaml
1040
docker:
11-
- image: plotly/julia:ci
41+
- image: etpinard/dashjl-tests:<x.y.z>
1242
```
1343
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>
1555

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
1758

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
1963

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+
```

test/ci_prepare.jl

-11
This file was deleted.

0 commit comments

Comments
 (0)