Skip to content
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

Make CI faster #157

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 60 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
version: 2
version: 2.1

orbs:
browser-tools: circleci/[email protected]

executors:
default:
working_directory: /home/circleci/workspace
docker:
- image: cimg/python:3.8-browsers

jobs:
build:
working_directory: /home/circleci/workspace/
docker:
- image: circleci/python:3.8-browsers
executor: default
steps:
- checkout
- restore_cache:
key: deps-{{ checksum "pyproject.toml" }}
paths:
- .
- run:
name: "Install Browserstack tools"
command: |
Expand All @@ -16,13 +28,45 @@ jobs:
- run:
name: "Install Python Dependencies"
command: |
poetry config virtualenvs.in-project true
poetry install
- save_cache:
key: deps-{{ checksum "pyproject.toml" }}
paths:
- .
- persist_to_workspace:
root: /home/circleci
paths:
- .
unit-test:
executor: default
steps:
- attach_workspace:
at: /home/circleci
- run:
name: "Code Style Check"
command: |
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
poetry run black --check --line-length=88 --safe src tests
- run:
name: "Run Tests"
command: |
mkdir /home/circleci/reports/
poetry run pytest --verbose --cov arsenic --cov-report html:/home/circleci/reports/coverage/ --junitxml /home/circleci/reports/junit.xml --ignore tests/test_real_browsers.py
- store_test_results:
path: /home/circleci/reports/junit.xml
- store_artifacts:
path: /home/circleci/reports/coverage/
environment:
- DOCS_DIR: "/home/circleci/workspace/docs/"
browser-test:
unit:
executor: default
steps:
- attach_workspace:
at: /home/circleci
- browser-tools/install-browser-tools
- run:
name: "Run Tests"
command: |
Expand All @@ -31,10 +75,19 @@ jobs:
export REMOTE_BROWSER="{\"bstack:options\": {\"os\": \"Windows\", \"osVersion\": \"10\", \"resolution\": \"1024x768\", \"local\": \"true\", \"seleniumVersion\": \"3.14.0\", \"localIdentifier\": \"${CIRCLE_SHA1}\", \"buildName\": \"${CIRCLE_SHA1}-${CIRCLE_BUILD_NUM}-Chrome\", \"projectName\": \"arsenic\"}, \"browserName\": \"Chrome\", \"browserVersion\": \"latest\"}"
export BROWSERSTACK_LOCAL_IDENTIFIER="${CIRCLE_SHA1}"
export BROWSERSTACKLOCAL_BINARY="/home/circleci/bin/BrowserStackLocal"
poetry run pytest --verbose --cov arsenic --cov-report html:/home/circleci/reports/coverage/ --junitxml /home/circleci/reports/junit.xml
poetry run pytest --verbose --cov arsenic --cov-report html:/home/circleci/reports/coverage/ --junitxml /home/circleci/reports/junit.xml tests/test_real_browsers.py
- store_test_results:
path: /home/circleci/reports/junit.xml
- store_artifacts:
path: /home/circleci/reports/coverage/
environment:
- DOCS_DIR: "/home/circleci/workspace/docs/"

workflows:
build_and_test:
jobs:
- build
- unit-test:
requires:
- build
- browser-test:
requires:
- build