[pre-commit.ci] pre-commit autoupdate #190
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
# 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 covering all our lines of | |
# code with our tests. The results get uploaded to | |
# coveralls.io/github/XENONnT/axidence | |
# - pytest_no_database -> we want to make sure we can run the tests even | |
# if we don't have access to our database 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: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 15 | |
env: | |
HAVE_ACCESS_TO_SECRETS: ${{ secrets.RUNDB_API_URL }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ "ubuntu-latest" ] | |
python-version: [ "3.9", "3.10" ] | |
test: [ "coveralls" ] | |
steps: | |
# Setup and installation | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/[email protected] | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
sudo apt-get install -y graphviz | |
python -m pip install --upgrade pip | |
python -m pip install pytest coverage coveralls | |
pip install git+https://github.com/XENONnT/[email protected]_cevns_unblind --force-reinstall | |
pip install strax==v1.6.5 --force-reinstall | |
pip install git+https://github.com/XENONnT/straxen.git@sr1_leftovers --force-reinstall | |
- name: Start MongoDB | |
uses: supercharge/[email protected] | |
with: | |
mongodb-version: 4.4.1 | |
- name: patch utilix file | |
# Secrets and required files | |
# Patch this file if we want to have access to the 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 }} | |
- name: Install requirements | |
run: | | |
pip install -r extra_requirements/requirements-tests.txt | |
- name: Install Axidence | |
run: | | |
pip install . | |
- name: Test package and report to coveralls | |
# Make the coverage report and upload | |
env: | |
TEST_MONGO_URI: 'mongodb://localhost:27017/' | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
coverage run --source=axidence -m pytest --durations 0 -v | |
coveralls --service=github | |
coverage report | |
- name: goodbye | |
run: echo "tests done, bye bye" |