forked from ECP-WarpX/WarpX
-
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.
Merge pull request ECP-WarpX#4 from ModernElectron/pscherpelz/circlec…
…i_setup Enable CircleCI testing in mewarpx
- Loading branch information
Showing
7 changed files
with
163 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# Python CircleCI 2.0 configuration file | ||
# | ||
# Check https://circleci.com/docs/2.0/language-python/ for more details | ||
|
||
version: 2.1 | ||
|
||
orbs: | ||
codecov: codecov/codecov@1.2.3 | ||
|
||
jobs: | ||
|
||
build_and_test_job: | ||
docker: | ||
# specify the version you desire here | ||
# This is a CircleCI convenience image with CI & python packages | ||
# pre-installed. | ||
- image: cimg/python:3.9 | ||
|
||
working_directory: ~/WarpX | ||
|
||
steps: | ||
- checkout | ||
|
||
# Download and cache dependencies | ||
- restore_cache: | ||
keys: | ||
- v3-dependencies-{{ checksum "mewarpx/setup.py" }}-{{ checksum ".circleci/config.yml" }} | ||
|
||
- run: | ||
name: install dependencies | ||
command: | | ||
.github/workflows/dependencies/pyfull.sh | ||
python3 -m venv venv | ||
. venv/bin/activate | ||
python3 -m pip install --upgrade pip setuptools wheel | ||
- save_cache: | ||
paths: | ||
- ./venv | ||
key: v3-dependencies-{{ checksum "mewarpx/setup.py" }}-{{ checksum ".circleci/config.yml" }} | ||
|
||
- run: | ||
name: build WarpX install mewarpx | ||
command: | | ||
echo 'activate venv; cd' | ||
. venv/bin/activate | ||
# WarpX + PyWarpX compile & install | ||
export WarpX_MPI=ON | ||
export WarpX_OPENPMD=ON | ||
export WarpX_PSATD=ON | ||
export WarpX_QED_TABLE_GEN=ON | ||
export CC=$(which clang) | ||
export CXX=$(which clang++) | ||
python3 -m pip install -v . | ||
# Install development mode of mewarpx | ||
cd mewarpx | ||
pip install -e .[complete] | ||
# run tests! | ||
- run: | ||
name: run tests | ||
command: | | ||
. venv/bin/activate | ||
cd mewarpx | ||
mkdir test-reports | ||
pytest --junitxml=test-reports/junit.xml --cov=mewarpx --cov-report=xml | ||
- store_test_results: | ||
path: mewarpx/test-reports | ||
|
||
- store_artifacts: | ||
path: mewarpx/test-reports | ||
destination: test-reports | ||
|
||
- codecov/upload | ||
|
||
# https://circleci.com/docs/2.0/workflows/ | ||
workflows: | ||
version: 2 | ||
build_and_test: | ||
jobs: | ||
- build_and_test_job |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[run] | ||
source=mewarpx |
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Version, Date, List of changes | ||
0.1.0, In progress, " | ||
|
||
**Physics changes**: | ||
|
||
- Initial release | ||
|
||
**Features**: | ||
|
||
- Initial release | ||
|
||
**API Changes**: | ||
|
||
- Initial release | ||
|
||
**Other changes**: | ||
|
||
- Initial release | ||
|
||
**Bugfixes**: | ||
|
||
- Initial release | ||
" |
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
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
[pytest] | ||
# Trying new xunit2 format for junit test metadata | ||
junit_family=xunit2 | ||
# Add command line options to force each test to run in a separate process. | ||
# Note that this requires pytest-xdist! But tests will break if this is not | ||
# used, because MEWarpX is not designed to reset gracefully between tests. | ||
# Finally, note that conftest.py can dynamically change command line arguments, | ||
# but this seems to break with pytest-xdist so cannot be used here. | ||
addopts = --boxed -n2 | ||
|
||
# Warnings: In the past -Werror was used in addopts above. Recent changes to | ||
# pytest cause harmless import warnings to make pytest fail on import. In order | ||
# to filter these, we use filterwarnings instead. Hopefully this still works | ||
# well with pytest-xdist; I'm pretty sure it will. | ||
# The necessary warnings to filter will likely vary rapidly with the version | ||
# of other packages. | ||
# Note also that the 'message' field in these filters is a regular expression. | ||
# Among other things, that means that parentheses need to be escaped. | ||
|
||
# The numpy dtype/ufunc size changed come when scipy was compiled against a | ||
# different version of numpy than used here, but it's harmless and common. | ||
filterwarnings = | ||
error | ||
ignore:numpy.dtype size changed:RuntimeWarning | ||
ignore:numpy.ufunc size changed:RuntimeWarning |
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
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
"""Test basic package aspects""" | ||
# Native python imports | ||
from builtins import next | ||
import csv | ||
import os | ||
|
||
# 3rd-party library imports | ||
|
||
# Local imports | ||
import mewarpx | ||
from mewarpx import util | ||
|
||
|
||
def test_version(): | ||
with open(os.path.join(util.mewarpx_dir, '../changelog.csv'), 'r') as f: | ||
reader = csv.reader(f) | ||
next(reader) | ||
row = next(reader) | ||
assert row[0] == mewarpx.__version__ |