Skip to content

Commit

Permalink
Merge pull request pyne#1086 from bam241/ci_deploy
Browse files Browse the repository at this point in the history
Deploy the new version of the website
  • Loading branch information
gonuke authored Oct 1, 2019
2 parents ec90fa4 + e0e83be commit e2cf5c0
Show file tree
Hide file tree
Showing 4 changed files with 171 additions and 0 deletions.
80 changes: 80 additions & 0 deletions .circleci/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
PyNE-CI Documentation
=====================


PyNE Circle-CI use CIrcle_CI version 2.1 and is composed of 4 main sections:
`executors`, `commands`, `jobs` and `workflow`.

Executors
---------
The `executors` define aliases to the environment to run the different jobs. In our case these are
different docker images containing different combinations of the optional
dependencies of PyNE (`MOAB`, `pyMOAB`, `DAGMC`) in one of the two supported
Python versions (Python 2.7 or Python 3.6).


Commands
---------
The `commands` section provides the definitions of macro commands with arguments to be used
in the different jobs.

`news_check`: checks the presence of a new news file in the news folder


`save_container`: saves the status of a container to be reloaded in an
other job.

- `arguments`:
- `build` (string): build configuration parameters, used to identify a
build configuration


`pull_container`: pulls a previously saved (using the `save_container` command) status of container.

- `arguments`:
- `build` (string): build configuration parameters (has to match the build
argument used to save the container)


`checkout_build`: checks out PyNE branch to be tested, builds it and saves it
using the `save_container` command.

- `arguments`:
- `build` (string): used to identify a configuration
- `flags` (string): flags to be use when building PyNE


`run_test`: pulls a previous container using `pull_container` command, then runs the PyNE
nosetests using the provided `flag`.

- `arguments`:
- `build` (string): used to identify a configuration
- `flags` (string): flags to be use when running the PyNE nosetests


`website_build_push`: pull the Python 2.7 build with all the PyNE optional
depedencies `python2_dagmc_pymoab` saved image (using `pull_container` command),
build the website, and push it to the `pyne.github.com` repo.

- `arguments`:
- `push_option` (string: `test` or `root`):
- `test` option will push the newly built website to `website_preview`
branch of the repo allowing reviews.
- `root` option will push the website on the `master` branch of the repo,
deploying a new version of the website in `pyne.io`


Jobs
----
The `jobs` section defines all the different jobs used in the different
workflows. For each built configuration two jobs have been defined, one to build
PyNE, and one to run the `nosetests`. In addition to the build and test
jobs, two additional jobs have been created to build and push the website, one
to the `website_test` branch of the `pyne.github.com` repo, and one to the
`master` branch.


Workflow
--------
The `workflow` section defines independent workflow triggers the different
jobs (with triggers).
66 changes: 66 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,30 @@ commands:
cd ~/repo/tests
./travis-run-tests.sh << parameters.flags >>
# Build and push PyNE website
website_build_push:
description: "build PyNE website and push it either on the test branch (default) or on the deployed branch"
parameters:
push_option:
type: string
default: "test"
steps:
- pull_container:
build: "python2_dagmc_pymoab"
- add_ssh_keys:
fingerprints:
- $PYNE_KEY_FINGERPRINT
- run:
command: |
git config --global user.email "[email protected]"
git config --global user.name "report errors on github.com/PyNE/PyNE"
- run:
name: Build PyNE website
command: |
cd docs/
make html
make push-<< parameters.push_option >>
# Jobs part:
# Define the different job that will be ran this separate building form
# testing for each configuration allowing to get more information out of the CI
Expand Down Expand Up @@ -227,6 +251,25 @@ jobs:
flags: "python2"
build: "python2_dagmc_pymoab"

# Website
# Build and push the website
build_push_website_test:
executor:
name: py2_dagmc_pymoab
working_directory: ~/repo
steps:
- website_build_push:
push_option: "test"

build_push_website_deploy:
executor:
name: py2_dagmc_pymoab
working_directory: ~/repo
steps:
- website_build_push:
push_option: "root"


# Workflow part:
# This part defines the list of the jobs that will be ran and in which sequence.
# The goal was to avoid running advanced configuration if PyNE does not work
Expand Down Expand Up @@ -279,3 +322,26 @@ workflows:
- py2_dagmc_pymoab_test:
requires:
- py2_dagmc_pymoab_build


# Build/Push test website
- build_push_website_test:
requires:
- py2_dagmc_pymoab_test
- py3_dagmc_pymoab_test
filters:
branches:
only:
- develop


# only done on tags
- build_push_website_deploy:
requires:
- py2_dagmc_pymoab_test
- py3_dagmc_pymoab_test
filters:
branches:
ignore: /.*/
tags:
only: /.*/
11 changes: 11 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,17 @@ push-release:
git commit -am "Pushed $(RELEASE) docs at $$(date)" && \
git push

push-test:
cd $(BUILDDIR) && \
test -d $(DOCREPONAME) || git clone $(DOCREPOURL) $(DOCREPONAME) && \
cd $(DOCREPONAME) && \
git checkout -b website_preview origin/website_preview && \
rm -rf * && \
cp -r ../html/* . && \
git add . && \
git commit -am "Pushed root-level docs at $$(date) on ci_testing branch" && \
git push

# USE THIS ONE!!!
push-root:
cd $(BUILDDIR) && \
Expand Down
14 changes: 14 additions & 0 deletions news/website_ci_deploy.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
**Added:** None
- automatic deployement of a updated version of the website on tags
- automatic creation of a new version of the website (not deployed) for
verication purposes in `pyne.github.com/website_preview`

**Changed:** None

**Deprecated:** None

**Removed:** None

**Fixed:** None

**Security:** None

0 comments on commit e2cf5c0

Please sign in to comment.