Skip to content

Commit 8c5007f

Browse files
committed
initial commit of all the things for CI
1 parent 8b5503f commit 8c5007f

File tree

9 files changed

+130
-0
lines changed

9 files changed

+130
-0
lines changed

.codecov.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# codecov can find this file anywhere in the repo, so we don't need to clutter
2+
# the root folder.
3+
#comment: false
4+
5+
codecov:
6+
notify:
7+
require_ci_to_pass: no
8+
9+
coverage:
10+
status:
11+
patch:
12+
default:
13+
target: '70'
14+
if_no_uploads: error
15+
if_not_found: success
16+
if_ci_failed: failure
17+
project:
18+
default: false
19+
library:
20+
target: auto
21+
if_no_uploads: error
22+
if_not_found: success
23+
if_ci_failed: failure
24+
paths: '!*/tests/.*'
25+
26+
tests:
27+
target: 97.9%
28+
paths: '*/tests/.*'
29+
if_not_found: success
30+
31+
flags:
32+
tests:
33+
paths:
34+
- tests/

.coveragerc

+9
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,18 @@ exclude_lines =
1414
^[ ]*@unittest.skip\b
1515
^[ ]{4}unittest.main()
1616
if __name__ == .__main__.:
17+
omit =
18+
*/python?.?/*
19+
*/site-packages/nose/*
20+
# ignore _version.py and versioneer.py
21+
.*version.*
22+
*_version.py
1723

1824

1925
[run]
26+
source =
27+
src/diffpy/utils/
2028
omit =
2129
## exclude debug.py from codecov report
2230
*/tests/debug.py
31+

.github/workflows/main.yml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
workflow_dispatch:
9+
10+
jobs:
11+
miniconda:
12+
name: Miniconda ${{ matrix.os }}
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
os: ["ubuntu-latest"]
17+
steps:
18+
- name: check out diffpy.utils
19+
uses: actions/checkout@v3
20+
with:
21+
repository: diffpy/diffpy.utils
22+
path: .
23+
24+
- name: initialize miniconda
25+
# this uses a marketplace action that sets up miniconda in a way that makes
26+
# it easier to use. I tried setting it up without this and it was a pain
27+
uses: conda-incubator/setup-miniconda@v2
28+
with:
29+
activate-environment: test
30+
# environment.yml file is needed by this action. Because I don't want
31+
# maintain this but rather maintain the requirements files it just has
32+
# basic things in it like conda and pip
33+
environment-file: ./environment.yml
34+
python-version: 3
35+
auto-activate-base: false
36+
37+
- name: install diffpy.utils requirements
38+
shell: bash -l {0}
39+
run: |
40+
conda config --set always_yes yes --set changeps1 no
41+
conda config --add channels conda-forge
42+
conda activate test
43+
conda install --file requirements/run.txt
44+
conda install --file requirements/test.txt
45+
pip install .
46+
47+
- name: Validate diffpy.utils
48+
shell: bash -l {0}
49+
run: |
50+
conda activate test
51+
coverage run run_tests.py
52+
coverage report -m
53+
codecov
54+

AUTHORS.txt

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
Pavol Juhas
2+
Andrew yang
23
Timur Davis
34
Christopher L. Farrow
45
Simon J.L. Billinge
6+

environment.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
name: diffpy.utils
2+
channels:
3+
- conda-forge
4+
dependencies:
5+
- python=3
6+
- pip

requirements/docs.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
sphinx
2+
sphinx_rtd_theme
3+
doctr

requirements/run.txt

Whitespace-only changes.

requirements/test.txt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
flake8
2+
pytest
3+
codecov
4+
coverage
5+
pytest-env

run_tests.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env python
2+
3+
import sys
4+
import pytest
5+
6+
if __name__ == '__main__':
7+
# show output results from every test function
8+
args = ['-v']
9+
# show the message output for skipped and expected failure tests
10+
if len(sys.argv) > 1:
11+
args.extend(sys.argv[1:])
12+
print('pytest arguments: {}'.format(args))
13+
# # compute coverage stats for xpdAcq
14+
# call pytest and exit with the return code from pytest so that
15+
# travis will fail correctly if tests fail
16+
exit_res = pytest.main(args)
17+
sys.exit(exit_res)

0 commit comments

Comments
 (0)