Skip to content

Commit

Permalink
Tests and linting
Browse files Browse the repository at this point in the history
  • Loading branch information
nichollsh committed Sep 6, 2024
1 parent 30a236d commit 40989a3
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 2 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Tests for PROTEUS

on:
push:
branches:
- main
pull_request:
branches:
- main
types:
- opened
- reopened
- synchronize
- ready_for_review
workflow_dispatch:

jobs:
test:
if: github.event.pull_request.draft == false
name: Run Coverage and Tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v3
with:
submodules: 'false'

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- uses: actions/cache@v3
id: cache-virtualenv
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}

- name: Install dependencies
if: steps.cache-virtualenv.outputs.cache-hit != 'true'
run: |
python -m pip install -e .[develop]
- name: Test with pytest
run: |
coverage run -m pytest
- name: Report coverage
run: |
coverage json
export TOTAL=$(python -c "import json;print(json.load(open('coverage.json'))['totals']['percent_covered_display'])")
echo "total=$TOTAL" >> $GITHUB_ENV
echo "### Total coverage: ${TOTAL}%" >> $GITHUB_STEP_SUMMARY
echo $'\n```' >> $GITHUB_STEP_SUMMARY
coverage report >> $GITHUB_STEP_SUMMARY
echo $'\n```' >> $GITHUB_STEP_SUMMARY
# - name: Make coverage badge
# if: ${{ github.ref == 'refs/heads/main' && matrix.python-version == '3.10' }}
# uses: schneegans/[email protected]
# with:
# auth: ${{ secrets.GIST_TOKEN }}
# gistID: b4ee7dab92e20644bcb3a5ad09f71165
# filename: covbadge.svg
# label: Coverage
# message: ${{ env.total }}%
# minColorRange: 50
# maxColorRange: 90
# valColorRange: ${{ env.total }}
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
[![Tests for CALLIOPE](https://github.com/FormingWorlds/CALLIOPE/actions/workflows/tests.yaml/badge.svg)](https://github.com/FormingWorlds/CALLIOPE/actions/workflows/tests.yaml)
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

# CALLIOPE
Volatile delivery and planetary accretion model designed for integration into PROTEUS.
Numerical model for the equilibrium outgassing of volatiles from a magma ocean.

Named after the [Greek muse of eloquence and epic poetry](https://en.wikipedia.org/wiki/Calliope).
Prounounced: *kal-IGH-uh-pee*.

## Installation

Simply run `pip install -e .` in this folder and `calliope` will be added to your Python environment.

7 changes: 7 additions & 0 deletions tests/test_init.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from __future__ import annotations

from calliope import __version__


def test_version():
assert __version__

0 comments on commit 40989a3

Please sign in to comment.