-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathcircle.yml
151 lines (125 loc) · 4.97 KB
/
circle.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# CircleCI configuration
# ======================
#
# This page describes how to setup CircleCI version 2.0
# for a project built on top of DOLFIN. Tests are run
# using FEniCS docker images, in particular using an
# image with the development version of FEniCS.
#
# For details, see also `the FEniCS Docker reference manual
# <http://fenics-containers.readthedocs.org/en/latest/>`_.
#
# Use CircleCI 2.0. It has native support for Docker images.::
version: 2
# Specify build jobs::
jobs:
build:
# ``image`` specifies a Docker image with the development
# version of FEniCS. Inside of a container we will be using
# a user ``fenics`` which has an installation of FEniCS.
# But we will work in a different directory derived from
# the name of the project. The ``environment`` needs to
# be adjusted to allow importing C++ DOLFIN libraries and
# finding necessary files for just-in-time compilation.
# This is done because CircleCI bypasses environment setup
# specified in the FEniCS image.::
docker:
- image: quay.io/fenicsproject/dev
user: fenics
environment:
LD_LIBRARY_PATH: /home/fenics/local/lib
CMAKE_PREFIX_PATH: /home/fenics/local
MPLBACKEND: Agg
working_directory: /home/fenics/fenapack
# First step is checking out the source code into
# the working directory::
steps:
- checkout
# Then print some diagnostic information to a build log::
- run:
name: Environment and FEniCS version info
command: |
echo $USER $HOME $PWD $PATH $LD_LIBRARY_PATH $CMAKE_PREFIX_PATH
python3 -c'import ffc; print(ffc.git_commit_hash(), ffc.ufc_signature())'
python3 -c'import dolfin; print(dolfin.git_commit_hash())'
# Install the project from the working directory.::
- run:
name: Install FENaPack
command: |
pip3 install -v --user .
# Try to import the project. That involves some just-in-time
# compilation which we test and measure as a separate build
# step.::
- run:
name: Import FENaPack first time (JIT)
command: python3 -c"import fenapack"
# Run the unit tests using `the pytest framework
# <https://pytest.org>`_. By ``-svl`` options we make a test
# output more verbose and using ``--junitxml`` we save a
# test result in machine-readable format. In a later step
# we tell to CircleCI where the result is. CircleCI is able
# to provide various information based on the results on
# its web UI.::
- run:
name: Unit tests
command: py.test-3 test/unit -svl --junitxml /tmp/circle/unit.xml
# Now we run parallel unit tests. This would normally be
# done by just prefixing a ``py.test`` command by an
# ``mpirun`` command. Here we wrap it in the ``bash``
# instance to figure out an MPI rank number using the
# ``${OMPI_COMM_WORLD_RANK:-$PMI_RANK}`` variable, which
# should work both with MPICH and OpenMPI, and use it
# to generate separate test result files.::
- run:
name: Unit tests MPI
command: >
mpirun -n 3 bash -c '
py.test-3 test/unit -svl
--junitxml /tmp/circle/unit-mpi-${OMPI_COMM_WORLD_RANK:-$PMI_RANK}.xml
'
# Now we run the benchmarking suite and store generated PDF
# files for later use. Note that we tell to a shell (note
# that every build step is run in a separate shell) not to
# exit on first failure by ``set +e``. Instead we only want
# to eventually fail only on the ``py.test`` command by
# returning its exit code by ``exit $rc``.::
- run:
name: Bench
command: |
set +e
py.test-3 test/bench -svl --junitxml /tmp/circle/bench.xml
rc=$?
mv *.pdf /tmp/circle
exit $rc
# Now we run the regression tests implemented by a homebrew
# Python script ``test.py``. We copy resulting figures to
# directory where CircleCI collects artifacts.::
- run:
name: Regression tests
command: |
set +e
cd test/regression
NP=3 python3 -u test.py
rc=$?
cd ../../demo; find -name "*.pdf" -exec cp --parents {} /tmp/circle \;
exit $rc
# Install defcon and run test demo
- run:
name: Run defcon demo
command: |
CC=mpicc HDF5_MPI=ON pip3 install --no-cache-dir --user --no-binary=h5py h5py
pip3 install --no-cache-dir --user git+https://bitbucket.org/pefarrell/defcon
python3 -c"import defcon"
python3 demo/defcon/mesh/genmesh.py 120
cd demo/defcon && mpirun -n 2 python3 navier-stokes.py
mkdir -p /tmp/circle/defcon && cp bifurcation.pdf /tmp/circle/defcon
# Finally we tell to CircleCI to store build artifacts
# and test results, which both can be accessed on
# CircleCI website.::
- store_artifacts:
path: /tmp/circle
destination: build
- store_test_results:
path: /tmp/circle
# Download the complete configuration file
# :download:`circle.yml`.