diff --git a/.circleci/config.yml b/.circleci/config.yml index edf6a031..902598f0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,25 +1,37 @@ -version: 2.1 -orbs: - codecov: codecov/codecov@3.0.0 - -jobs: - build: - docker: - - image: cimg/python:3.9.6 - steps: - - checkout +version: 2 +jobs: # A basic unit of work in a run + build: # runs not using Workflows must have a `build` job as entry point + # directory where steps are run + + docker: # run the steps with Docker + # CircleCI Python images available at: https://hub.docker.com/r/circleci/python/ + - image: circleci/python:3.6.4 + auth: + username: mydockerhub-user + password: $DOCKERHUB_PASSWORD # context / project UI env-var reference + environment: # environment variables for primary container + PIPENV_VENV_IN_PROJECT: true + DATABASE_URL: postgresql://root@localhost/circle_test?sslmode=disable + # CircleCI PostgreSQL images available at: https://hub.docker.com/r/circleci/postgres/ + + steps: # steps that comprise the `build` job + - checkout # check out source code to working directory + - run: sudo chown -R circleci:circleci /usr/local/bin + - run: sudo chown -R circleci:circleci /usr/local/lib/python3.6/site-packages + - restore_cache: + # Read about caching dependencies: https://circleci.com/docs/2.0/caching/ + key: deps9-{{ .Branch }}-{{ checksum "Pipfile.lock" }} - run: - name: Install dependencies - command: pip install -r requirements.txt - - run: - name: Run tests and collect coverage command: | - coverage run tests.py - coverage xml - - codecov/upload - -workflow: - version: 2.1 - build-test: - jobs: - - build + sudo pip install pipenv + pipenv install + - save_cache: # cache Python dependencies using checksum of Pipfile as the cache-key + key: deps9-{{ .Branch }}-{{ checksum "Pipfile.lock" }} + paths: + - "venv" + + - store_test_results: # Upload test results for display in Test Summary: https://circleci.com/docs/2.0/collect-test-data/ + path: test-results + - store_artifacts: # Upload test summary for display in Artifacts: https://circleci.com/docs/2.0/artifacts/ + path: test-results + destination: tr1 diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 4ebc8aea..00000000 --- a/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -coverage diff --git a/tests.py b/tests.py index 92aa2034..10e61596 100644 --- a/tests.py +++ b/tests.py @@ -1,12 +1 @@ import unittest - -import awesome - - -class TestMethods(unittest.TestCase): - def test_add(self): - self.assertEqual(awesome.smile(), ":)") - - -if __name__ == '__main__': - unittest.main()