From 5e08b935d59834a7a5d1f75bd88de1e2b17da43e Mon Sep 17 00:00:00 2001 From: cclauss Date: Sat, 8 Jun 2019 12:38:21 +0200 Subject: [PATCH 1/3] Enable automated testing with CircleCI --- .circleci/config.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 000000000000..b3144f27be30 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,23 @@ +version: 2.0 + +jobs: + Python3: + docker: + - image: circleci/python:3.7.3 + steps: + - checkout + #- run: sudo pip install -r requirements.txt + - run: pip install --user flake8 # pytest + - run: python -m flake8 --version ; pip --version + # stop the build if there are Python syntax errors or undefined names + - run: python -m flake8 . --count --select=E9,F63,F72,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + - run: python -m flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + #- run: pytest + + +workflows: + version: 2 + build: + jobs: + - Python3 From 6b732dd54d04099452061d85c7d4be9958653d1b Mon Sep 17 00:00:00 2001 From: cclauss Date: Sat, 8 Jun 2019 12:45:14 +0200 Subject: [PATCH 2/3] Update config.yml --- .circleci/config.yml | 69 ++++++++++++++++++++++++++++++++------------ 1 file changed, 51 insertions(+), 18 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b3144f27be30..275a32dbd789 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,23 +1,56 @@ -version: 2.0 - +# Python CircleCI 2.0 configuration file +# +# Check https://circleci.com/docs/2.0/language-python/ for more details +# +version: 2 jobs: - Python3: + build: docker: + # specify the version you desire here + # use `-browsers` prefix for selenium tests, e.g. `3.6.1-browsers` - image: circleci/python:3.7.3 + + # Specify service dependencies here if necessary + # CircleCI maintains a library of pre-built images + # documented at https://circleci.com/docs/2.0/circleci-images/ + # - image: circleci/postgres:9.4 + + working_directory: ~/repo + steps: - checkout - #- run: sudo pip install -r requirements.txt - - run: pip install --user flake8 # pytest - - run: python -m flake8 --version ; pip --version - # stop the build if there are Python syntax errors or undefined names - - run: python -m flake8 . --count --select=E9,F63,F72,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - - run: python -m flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - #- run: pytest - - -workflows: - version: 2 - build: - jobs: - - Python3 + + # Download and cache dependencies + - restore_cache: + keys: + - v1-dependencies-{{ checksum "requirements.txt" }} + # fallback to using the latest cache if no exact match is found + - v1-dependencies- + + - run: + name: install dependencies + command: | + python3 -m venv venv + . venv/bin/activate + pip install --upgrade pip + pip install flake8 # -r requirements.txt + + - save_cache: + paths: + - ./venv + key: v1-dependencies-{{ checksum "requirements.txt" }} + + # run tests! + # this example uses Django's built-in test-runner + # other common Python testing frameworks include pytest and nose + # https://pytest.org + # https://nose.readthedocs.io + - run: + name: run tests + command: | + . venv/bin/activate + python -m flake8 . --count --select=E9,F63,F72,F82 --show-source --statistics + + - store_artifacts: + path: test-reports + destination: test-reports From f048e1ab667a844bc15fce29209a190fe4f8eb4b Mon Sep 17 00:00:00 2001 From: cclauss Date: Sat, 8 Jun 2019 12:47:40 +0200 Subject: [PATCH 3/3] flake8 . --exclude=./venv --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 275a32dbd789..c21cd736100f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -49,7 +49,7 @@ jobs: name: run tests command: | . venv/bin/activate - python -m flake8 . --count --select=E9,F63,F72,F82 --show-source --statistics + python -m flake8 . --count --exclude=./venv --select=E9,F63,F72,F82 --show-source --statistics - store_artifacts: path: test-reports