diff --git a/.circleci/config.yml b/.circleci/config.yml index 7c2f9dd1..40aa2216 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,12 +3,34 @@ version: 2.1 jobs: build: + docker: + - image: circleci/python:2.7.18 + steps: + - checkout + - run: + command: | + pip install --user sqlalchemy + pip install --user python-dateutil + python setup.py install --user + - persist_to_workspace: + root: ~/.local + paths: + - lib # Save installed Python libraries (including dbp itself) + unittest: + docker: + - image: circleci/python:2.7.18 + steps: + - checkout + - attach_workspace: + at: ~/.local + - run: + command: | + python unit_tests/test_all.py -v + createpostgres: docker: - image: circleci/python:2.7.18 environment: - PIPENV_VENV_IN_PROJECT: true DATABASE_URL: postgresql://root@localhost/circle_test?sslmode=disable - - image: circleci/postgres:9.6.2-alpine environment: POSTGRES_USER: root @@ -21,20 +43,22 @@ jobs: PGHOST: localhost steps: - checkout - - run: sudo chown -R circleci:circleci /usr/local/bin - - run: sudo chown -R circleci:circleci /usr/local/lib/python2.7/site-packages - - run: sudo apt-get install vim - - run: + - attach_workspace: + at: ~/.local + - run: command: | sudo apt install -y postgresql-client createdb -h localhost sndd -O root - pip install sqlalchemy - pip install python-dateutil - pip install psycopg2 - python setup.py install + pip install --user psycopg2 python scripts/CreateDBsabrs.py workflows: main: jobs: - build + - unittest: + requires: + - build + - createpostgres: + requires: + - build diff --git a/docs/developer/github.rst b/docs/developer/github.rst index ede67388..3c03eab6 100644 --- a/docs/developer/github.rst +++ b/docs/developer/github.rst @@ -3,7 +3,7 @@ Github integration ****************** There are several files in the repository that serve to manage the interaction -between github and the repository, and other settings in github that are +between GitHub and the repository, and other settings in GitHub that are relevant. Generally administrators manage thes settings, but anybody can submit a pull request that changes the files managing this interaction. @@ -18,7 +18,8 @@ Several documentation files are also rendered by Github. See Issue and Pull Request Templates ================================ These files are in the ``.github`` directory of the repository, and documented -`here `_ +`at GitHub `_. Settings ======== @@ -32,3 +33,45 @@ This is stored on a separate branch; `this page `_ describes how it is rendered. + +CircleCI +======== +Continuous integration is managed through `CircleCI `_. + +Some project settings: + +"Only build pull requests" is on; we will not build all branches. + +CircleCI refers to a PR that is relative to a fork as a "forked PR". Because +this the preferred means of submitting a PR, "Build forked pull requests" +is on. (The PR itself must actually be submitted to the dbprocessing +repository). + +We require status checks to pass before merging to master; in the GitHub +branch settings, this takes the form of a branch protection rule that requires +the circleci jobs to succeed on the PR. `This document +`_ is somewhat ambiguous, +but what it appears to mean is that the top-level circleci check should not +be selected (individual jobs should.). All jobs are selected. + +The GitHub checks are set up as described `in the CircleCI docs +`_. This involves +enabling GitHub checks on the dbprocessing repository (which +ultimately redirects to a GitHub setting) and then enabling "GitHub +Status Updates" in the CircleCI advanced project settings. + +The "webhooks" repository setting on GitHub controls the triggering of +CircleCI; this is set to "Let me select individual events" and we have +just "Pull requests", "Pushes" and "Releases" selected. (This was the +default setup; normally only PRs matter, as we don't do pushes without +PR, and we don't do CircleCI processing of releases.) This is also +where a hook can be re-delivered to CircleCI (triggering processing +again) if the build never happened on CircleCI (the build can also be +restarted on CircleCI if it has already run.) + +For ssh access to the CircleCI build environment, click "Project +Settings" in the dbprocessing project on CircleCI, then "SSH Keys" and +add a key there. (This needs to be the private key, so use one just +for this purpose.) diff --git a/scripts/DBRunner.py b/scripts/DBRunner.py index a666ce5e..7df7a469 100755 --- a/scripts/DBRunner.py +++ b/scripts/DBRunner.py @@ -8,7 +8,6 @@ import subprocess import dateutil.parser as dup -import spacepy.toolbox as tb from dbprocessing import dbprocessing from dbprocessing.runMe import ProcessException