Skip to content

Commit

Permalink
Add pytest GitHub action
Browse files Browse the repository at this point in the history
  • Loading branch information
dachengx committed Jan 17, 2024
1 parent d7b826b commit 4500bb7
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# copied from https://github.com/XENONnT/straxen/blob/master/.github/workflows/pytest.yml
# Test fuse 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 covering all our lines of
# code with our tests. The results get uploaded to
# coveralls.io/github/XENONnT/fuse

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 }}
strategy:
fail-fast: false
matrix:
os: [ "ubuntu-latest" ]
python-version: [ 3.9, 3.10 ]
test: [ 'coveralls', 'pytest' ]

steps:
# Setup and installation
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4.2.0
with:
python-version: ${{ matrix.python-version }}

- name: Checkout repo
uses: actions/checkout@v3

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest coverage coveralls
pip install -r requirements.txt
- name: Install fuse
run: |
pip install .
- name: Test package
# This is running a normal test
run: |
coverage run --source=fuse -m pytest --durations 0
coverage report
- name: Coveralls
# Make the coverage report and upload
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: matrix.test == 'coveralls'
run: |
coverage run --source=fuse -m pytest -v
coveralls --service=github
- name: goodbye
run: echo "tests done, bye bye"

0 comments on commit 4500bb7

Please sign in to comment.