This repository has been archived by the owner on Jun 5, 2024. It is now read-only.
Add write permission to id-token
#736
Workflow file for this run
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
# 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: | |
push: | |
branches: | |
- master | |
jobs: | |
update: | |
name: "${{ matrix.test }}_py${{ matrix.python-version }}" | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: False | |
matrix: | |
python-version: [ "3.9", "3.10" ] | |
test: ['coveralls', 'pytest', 'pytest_no_database'] | |
# Only run coverage / no_database on py3.8 | |
exclude: | |
- python-version: "3.10" | |
test: pytest_no_database | |
- python-version: "3.11" | |
test: coveralls | |
- python-version: "3.11" | |
test: pytest_no_database | |
steps: | |
# Setup and installation | |
- name: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- 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 have access to the secrets, otherwise coveralls | |
# will yield a low coverage because of the lack of interfacing with the | |
# database. | |
HAVE_ACCESS_TO_SECRETS: ${{ secrets.RUNDB_API_URL }} | |
if: matrix.test == 'coveralls' && env.HAVE_ACCESS_TO_SECRETS != null | |
run: | | |
coverage run --source=wfsim setup.py test -v | |
coveralls --service=github | |
# Done | |
- name: goodbye | |
run: echo "tests done, bye bye" |