Skip to content

Commit

Permalink
Merge pull request #87 from SeanBryan51/master
Browse files Browse the repository at this point in the history
Add github actions for PyTest
  • Loading branch information
SeanBryan51 authored Jun 8, 2023
2 parents 02ec7fb + 571325d commit 9d78feb
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
26 changes: 26 additions & 0 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: PyTest

on: [pull_request]

jobs:
build:

runs-on: ubuntu-latest

# This is required to activate conda environment in GitHub Actions:
# See https://stackoverflow.com/questions/72703363/how-to-activate-conda-environment-in-github-actions
defaults:
run:
shell: bash -l {0}

steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: '3.9'
auto-activate-base: false
activate-environment: benchcab-dev
environment-file: benchcab-dev.yaml
- name: Test with pytest
run: |
TMPDIR=${{ runner.temp }} pytest
11 changes: 11 additions & 0 deletions benchcab-dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: benchcab-dev
channels:
- conda-forge
- defaults
dependencies:
- python=3.9
- f90nml
- netcdf4
- numpy
- pytest
- pyyaml
8 changes: 7 additions & 1 deletion benchcab/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
import importlib.metadata

__version__ = importlib.metadata.version('benchcab')
try:
__version__ = importlib.metadata.version("benchcab")
except importlib.metadata.PackageNotFoundError:
__version__ = ""
print("Warning: unable to interrogate version string from installed distribution.")
# Note: cannot re-raise exception here as this will break pytest
# when running without first installing the package

0 comments on commit 9d78feb

Please sign in to comment.