Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a simple build and smoke workflow - and package #20

Merged
merged 3 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build
on:
pull_request:
branches:
- main
push:
branches:
- main

jobs:
Build:
runs-on: ubuntu-latest
name: Install
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .

- name: Smoke test
run: |
pip install pytest
pytest ./tests
Empty file added lib/__init__.py
Empty file.
2 changes: 2 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[pytest]
testpaths = tests
24 changes: 24 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from setuptools import setup, find_packages
import os


# Function to parse requirements.txt
def parse_requirements(filename):
"""Load requirements from a pip requirements file."""
with open(filename, "r") as file:
return file.read().splitlines()


# Get the list of requirements from requirements.txt
requirements_file = os.path.abspath(
os.path.join(os.path.dirname(__file__), "requirements.txt")
)
install_requires = parse_requirements(requirements_file)

setup(
name="spinup_nemo",
version="0.1",
packages=find_packages(include=["lib"]),
package_dir={"": "."}, # The root directory is the base
install_requires=install_requires,
)
19 changes: 19 additions & 0 deletions tests/test_forecast.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"""
This file contains tests for the 'forecast' module in the 'lib' package.

The tests are written using pytest.
"""

import sys
import os
import pytest


def test_import_forecast():
"""Test that the forecast module can be imported successfully."""
try:
import lib.forecast

assert True, "forecast imported successfully."
except ImportError as e:
pytest.fail(f"Failed to import forecast: {e}")
Loading