-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
02fd9b3
commit deb353a
Showing
1 changed file
with
102 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,195 +1,143 @@ | ||
version: 2 | ||
defaults: | ||
init_environemnt: &init_environment | ||
run: | | ||
# SOLR config | ||
cp ~/project/ckan/config/solr/schema.xml /etc/solr/conf/schema.xml | ||
service jetty9 restart || true # erroring out but does seem to work | ||
# Database Creation | ||
psql --host=ckan-postgres --username=ckan --command="CREATE USER ${CKAN_POSTGRES_USER} WITH PASSWORD '${CKAN_POSTGRES_PWD}' NOSUPERUSER NOCREATEDB NOCREATEROLE;" | ||
createdb --encoding=utf-8 --host=ckan-postgres --username=ckan --owner=${CKAN_POSTGRES_USER} ${CKAN_POSTGRES_DB} | ||
psql --host=ckan-postgres --username=ckan --command="CREATE USER ${CKAN_DATASTORE_POSTGRES_READ_USER} WITH PASSWORD '${CKAN_DATASTORE_POSTGRES_READ_PWD}' NOSUPERUSER NOCREATEDB NOCREATEROLE;" | ||
psql --host=ckan-postgres --username=ckan --command="CREATE USER ${CKAN_DATASTORE_POSTGRES_WRITE_USER} WITH PASSWORD '${CKAN_DATASTORE_POSTGRES_WRITE_PWD}' NOSUPERUSER NOCREATEDB NOCREATEROLE;" | ||
createdb --encoding=utf-8 --host=ckan-postgres --username=ckan --owner=${CKAN_DATASTORE_POSTGRES_WRITE_USER} ${CKAN_DATASTORE_POSTGRES_DB} | ||
# Database Initialization | ||
paster datastore -c test-core-circle-ci.ini set-permissions | psql --host=ckan-postgres --username=ckan | ||
paster db init -c test-core-circle-ci.ini | ||
install_deps: &install_deps | ||
run: | | ||
# OS Dependencies | ||
apt update | ||
case $CIRCLE_NODE_INDEX in | ||
$NODE_TESTS_CONTAINER) | ||
curl -sL https://deb.nodesource.com/setup_10.x | bash - | ||
apt install -y nodejs | ||
npm install [email protected] phantomjs@~1.9.1 | ||
;; | ||
esac | ||
apt install -y postgresql-client solr-jetty openjdk-8-jdk | ||
run_tests: &run_tests | ||
# Tests Backend, split across containers by segments | ||
run: | | ||
mkdir -p ~/junit | ||
case $CIRCLE_NODE_INDEX in | ||
0) python -m pytest $PYTEST_COMMON_OPTIONS --test-group 1 | ||
;; | ||
1) python -m pytest $PYTEST_COMMON_OPTIONS --test-group 2 | ||
;; | ||
2) python -m pytest $PYTEST_COMMON_OPTIONS --test-group 3 | ||
;; | ||
3) python -m pytest $PYTEST_COMMON_OPTIONS --test-group 4 | ||
;; | ||
esac | ||
# Tests Frontend, only in one container | ||
start_test_server: &start_test_server | ||
run: | ||
command: | | ||
case $CIRCLE_NODE_INDEX in | ||
$NODE_TESTS_CONTAINER) paster serve test-core-circle-ci.ini | ||
;; | ||
esac | ||
background: true | ||
run_front_tests: &run_front_tests | ||
run: | ||
command: | | ||
case $CIRCLE_NODE_INDEX in | ||
$NODE_TESTS_CONTAINER) | ||
sleep 5 | ||
/root/project/node_modules/mocha-phantomjs/bin/mocha-phantomjs \ | ||
http://localhost:5000/base/test/index.html | ||
;; | ||
esac | ||
ckan_env: &ckan_env | ||
environment: | ||
CKAN_DATASTORE_POSTGRES_DB: datastore_test | ||
CKAN_DATASTORE_POSTGRES_READ_USER: datastore_read | ||
CKAN_DATASTORE_POSTGRES_READ_PWD: pass | ||
CKAN_DATASTORE_POSTGRES_WRITE_USER: datastore_write | ||
CKAN_DATASTORE_POSTGRES_WRITE_PWD: pass | ||
CKAN_POSTGRES_DB: ckan_test | ||
CKAN_POSTGRES_USER: ckan_default | ||
CKAN_POSTGRES_PWD: pass | ||
PGPASSWORD: ckan | ||
NODE_TESTS_CONTAINER: 2 | ||
PYTEST_COMMON_OPTIONS: -v --ckan-ini=test-core-circle-ci.ini --cov=ckan --cov=ckanext --junitxml=/root/junit/junit.xml --test-group-count 4 --test-group-random-seed 1 | ||
pg_image: &pg_image | ||
image: postgres:10 | ||
environment: | ||
POSTGRES_USER: ckan | ||
POSTGRES_PASSWORD: ckan | ||
name: ckan-postgres | ||
|
||
redis_image: &redis_image | ||
image: redis:3 | ||
name: ckan-redis | ||
jobs: | ||
test-python-2: | ||
docker: | ||
- image: python:2-stretch | ||
environment: | ||
CKAN_DATASTORE_POSTGRES_DB: datastore_test | ||
CKAN_DATASTORE_POSTGRES_READ_USER: datastore_read | ||
CKAN_DATASTORE_POSTGRES_READ_PWD: pass | ||
CKAN_DATASTORE_POSTGRES_WRITE_USER: datastore_write | ||
CKAN_DATASTORE_POSTGRES_WRITE_PWD: pass | ||
CKAN_POSTGRES_DB: ckan_test | ||
CKAN_POSTGRES_USER: ckan_default | ||
CKAN_POSTGRES_PWD: pass | ||
PGPASSWORD: ckan | ||
NODE_TESTS_CONTAINER: 2 | ||
PYTEST_COMMON_OPTIONS: -v --ckan-ini=test-core-circle-ci.ini --cov=ckan --cov=ckanext --junitxml=/root/junit/junit.xml --test-group-count 4 --test-group-random-seed 1 | ||
- image: postgres:10 | ||
environment: | ||
POSTGRES_USER: ckan | ||
POSTGRES_PASSWORD: ckan | ||
name: ckan-postgres | ||
- image: redis:3 | ||
name: ckan-redis | ||
<<: *ckan_env | ||
- <<: *pg_image | ||
- <<: *redis_image | ||
|
||
parallelism: 4 | ||
|
||
steps: | ||
- checkout | ||
|
||
- <<: *install_deps | ||
- run: | | ||
# OS Dependencies | ||
apt update | ||
case $CIRCLE_NODE_INDEX in | ||
$NODE_TESTS_CONTAINER) | ||
curl -sL https://deb.nodesource.com/setup_10.x | bash - | ||
apt install -y nodejs | ||
npm install [email protected] phantomjs@~1.9.1 | ||
;; | ||
esac | ||
apt install -y postgresql-client solr-jetty openjdk-8-jdk | ||
# Python Dependencies | ||
pip install -r requirement-setuptools.txt | ||
pip install -r requirements-py2.txt | ||
pip install -r dev-requirements.txt | ||
python setup.py develop | ||
# SOLR config | ||
cp ~/project/ckan/config/solr/schema.xml /etc/solr/conf/schema.xml | ||
service jetty9 restart || true # erroring out but does seem to work | ||
# Database Creation | ||
psql --host=ckan-postgres --username=ckan --command="CREATE USER ${CKAN_POSTGRES_USER} WITH PASSWORD '${CKAN_POSTGRES_PWD}' NOSUPERUSER NOCREATEDB NOCREATEROLE;" | ||
createdb --encoding=utf-8 --host=ckan-postgres --username=ckan --owner=${CKAN_POSTGRES_USER} ${CKAN_POSTGRES_DB} | ||
psql --host=ckan-postgres --username=ckan --command="CREATE USER ${CKAN_DATASTORE_POSTGRES_READ_USER} WITH PASSWORD '${CKAN_DATASTORE_POSTGRES_READ_PWD}' NOSUPERUSER NOCREATEDB NOCREATEROLE;" | ||
psql --host=ckan-postgres --username=ckan --command="CREATE USER ${CKAN_DATASTORE_POSTGRES_WRITE_USER} WITH PASSWORD '${CKAN_DATASTORE_POSTGRES_WRITE_PWD}' NOSUPERUSER NOCREATEDB NOCREATEROLE;" | ||
createdb --encoding=utf-8 --host=ckan-postgres --username=ckan --owner=${CKAN_DATASTORE_POSTGRES_WRITE_USER} ${CKAN_DATASTORE_POSTGRES_DB} | ||
# Database Initialization | ||
paster datastore -c test-core-circle-ci.ini set-permissions | psql --host=ckan-postgres --username=ckan | ||
paster db init -c test-core-circle-ci.ini | ||
# Tests Backend, split across containers by segments | ||
- run: | | ||
mkdir -p ~/junit | ||
case $CIRCLE_NODE_INDEX in | ||
0) python -m pytest $PYTEST_COMMON_OPTIONS --test-group 1 | ||
;; | ||
1) python -m pytest $PYTEST_COMMON_OPTIONS --test-group 2 | ||
;; | ||
2) python -m pytest $PYTEST_COMMON_OPTIONS --test-group 3 | ||
;; | ||
3) python -m pytest $PYTEST_COMMON_OPTIONS --test-group 4 | ||
;; | ||
esac | ||
- <<: *init_environment | ||
- <<: *run_tests | ||
- store_test_results: | ||
path: ~/junit | ||
|
||
# Tests Frontend, only in one container | ||
- run: | ||
command: | | ||
case $CIRCLE_NODE_INDEX in | ||
$NODE_TESTS_CONTAINER) paster serve test-core-circle-ci.ini | ||
;; | ||
esac | ||
background: true | ||
- run: | ||
command: | | ||
case $CIRCLE_NODE_INDEX in | ||
$NODE_TESTS_CONTAINER) | ||
sleep 5 | ||
/root/project/node_modules/mocha-phantomjs/bin/mocha-phantomjs \ | ||
http://localhost:5000/base/test/index.html | ||
;; | ||
esac | ||
- <<: *start_test_server | ||
- <<: *run_front_tests | ||
test-python-3: | ||
docker: | ||
- image: python:3-stretch | ||
environment: | ||
CKAN_DATASTORE_POSTGRES_DB: datastore_test | ||
CKAN_DATASTORE_POSTGRES_READ_USER: datastore_read | ||
CKAN_DATASTORE_POSTGRES_READ_PWD: pass | ||
CKAN_DATASTORE_POSTGRES_WRITE_USER: datastore_write | ||
CKAN_DATASTORE_POSTGRES_WRITE_PWD: pass | ||
CKAN_POSTGRES_DB: ckan_test | ||
CKAN_POSTGRES_USER: ckan_default | ||
CKAN_POSTGRES_PWD: pass | ||
PGPASSWORD: ckan | ||
NODE_TESTS_CONTAINER: 2 | ||
PYTEST_COMMON_OPTIONS: -v --ckan-ini=test-core-circle-ci.ini --cov=ckan --cov=ckanext --junitxml=/root/junit/junit.xml --test-group-count 4 --test-group-random-seed 1 | ||
- image: postgres:10 | ||
environment: | ||
POSTGRES_USER: ckan | ||
POSTGRES_PASSWORD: ckan | ||
name: ckan-postgres | ||
- image: redis:3 | ||
name: ckan-redis | ||
<<: *ckan_env | ||
- <<: *pg_image | ||
- <<: *redis_image | ||
|
||
parallelism: 4 | ||
|
||
steps: | ||
- checkout | ||
|
||
- <<: *install_deps | ||
- run: | | ||
# OS Dependencies | ||
apt update | ||
case $CIRCLE_NODE_INDEX in | ||
$NODE_TESTS_CONTAINER) | ||
curl -sL https://deb.nodesource.com/setup_10.x | bash - | ||
apt install -y nodejs | ||
npm install [email protected] phantomjs@~1.9.1 | ||
;; | ||
esac | ||
apt install -y postgresql-client solr-jetty openjdk-8-jdk | ||
# Python Dependencies | ||
pip install -r requirement-setuptools.txt | ||
pip install -r requirements.txt | ||
pip install -r dev-requirements.txt | ||
python setup.py develop | ||
# SOLR config | ||
cp ~/project/ckan/config/solr/schema.xml /etc/solr/conf/schema.xml | ||
service jetty9 restart || true # erroring out but does seem to work | ||
# Database Creation | ||
psql --host=ckan-postgres --username=ckan --command="CREATE USER ${CKAN_POSTGRES_USER} WITH PASSWORD '${CKAN_POSTGRES_PWD}' NOSUPERUSER NOCREATEDB NOCREATEROLE;" | ||
createdb --encoding=utf-8 --host=ckan-postgres --username=ckan --owner=${CKAN_POSTGRES_USER} ${CKAN_POSTGRES_DB} | ||
psql --host=ckan-postgres --username=ckan --command="CREATE USER ${CKAN_DATASTORE_POSTGRES_READ_USER} WITH PASSWORD '${CKAN_DATASTORE_POSTGRES_READ_PWD}' NOSUPERUSER NOCREATEDB NOCREATEROLE;" | ||
psql --host=ckan-postgres --username=ckan --command="CREATE USER ${CKAN_DATASTORE_POSTGRES_WRITE_USER} WITH PASSWORD '${CKAN_DATASTORE_POSTGRES_WRITE_PWD}' NOSUPERUSER NOCREATEDB NOCREATEROLE;" | ||
createdb --encoding=utf-8 --host=ckan-postgres --username=ckan --owner=${CKAN_DATASTORE_POSTGRES_WRITE_USER} ${CKAN_DATASTORE_POSTGRES_DB} | ||
# Database Initialization | ||
paster datastore -c test-core-circle-ci.ini set-permissions | psql --host=ckan-postgres --username=ckan | ||
paster db init -c test-core-circle-ci.ini | ||
- <<: *init_environment | ||
|
||
# Tests Backend, split across containers by segments | ||
- run: | | ||
mkdir -p ~/junit | ||
case $CIRCLE_NODE_INDEX in | ||
0) python -m pytest $PYTEST_COMMON_OPTIONS --test-group 1 | ||
;; | ||
1) python -m pytest $PYTEST_COMMON_OPTIONS --test-group 2 | ||
;; | ||
2) python -m pytest $PYTEST_COMMON_OPTIONS --test-group 3 | ||
;; | ||
3) python -m pytest $PYTEST_COMMON_OPTIONS --test-group 4 | ||
;; | ||
esac | ||
- <<: *run_tests | ||
- store_test_results: | ||
path: ~/junit | ||
|
||
# Tests Frontend, only in one container | ||
- run: | ||
command: | | ||
case $CIRCLE_NODE_INDEX in | ||
$NODE_TESTS_CONTAINER) paster serve test-core-circle-ci.ini | ||
;; | ||
esac | ||
background: true | ||
- run: | ||
command: | | ||
case $CIRCLE_NODE_INDEX in | ||
$NODE_TESTS_CONTAINER) | ||
sleep 5 | ||
/root/project/node_modules/mocha-phantomjs/bin/mocha-phantomjs \ | ||
http://localhost:5000/base/test/index.html | ||
;; | ||
esac | ||
- <<: *start_test_server | ||
- <<: *run_front_tests | ||
workflows: | ||
version: 2 | ||
build_and_test: | ||
|