-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Ci speedup #845
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ci speedup #845
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,121 +1,218 @@ | ||
| version: 2 | ||
|
|
||
| jobs: | ||
| "percy-finalize": | ||
| docker: | ||
| - image: percyio/agent | ||
| steps: | ||
| - run: percy finalize --all | ||
|
|
||
| "python-2.7": &test-template | ||
| "lint-unit-37": &lint-unit | ||
| working_directory: ~/dash | ||
| docker: | ||
| - image: circleci/python:2.7-stretch-node-browsers | ||
| - image: circleci/python:3.7-stretch-node-browsers | ||
| environment: | ||
| PYLINTRC: .pylintrc | ||
| PYLINTRC: .pylintrc37 | ||
| PYVERSION: python37 | ||
|
|
||
| steps: | ||
| - checkout | ||
|
|
||
| - run: | ||
| name: ℹ️ CI Context | ||
| command: | | ||
| echo "TRIGGERER: ${CIRCLE_USERNAME}" | ||
| echo "BUILD_NUMBER: ${CIRCLE_BUILD_NUM}" | ||
| echo "BUILD_URL: ${CIRCLE_BUILD_URL}" | ||
| echo "BRANCH: ${CIRCLE_BRANCH}" | ||
| echo "RUNNING JOB: ${CIRCLE_JOB}" | ||
| echo "JOB PARALLELISM: ${CIRCLE_NODE_TOTAL}" | ||
| echo "CIRCLE_REPOSITORY_URL: ${CIRCLE_REPOSITORY_URL}" | ||
| echo $CIRCLE_JOB > circlejob.txt | ||
|
|
||
| - run: echo $PYVERSION > ver.txt | ||
| - restore_cache: | ||
| key: v-{{ checksum "circlejob.txt" }}-{{ checksum "requires-ci.txt" }}-{{ checksum "requires-install.txt" }}-{{ checksum "requires-testing.txt" }} | ||
| key: dep-{{ checksum "ver.txt" }}-{{ checksum "requires-ci.txt" }}-{{ checksum "requires-install.txt" }}-{{ checksum "requires-testing.txt" }} | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the cache key formula might need further tuning later |
||
| - run: | ||
| name: 🚧 pip dev requirements | ||
| command: | | ||
| sudo pip install --upgrade virtualenv | ||
| python -m venv venv || virtualenv venv | ||
| . venv/bin/activate | ||
| pip install -r requires-install.txt -r requires-ci.txt -r requires-testing.txt --quiet | ||
| python -m venv venv || virtualenv venv && . venv/bin/activate | ||
| pip install -e . -r requires-install.txt -r requires-ci.txt -r requires-testing.txt --quiet | ||
| - save_cache: | ||
| key: v-{{ checksum "circlejob.txt" }}-{{ checksum "requires-ci.txt" }}-{{ checksum "requires-install.txt" }}-{{ checksum "requires-testing.txt" }} | ||
| key: dep-{{ checksum "ver.txt" }}-{{ checksum "requires-ci.txt" }}-{{ checksum "requires-install.txt" }}-{{ checksum "requires-testing.txt" }} | ||
| paths: | ||
| - "venv" | ||
|
|
||
| - run: | ||
| name: 🌸 linting | ||
| name: 🌸 Python & JS Lint | ||
| command: | | ||
| . venv/bin/activate | ||
| pip install -e .[ci,testing] --quiet | ||
| pip list | grep dash | ||
| flake8 dash setup.py | ||
| flake8 --ignore=E123,E126,E501,E722,E731,F401,F841,W503,W504 --exclude=metadata_test.py tests | ||
| pip install -e . --quiet && pip list | grep dash | ||
| flake8 dash setup.py && flake8 --ignore=E123,E126,E501,E722,E731,F401,F841,W503,W504 --exclude=metadata_test.py tests | ||
| pylint dash setup.py --rcfile=$PYLINTRC | ||
| pylint tests/unit tests/integration/devtools tests/integration/renderer tests/integration/dash_assets -d all -e C0410,C0411,C0412,C0413,W0109 | ||
| cd dash-renderer && npm install --ignore-scripts && npm run lint:test && npm run format:test | ||
|
|
||
| - run: | ||
| name: ⛑ Run unit tests | ||
| name: ⛑ Unit Tests | ||
| command: | | ||
| . venv/bin/activate | ||
| mkdir test-reports | ||
| PYTHONPATH=~/dash/tests/assets pytest --junitxml=test-reports/junit.xml tests/unit | ||
| - store_test_results: | ||
| path: test-reports | ||
| - store_artifacts: | ||
| path: test-reports | ||
| PYTHONPATH=~/dash/tests/assets pytest tests/unit | ||
|
|
||
| "lint-unit-36": | ||
| <<: *lint-unit | ||
| docker: | ||
| - image: circleci/python:3.6-stretch-node-browsers | ||
| environment: | ||
| PYLINTRC: .pylintrc | ||
| PYVERSION: python36 | ||
|
|
||
| "lint-unit-27": | ||
| <<: *lint-unit | ||
| docker: | ||
| - image: circleci/python:2.7-stretch-node-browsers | ||
| environment: | ||
| PYLINTRC: .pylintrc | ||
| PYVERSION: python27 | ||
|
|
||
| "build-core-37": &build-core | ||
| working_directory: ~/dash | ||
| docker: | ||
| - image: circleci/python:3.7-stretch-node-browsers | ||
| environment: | ||
| PYVERSION: python37 | ||
| steps: | ||
| - checkout | ||
| - run: echo $PYVERSION > ver.txt | ||
| - restore_cache: | ||
| key: dep-{{ checksum "ver.txt" }}-{{ checksum "requires-ci.txt" }}-{{ checksum "requires-install.txt" }}-{{ checksum "requires-testing.txt" }} | ||
| - run: | ||
| name: 🚧 build renderer | ||
| name: 🚧 build core | ||
| command: | | ||
| . venv/bin/activate | ||
| cd dash-renderer | ||
| npm install --ignore-scripts && npm run build:dev && npm run build | ||
| pip install -e . --quiet | ||
| . venv/bin/activate && pip install --upgrade -e . --quiet && mkdir packages | ||
| python setup.py sdist && mv dist/* packages/ | ||
| cd dash-renderer && npm install --ignore-scripts && npm run build:dev && npm run build && python setup.py sdist && mv dist/* ../packages/ && cd .. | ||
| git clone --depth 1 https://github.com/plotly/dash-core-components.git | ||
| cd dash-core-components && npm install --ignore-scripts && npm run build && python setup.py sdist && mv dist/* ../packages/ && cd .. | ||
| git clone --depth 1 https://github.com/plotly/dash-renderer-test-components | ||
| cd dash-renderer-test-components && npm install --ignore-scripts && npm run build:all && python setup.py sdist && mv dist/* ../packages/ && cd .. | ||
| - persist_to_workspace: | ||
| root: ~/dash | ||
| paths: | ||
| - packages | ||
|
|
||
| "build-core-36": | ||
| <<: *build-core | ||
| docker: | ||
| - image: circleci/python:3.6-stretch-node-browsers | ||
| environment: | ||
| PYVERSION: python36 | ||
|
|
||
| "build-core-27": | ||
| <<: *build-core | ||
| docker: | ||
| - image: circleci/python:2.7-stretch-node-browsers | ||
| environment: | ||
| PYVERSION: python27 | ||
|
|
||
| "build-misc-37": &build-misc | ||
| working_directory: ~/dash | ||
| docker: | ||
| - image: circleci/python:3.7-stretch-node-browsers | ||
| environment: | ||
| PYVERSION: python37 | ||
|
|
||
| steps: | ||
| - checkout | ||
| - run: echo $PYVERSION > ver.txt | ||
| - restore_cache: | ||
| key: dep-{{ checksum "ver.txt" }}-{{ checksum "requires-ci.txt" }}-{{ checksum "requires-install.txt" }}-{{ checksum "requires-testing.txt" }} | ||
| - run: | ||
| name: 🚧 install dependencies from latest master commit | ||
| name: 🚧 build misc | ||
| command: | | ||
| git clone --depth 1 https://github.com/plotly/dash-core-components.git | ||
| git clone --depth 1 https://github.com/plotly/dash-html-components.git | ||
| . venv/bin/activate && pip install --upgrade -e . --quiet && mkdir packages | ||
| git clone --depth 1 https://github.com/plotly/dash-table.git | ||
| git clone --depth 1 https://github.com/plotly/dash-renderer-test-components | ||
| . venv/bin/activate | ||
| cd dash-core-components && npm install --ignore-scripts && npm run build && pip install -e . && cd .. | ||
| cd dash-html-components && npm install --ignore-scripts && npm run build && pip install -e . && cd .. | ||
| cd dash-table && npm install --ignore-scripts && npm run build && pip install -e . && cd .. | ||
| cd dash-renderer-test-components && npm install --ignore-scripts && npm run build:all && pip install -e . && cd .. | ||
| cd dash-table && npm install --ignore-scripts && npm run build && python setup.py sdist && mv dist/* ../packages/ && cd .. | ||
| git clone --depth 1 https://github.com/plotly/dash-html-components.git | ||
| cd dash-html-components && npm install --ignore-scripts && npm run build && python setup.py sdist && mv dist/* ../packages/ && cd .. | ||
| - persist_to_workspace: | ||
| root: ~/dash | ||
| paths: | ||
| - packages | ||
|
|
||
| "build-misc-36": | ||
| <<: *build-misc | ||
| docker: | ||
| - image: circleci/python:3.6-stretch-node-browsers | ||
| environment: | ||
| PYVERSION: python36 | ||
|
|
||
| "build-misc-27": | ||
| <<: *build-misc | ||
| docker: | ||
| - image: circleci/python:2.7-stretch-node-browsers | ||
| environment: | ||
| PYVERSION: python27 | ||
|
|
||
| "test-37": &test | ||
| working_directory: ~/dash | ||
| docker: | ||
| - image: circleci/python:3.7-stretch-node-browsers | ||
| environment: | ||
| PERCY_PARALLEL_TOTAL: '-1' | ||
| PYVERSION: python37 | ||
| parallelism: 3 | ||
| steps: | ||
| - checkout | ||
| - run: echo $PYVERSION > ver.txt | ||
| - restore_cache: | ||
| key: dep-{{ checksum "ver.txt" }}-{{ checksum "requires-ci.txt" }}-{{ checksum "requires-install.txt" }}-{{ checksum "requires-testing.txt" }} | ||
| - attach_workspace: | ||
| at: ~/dash | ||
| - run: | ||
| name: ⚙️ run integration test | ||
| name: ⚙️ Run Integration Tests | ||
| command: | | ||
| . venv/bin/activate | ||
| pytest --junitxml=test-reports/junit_intg.xml tests/integration/ | ||
| cd packages && ls -la && pip install * && cd .. && pip list | grep dash | ||
| TESTFILES=$(circleci tests glob "tests/integration/**/test_*.py" | circleci tests split --split-by=timings) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. circleci way to split and select tests based on previous execution duration infos |
||
| pytest --headless --durations=10 --junitxml=test-reports/junit_intg.xml ${TESTFILES} | ||
| - store_artifacts: | ||
| path: test-reports | ||
| - store_test_results: | ||
| path: test-reports | ||
| - store_artifacts: | ||
| path: /tmp/dash_artifacts | ||
|
|
||
| "test-36": | ||
| <<: *test | ||
| docker: | ||
| - image: circleci/python:3.6-stretch-node-browsers | ||
| environment: | ||
| PERCY_ENABLE: '0' | ||
| PYVERSION: python36 | ||
|
|
||
| "python-3.6": | ||
| <<: *test-template | ||
| docker: | ||
| - image: circleci/python:3.6-stretch-node-browsers | ||
| environment: | ||
| PYLINTRC: .pylintrc | ||
| PERCY_ENABLE: 0 | ||
|
|
||
| "python-3.7": | ||
| <<: *test-template | ||
| docker: | ||
| - image: circleci/python:3.7-stretch-node-browsers | ||
| environment: | ||
| PYLINTRC: .pylintrc37 | ||
| PERCY_ENABLE: 0 | ||
|
|
||
| "test-27": | ||
| <<: *test | ||
| docker: | ||
| - image: circleci/python:2.7-stretch-node-browsers | ||
| environment: | ||
| PERCY_ENABLE: '0' | ||
| PYVERSION: python27 | ||
|
|
||
| workflows: | ||
| version: 2 | ||
| build: | ||
| python3.7: | ||
| jobs: | ||
| - lint-unit-37 | ||
| - build-core-37 | ||
| - build-misc-37 | ||
| - "test-37": | ||
| requires: | ||
| - build-core-37 | ||
| - build-misc-37 | ||
| - "percy-finalize": | ||
| requires: | ||
| - test-37 | ||
| python3.6: | ||
| jobs: | ||
| - lint-unit-36 | ||
| - build-core-36 | ||
| - build-misc-36 | ||
| - "test-36": | ||
| requires: | ||
| - build-core-36 | ||
| - build-misc-36 | ||
| python2.7: | ||
| jobs: | ||
| - "python-2.7" | ||
| - "python-3.6" | ||
| - "python-3.7" | ||
| - lint-unit-27 | ||
| - build-core-27 | ||
| - build-misc-27 | ||
| - "test-27": | ||
| requires: | ||
| - build-core-27 | ||
| - build-misc-27 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,10 +2,10 @@ | |
| import time | ||
| import flask | ||
|
|
||
| from dash import Dash | ||
| from dash.dependencies import Input, Output | ||
| import dash_html_components as html | ||
| import dash_core_components as dcc | ||
| from dash import Dash | ||
| from dash.dependencies import Input, Output | ||
|
|
||
| from .IntegrationTests import IntegrationTests | ||
| from .utils import wait_for | ||
|
|
@@ -16,7 +16,7 @@ def setUp(self): | |
| pass | ||
|
|
||
|
|
||
| DELAY_TIME = 1 | ||
| DELAY_TIME = 0.2 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. heh that in itself should be a huge speedup. Should be just fine - if for some reason that's ever not a long enough delay to actually have the responses arrive at the front end in the desired order, it would be a (presumably rare) missed test, or testing a different order, but one that should still be valid. So I'm happy to make this change, but some day we should refactor this test to something a little smarter that actually triggers the responses based on evidence that the previous response has been received and acted upon, rather than just time. |
||
|
|
||
|
|
||
| def create_race_conditions_test(endpoints): | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -957,7 +957,7 @@ def update_output(value): | |
| self.wait_for_text_to_equal('#output-post', 'request_post changed this text!') | ||
| self.wait_for_text_to_equal('#output-post-payload', '{"output":"output-1.children","changedPropIds":["input.value"],"inputs":[{"id":"input","property":"value","value":"fire request hooks"}]}') | ||
| self.wait_for_text_to_equal('#output-post-response', '{"props":{"children":"fire request hooks"}}') | ||
| self.percy_snapshot(name='request-hooks') | ||
| self.percy_snapshot(name='request-hooks render') | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh interesting - was one of these snapshots blocking the other one previously? How did you discover this? Do we need some additional mechanism (like a list of previously-used names inside
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And I guess the next question: do these two tests actually both have distinct value, or should we delete one of them?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I got a 400 error when the test job start to have parallelism > 1
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh weird - so it allows multiple snapshots with the same name from the same process but not from different processes? very strange, though useful I guess as any test we do in our own code could only catch duplicates in the same process.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there was another issue with the previous approach, as we spin up a browser per test vs per session, the percy_finalize was called after each test case. anyway, there are some extra integration under the hood from percy client, it adds some extra protection for all major CI tools.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, got it - right, it's probably the extra finalizing that buried the duplicate, and now percy will be taking care of ensuring uniqueness. |
||
|
|
||
| def test_graphs_in_tabs_do_not_share_state(self): | ||
| app = dash.Dash() | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this works together with a
PERCY_PARALLEL_TOTAL: '-1'in test job, percy command will compare the number of containers by fetching ENV variable value from circleci.