Skip to content

Commit

Permalink
Testing/initial setup (#83)
Browse files Browse the repository at this point in the history
* Create empty `tests.yml` workflow

* Add workflow name and event triggers

* Add environmnent variables

* Add bash defaults

* Add build job with matrix of strategies but no steps yet

* Add checkout step

* Add setup mambaforge step

* Add workflow_dispatch trigger

* Add workflow_dispatch and simplify triggers

* Add caching for lockfiles

* Fix tardis to stardis typo

* Download lockfile and update environment

* Install tardis and stardis

* Run tests

* Fix another tardis to stardis typo

* Fix example test using prime numbers

* Upload to codecov

* Add attribution to Sieve of Eratosthenes in the test_primes example test

* Add .codecov.yml

* Delete prime number example
  • Loading branch information
smokestacklightnin authored Jul 13, 2023
1 parent a020663 commit 3016108
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 6 deletions.
10 changes: 10 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
coverage:
range: 60..100
round: down
precision: 2
status:
project:
default:
target: auto
threshold: 0.5%
#patch: off
76 changes: 76 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: tests

on:
push:
pull_request:
workflow_dispatch:

env:
CACHE_NUMBER: 0 # increase to reset cache manually
PYTEST_FLAGS: --cov=stardis --cov-report=xml --cov-report=html
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

defaults:
run:
shell: bash -l {0}

jobs:
build:
# if: github.repository_owner == 'tardis-sn'
strategy:
matrix:
include:

- os: ubuntu-latest
label: linux-64
prefix: /usr/share/miniconda3/envs/stardis

- os: macos-latest
label: osx-64
prefix: /Users/runner/miniconda3/envs/stardis

name: ${{ matrix.label }}
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2

- name: Setup Mambaforge
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: stardis
use-mamba: true


- name: Cache lockfile
uses: actions/cache@v2
with:
path: ${{ matrix.prefix }}
key: conda-${{ matrix.label }}-${{ hashFiles('conda-${{ matrix.label }}.lock') }}-${{ env.CACHE_NUMBER }}
id: cache-conda

- name: Update Conda Environment
id: update-env
run: |
wget -nv https://github.com/tardis-sn/tardis/releases/latest/download/conda-${{ matrix.label }}.lock -O conda-${{ matrix.label }}.lock
mamba update -n stardis --file conda-${{ matrix.label }}.lock
if: steps.cache-conda.outputs.cache-hit != 'true'

- name: Install TARDIS
id: install-tardis
run: |
pip install git+https://github.com/tardis-sn/[email protected]
- name: Install STARDIS
id: install-stardis
# shell: bash -l {0}
run: |
python setup.py develop
- name: Run tests
run: pytest stardis ${{ env.PYTEST_FLAGS }}

- name: Upload to Codecov
run: bash <(curl -s https://codecov.io/bash)
6 changes: 0 additions & 6 deletions stardis/tests/test_example.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
def test_primes():
from ..example_mod import primes

assert primes(10) == [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]


def test_deprecation():
import warnings

Expand Down

0 comments on commit 3016108

Please sign in to comment.