Skip to content
Snippets Groups Projects
Unverified Commit 3eee6ac8 authored by Fredrik Jonsson's avatar Fredrik Jonsson Committed by GitHub
Browse files

Merge pull request #1824 from OpenTechFund/chore/split-CI-multiple-tasks

Implement workflows for Circle CI
parents fb1aead1 852c873a
No related branches found
No related tags found
No related merge requests found
...@@ -2,23 +2,31 @@ ...@@ -2,23 +2,31 @@
# #
# Check https://circleci.com/docs/2.0/language-python/ for more details # Check https://circleci.com/docs/2.0/language-python/ for more details
# #
version: 2 version: 2.1
jobs: executors:
build: python:
docker:
- image: circleci/python:3.6.10
node:
docker:
- image: circleci/node:10
with-database:
docker: docker:
- image: circleci/python:3.6.9-stretch-node - image: circleci/python:3.6.10
environment: environment:
DATABASE_URL: postgresql://root@localhost/hypha?sslmode=disable DATABASE_URL: postgresql://root@localhost/hypha?sslmode=disable
PGHOST: localhost PGHOST: localhost
PGUSER: root PGUSER: root
DJANGO_SETTINGS_MODULE: hypha.settings.test DJANGO_SETTINGS_MODULE: hypha.settings.test
SEND_MESSAGES: false SEND_MESSAGES: false
- image: circleci/postgres:10.11
- image: circleci/postgres:10.10
environment: environment:
POSTGRES_USER: root POSTGRES_USER: root
POSTGRES_DB: hypha POSTGRES_DB: hypha
jobs:
build-fe:
executor: node
working_directory: ~/repo working_directory: ~/repo
steps: steps:
...@@ -28,37 +36,18 @@ jobs: ...@@ -28,37 +36,18 @@ jobs:
name: set owner on /usr/local name: set owner on /usr/local
command: sudo chown -R circleci:circleci /usr/local command: sudo chown -R circleci:circleci /usr/local
- restore_cache:
keys:
- v2-python-{{ .Branch }}-{{ checksum "requirements-dev.txt" }}
- v2-python-{{ .Branch }}-
- v2-python-
- restore_cache: - restore_cache:
keys: keys:
- v2-npm-{{ .Branch }}-{{ checksum "package-lock.json" }} - v2-npm-{{ .Branch }}-{{ checksum "package-lock.json" }}
- v2-npm-{{ .Branch }}- - v2-npm-{{ .Branch }}-
- v2-npm- - v2-npm-
- run:
name: install python dependencies
command: |
python3 -m venv venv
. venv/bin/activate
pip install coverage codecov
pip install -r requirements-dev.txt
- run: - run:
name: install node dependencies name: install node dependencies
command: | command: |
npm install --quiet npm install --quiet
npm install -g gulp-cli npm install -g gulp-cli
- save_cache:
paths:
- ./venv
key: v2-python-{{ .Branch }}-{{ checksum "requirements-dev.txt" }}
- save_cache: - save_cache:
paths: paths:
- ./node_modules - ./node_modules
...@@ -67,17 +56,91 @@ jobs: ...@@ -67,17 +56,91 @@ jobs:
key: v2-npm-{{ .Branch }}-{{ checksum "package-lock.json" }} key: v2-npm-{{ .Branch }}-{{ checksum "package-lock.json" }}
- run: - run:
name: buils static assets name: builds static assets
command: gulp deploy command: gulp deploy
- persist_to_workspace:
root: ~/repo
paths:
- hypha/static_compiled
build-be:
executor: python
working_directory: ~/repo
steps:
- checkout
- run:
name: set owner on /usr/local
command: sudo chown -R circleci:circleci /usr/local
- restore_cache:
keys:
- v2-python-{{ .Branch }}-{{ checksum "requirements-dev.txt" }}
- v2-python-{{ .Branch }}-
- v2-python-
- run:
name: install python dependencies
command: |
python3 -m venv venv
. venv/bin/activate
pip install coverage codecov
pip install -r requirements-dev.txt
- save_cache:
paths:
- ./venv
key: v2-python-{{ .Branch }}-{{ checksum "requirements-dev.txt" }}
- persist_to_workspace:
root: ~/repo
paths:
- venv
test:
executor: with-database
working_directory: ~/repo
steps:
- checkout
- attach_workspace:
at: ~/repo
- run: - run:
name: run tests name: run tests
command: | command: |
. venv/bin/activate . venv/bin/activate
flake8 ./hypha
make sort
python manage.py collectstatic --noinput --verbosity=0 python manage.py collectstatic --noinput --verbosity=0
python manage.py check python manage.py check
python manage.py makemigrations --check --noinput --verbosity=1 python manage.py makemigrations --check --noinput --verbosity=1
coverage run --source='hypha' manage.py test coverage run --source='hypha' manage.py test
codecov codecov
lint:
executor: python
working_directory: ~/repo
steps:
- checkout
- attach_workspace:
at: ~/repo
- run:
name: run tests
command: |
. venv/bin/activate
flake8 ./hypha
make sort
workflows:
version: 2.1
process:
jobs:
- build-fe
- build-be
- test:
requires:
- build-fe
- build-be
- lint:
requires:
- build-be
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment