Skip to content
This repository has been archived by the owner on Jun 5, 2024. It is now read-only.

Commit

Permalink
pinned tests are nice for reproducibility (#197)
Browse files Browse the repository at this point in the history
* pinned tests are nice for reproducibility

* Update pytest.yml

* Update setup.py

* less cmt in test

* Revert "less cmt in test"

This reverts commit f6dbb82.

Co-authored-by: Tianyu Zhu <tz2263@columbia.edu>
  • Loading branch information
JoranAngevaare and zhut19 authored Aug 27, 2021
1 parent e20831f commit 12f5ca6
Show file tree
Hide file tree
Showing 6 changed files with 163 additions and 111 deletions.
23 changes: 23 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Set update schedule for GitHub Actions to check they are up to date
# If one of the github actions is out of date, dependabot will open a
# PR to update the version of that action

version: 2
updates:
# Maintain the requirements in the github actiuons
- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every weekday
interval: "monthly"
assignees:
- jorana
# Maintain the requirements requirements folder
- package-ecosystem: "pip"
directory: "/extra_requirements"
schedule:
# Check for updates to requirements every week
interval: "monthly"
open-pull-requests-limit: 10
assignees:
- jorana
56 changes: 0 additions & 56 deletions .github/workflows/coveralls.yml

This file was deleted.

101 changes: 101 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# Test straxen on each PR.
# We run three types of tests:
# - Pytest -> these are the "normal" tests and should be run for all
# python versions
# - Coveralls -> this is to see if we are coverering all our lines of
# code with our tests. The results get uploaded to
# coveralls.io/github/XENONnT/straxen
# - pytest_no_database -> we want to make sure we can run the tests even
# if we don't have access to our datebase since this will e.g. happen
# when someone is pushing a PR from their own fork as we don't
# propagate our secrets there.

name: Test package

# Trigger this code when a new release is published
on:
workflow_dispatch:
release:
types: [created]
pull_request:
branches:
- master
- stable
push:
branches:
- master

jobs:
update:
name: "${{ matrix.test }}_py${{ matrix.python-version }}"
runs-on: ubuntu-latest
strategy:
fail-fast: True
matrix:
python-version: [3.7, 3.8, 3.9]
test: ['coveralls', 'pytest', 'pytest_no_database']
# Only run coverage / no_database on py3.8
exclude:
- python-version: 3.7
test: coveralls
- python-version: 3.9
test: coveralls
- python-version: 3.7
test: pytest_no_database
- python-version: 3.9
test: pytest_no_database
steps:
# Setup and installation
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Checkout repo
uses: actions/checkout@v2
- name: Install requirements for tests and latest strax
run: |
pip install -r extra_requirements/requirements-tests.txt
# Secrets and required files
- name: patch utilix file
# Patch this file if we want to have access to the database
if: matrix.test != 'pytest_no_database'
run: bash .github/scripts/create_readonly_utilix_config.sh
env:
# RunDB
RUNDB_API_URL: ${{ secrets.RUNDB_API_URL }}
RUNDB_API_USER_READONLY: ${{ secrets.RUNDB_API_USER_READONLY }}
RUNDB_API_PASSWORD_READONLY: ${{ secrets.RUNDB_API_PASSWORD_READONLY}}
PYMONGO_URL: ${{ secrets.PYMONGO_URL }}
PYMONGO_USER: ${{ secrets.PYMONGO_USER }}
PYMONGO_PASSWORD: ${{ secrets.PYMONGO_PASSWORD }}
PYMONGO_DATABASE: ${{ secrets.PYMONGO_DATABASE }}
# SCADA
SCADA_URL: ${{ secrets.SCADA_URL }}
SCADA_VALUE_URL: ${{ secrets.SCADA_VALUE_URL }}
SCADA_USER: ${{ secrets.SCADA_USER }}
SCADA_LOGIN_URL: ${{ secrets.SCADA_LOGIN_URL }}
SCADA_PWD: ${{ secrets.SCADA_PWD }}

# Run tests
- name: Test package
# This is running a normal test
if: matrix.test == 'pytest_no_database' || matrix.test == 'pytest'
run: |
python setup.py test -v
- name: Coveralls
# Make the coverage report and upload
env:
NUMBA_DISABLE_JIT: 1
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# We need to check if we had access to the secrets, otherwise coveralls
# will yield a low coverage because of the lack of interfacing with the
# database.
HAVE_ACCESS_TO_SECTETS: ${{ secrets.RUNDB_API_URL }}
if: matrix.test == 'coveralls' && env.HAVE_ACCESS_TO_SECTETS != null
run: |
coverage run --source=wfsim setup.py test -v
coveralls --service=github
# Done
- name: goodbye
run: echo "tests done, bye bye"
54 changes: 0 additions & 54 deletions .github/workflows/test_package.yml

This file was deleted.

35 changes: 35 additions & 0 deletions extra_requirements/requirements-tests.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Test compatibility with these most often:
strax==0.16.1
straxen==0.19.3

# File for the requirements of straxen with the automated tests
blosc==1.10.4 # Strax dependency
boltons==21.0.0
datashader==0.13.0
dask==2021.7.2
dill==0.3.4 # Strax dependency
coveralls==3.2.0
commentjson==0.9.0
coverage==5.5
flake8==3.9.2
holoviews==1.14.5
ipywidgets==7.6.3
hypothesis==6.14.5
jupyter-client==6.1.12 # for ipywidgets
matplotlib==3.4.2
multihist==0.6.4
npshmex==0.2.1 # Strax dependency
numba==0.53.1 # Strax dependency
numpy==1.19.5
pandas==1.2.5 # Strax dependency
psutil==5.8.0 # Strax dependency
pytest==6.2.4
pytest-cov==2.12.1
scikit-learn==0.24.2
scipy==1.7.0 # Strax dependency
tensorflow==2.5.1
tqdm==4.62.0
xarray==0.19.0
utilix==0.6.1
zstd==1.5.0.2 # Strax dependency
uproot==4.0.0
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@
'graphviz']},
packages=['wfsim',
'wfsim.core',
'wfsim.pax_datastructure',],
'wfsim.pax_datastructure',
'extra_requirements'],
package_dir={'extra_requirements': 'extra_requirements'},
package_data={'extra_requirements': ['requirements-tests.txt']},
classifiers=[
'Development Status :: 4 - Beta',
'License :: OSI Approved :: BSD License',
Expand Down

0 comments on commit 12f5ca6

Please sign in to comment.