Skip to content

Commit

Permalink
Add pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
APN-Pucky committed Oct 9, 2024
1 parent 3d0a825 commit b73ee9e
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 55 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/test-yoda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Test

on:
push:
branches:
- master
pull_request:
# Run daily at 0:01 UTC
schedule:
- cron: '1 0 * * *'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
test:

runs-on: ubuntu-latest
container: apnpucky/gentoo-yoda:${{ matrix.yoda-version }}-latest
strategy:
matrix:
yoda-version: ['1.9.10', '2.0.1']

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: astral-sh/setup-uv@v3

- name: Install dependencies
run: |
uv pip install --system '.[test]'
uv pip list
- name: Test with pytest
run: |
pytest -r sx tests/
- name: Report core project coverage with Codecov
if: >-
github.event_name != 'schedule' &&
matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
files: ./coverage.xml
flags: unittests-${{ matrix.python-version }}
name: pylhe
token: ${{ secrets.CODECOV_TOKEN }}
55 changes: 0 additions & 55 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,55 +0,0 @@
name: Test

on:
push:
branches:
- master
pull_request:
# Run daily at 0:01 UTC
schedule:
- cron: '1 0 * * *'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
test:

runs-on: ubuntu-latest
container: apnpucky/gentoo-yoda:${{ matrix.yoda-version }}-latest
strategy:
matrix:
yoda-version: ['1.9.10', '2.0.1']

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: astral-sh/setup-uv@v3

- name: Install dependencies
run: |
uv pip install --system '.[test]'
uv pip list
- name: Test with pytest
run: |
pytest -r sx tests/
- name: Report core project coverage with Codecov
if: >-
github.event_name != 'schedule' &&
matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
files: ./coverage.xml
flags: unittests-${{ matrix.python-version }}
name: pylhe
token: ${{ secrets.CODECOV_TOKEN }}
14 changes: 14 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,21 @@ dependencies = [
"numpy"
]
[project.optional-dependencies]
lint = [
"ruff",
]
test = [
"pydocstyle",
"pytest-cov>=2.5.1",
"pytest>=6.0",
]
full =[ "histoprint", "mplhep" ]
develop = [
"pylhe[full,test,lint]",
"pre-commit",
"tbump>=6.7.0",
]


[project.scripts]
babyyoda = "babyyoda.cli.main:main"
Expand Down

0 comments on commit b73ee9e

Please sign in to comment.