Skip to content

Commit

Permalink
Ci jobs (#4)
Browse files Browse the repository at this point in the history
* added tests and codecov

* moved tests from src code to test code

* added comments

* add NdArray_TestCase

* added slug

* Update README.md

* updated readme links

* remove conda warnings

---------
Co-authored-by: Kyle Ma <maq1@ornl.gov>
Co-authored-by: Patrou, Maria <patroum@ornl.gov>
  • Loading branch information
KyleQianliMa authored Sep 20, 2024
1 parent fc65bb8 commit 53b5dd7
Show file tree
Hide file tree
Showing 9 changed files with 800 additions and 361 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: CI

on:
workflow_dispatch:
pull_request:
push:
branches: [next, qa]
tags: ['v*']

jobs:
tests:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment.yml
cache-environment-key: ${{ runner.os }}-env-${{ hashFiles('**/environment.yml') }}
cache-downloads-key: ${{ runner.os }}-downloads-${{ hashFiles('**/environment.yml') }}
condarc: |
channels:
- mcvine
- conda-forge
- name: pre-commit
run: pre-commit run --all-files
- name: Install histogram
run: python -m pip install -e . --no-deps
- name: Run tests
run: xvfb-run --server-args="-screen 0 1920x1080x24" -a python -m pytest --cov --cov-report=xml --cov-report=term --cov-config=.coveragerc
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: neutrons/histogram-dev

conda-build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment.yml
cache-environment-key: ${{ runner.os }}-env-${{ hashFiles('**/environment.yml') }}
cache-downloads-key: ${{ runner.os }}-downloads-${{ hashFiles('**/environment.yml') }}
condarc: |
channels:
- mcvine
- conda-forge
- name: build python wheel
shell: bash -l {0}
run: |
python -m build --wheel --no-isolation
- name: build conda package
run: |
# set up environment
cd conda.recipe
echo "versioningit $(versioningit ../)"
# build the package
CHANNELS="--channel mcvine --channel conda-forge"
VERSION=$(versioningit ../) conda mambabuild $CHANNELS --output-folder . .
conda verify noarch/histogram*.tar.bz2
- name: upload conda package to anaconda
shell: bash -l {0}
if: startsWith(github.ref, 'refs/tags/v')
env:
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
IS_RC: ${{ contains(github.ref, 'rc') }}
run: |
# label is main or rc depending on the tag-name
CONDA_LABEL="main"
if [ "${IS_RC}" = "true" ]; then CONDA_LABEL="rc"; fi
echo pushing ${{ github.ref }} with label $CONDA_LABEL
anaconda upload --label $CONDA_LABEL conda.recipe/noarch/histogram*.tar.bz2
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,9 @@ histogram data object

`pytest`

* [Documentation](https://histogram-dev.readthedocs.io/en/latest/)

* [Documentation](http://danse-inelastic.github.io/histogram)
---

[![CI](https://github.com/neutrons/histogram-dev/actions/workflows/actions.yml/badge.svg?branch=next)](https://github.com/neutrons/histogram-dev/actions/workflows/actions.yml)
[![codecov](https://codecov.io/gh/neutrons/histogram-dev/graph/badge.svg?token=Z0Y3B6XEWP)](https://codecov.io/gh/neutrons/histogram-dev)
17 changes: 15 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,29 @@ file = "src/histogram/_version.py"
where = ["src"]
exclude = ["src/histogram/scripts/Make.mm"]


[tool.coverage.run]
omit = [
"src/histogram/_version.py"
]
source = [
"src"
]

[project.scripts]
histogram-cli = "histogram.Histogram:main"

# pytest.ini
[tool.pytest.ini_options]
norecursedirs = [".svn","_build","ndarray*"] # ignore tests in ndarray due to missing stdVector module not found

norecursedirs = [".svn","_build"] # ignore tests in ndarray due to missing stdVector module not found

testpaths =[
"tests"
]
python_files = ["*_TestCase.py","histogramTest_*.py"] #manually run python alltests.py will also return 145 tests
filterwarnings =[
"ignore: Matplotlib is currently using ps, which is a non-GUI backend, so cannot show the figure."

"ignore: Matplotlib is currently using ps, which is a non-GUI backend, so cannot show the figure.",
"ignore: FigureCanvasPS is non-interactive, and thus cannot be shown"
]
Loading

0 comments on commit 53b5dd7

Please sign in to comment.