diff --git a/.circleci/config.yml b/.circleci/config.yml index bfd4689a..9a4be138 100755 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -12,6 +12,40 @@ workflows: - black - check-manifest - flake8 + - build: + filters: + branches: + only: deploy/test + - test: + requires: + - build + filters: + branches: + only: deploy/test + test_and_release: + jobs: + - py38 + - py37 + - black + - check-manifest + - flake8 + - build: + filters: + branches: + only: deploy/release + - test: + requires: + - build + filters: + branches: + only: deploy/release + - deploy: + requires: + - build + - test + filters: + branches: + only: deploy/release jobs: py38: &test-template @@ -49,3 +83,59 @@ jobs: check-manifest: *test-template flake8: *test-template + + build: + docker: + - image: nikolaik/python-nodejs:python3.7-nodejs12-stretch + steps: + - checkout + - restore_cache: + keys: + - v1-dependencies-{{ checksum "VERSION.md" }} + - run: + name: Install npm dependencies + command: npm install + - run: + name: Build code + command: npm run build:prod + - run: + name: Install python dependencies + command: pip install -e . + - save_cache: + paths: + - node_modules + - mopidy_iris + key: v1-dependencies-{{ checksum "VERSION.md" }} + + test: + docker: + - image: nikolaik/python-nodejs:python3.7-nodejs12-stretch + steps: + - checkout + - restore_cache: + keys: + - v1-dependencies-{{ checksum "VERSION.md" }} + - run: + name: Run tests + command: npm run test + deploy: + docker: + - image: nikolaik/python-nodejs:python3.7-nodejs12-stretch + steps: + - checkout + - restore_cache: + keys: + - v1-dependencies-{{ checksum "VERSION.md" }} + - run: + name: Prepare .pypirc + command: | + echo -e "[distutils]" >> ~/.pypirc + echo -e "index-servers =" >> ~/.pypirc + echo -e " pypi" >> ~/.pypirc + echo -e "[distutils]" >> ~/.pypirc + echo -e "[pypi]" >> ~/.pypirc + echo -e "username = jaedb" >> ~/.pypirc + echo -e "password = $PYPI_PASSWORD" >> ~/.pypirc + - run: + name: Create and distribute package to pypi + command: python setup.py sdist upload -r pypi