Skip to content

Commit

Permalink
ending point for continuous Integration using Github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenayoub committed Dec 7, 2023
1 parent a299869 commit 3cb3812
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 22 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
name: CI

on:
# GitHub has started calling new repo's first branch "main" https://github.com/github/renaming
# The cookiecutter uses the "--initial-branch" flag when it runs git-init
# GitHub has started calling the new repo's first branch "main" https://github.com/github/renaming
# Existing codes likely still have "master" as the primary branch
# Both are tracked here to keep legacy and new codes working
push:
branches:
- "master"
- "main"
pull_request:
branches:
- "master"
- "main"
schedule:
# Weekly tests run on main by default:
# Nightly tests run on master by default:
# Scheduled workflows run on the latest commit on the default or base branch.
# (from https://help.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events-schedule)
- cron: "0 0 * * 0"
- cron: "0 0 * * *"

jobs:
test:
Expand All @@ -22,10 +25,10 @@ jobs:
strategy:
matrix:
os: [macOS-latest, ubuntu-latest, windows-latest]
python-version: [3.8, 3.9, "3.10"]
python-version: [3.9, 3.10, 3.11]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Additional info about the build
shell: bash
Expand All @@ -35,7 +38,7 @@ jobs:
ulimit -a
# More info on options: https://github.com/marketplace/actions/provision-with-micromamba
- uses: mamba-org/provision-with-micromamba@main
- uses: mamba-org/setup-micromamba@v1
with:
environment-file: devtools/conda-envs/test_env.yaml
environment-name: test
Expand Down
29 changes: 15 additions & 14 deletions devtools/conda-envs/test_env.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
name: test
channels:

- conda-forge

- defaults
- conda-forge
- defaults
dependencies:
# Base depends
- python
- pip
# Base depends
- python
- pip

# Testing
- pytest
- pytest-cov
- codecov
# Package dependencies
- numpy
- matplotlib

# Pip-only installs
#- pip:
# - codecov
# Testing
- pytest
- pytest-cov
- codecov

# Pip-only installs
#- pip:
# - codecov
14 changes: 13 additions & 1 deletion molecool/tests/test_measure.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,16 @@ def test_calculate_angle_many(p1, p2, p3, expected_angle):

calculated_angle = molecool.calculate_angle(p1, p2, p3, degrees=True)

assert expected_angle == pytest.approx(calculated_angle), F'{calculated_angle} {expected_angle}'
assert expected_angle == pytest.approx(calculated_angle), F'{calculated_angle} {expected_angle}'

def test_calculate_angle_radians():
"""Test the calculate_angle function with output in radians"""

r1 = np.array([1, 0, 0])
r2 = np.array([0, 0, 0])
r3 = np.array([0, 1, 0])

expected_value = 90 * (np.pi / 180)

calculated_value = molecool.calculate_angle(r1, r2, r3)
assert expected_value == calculated_value

0 comments on commit 3cb3812

Please sign in to comment.