Skip to content

Commit 203788b

Browse files
committed
Add a GitHub Actions workflow to run the test suite
1 parent 88e3d77 commit 203788b

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

.github/workflow/tests.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Tests
2+
on: [push, pull_request]
3+
jobs:
4+
tests:
5+
runs-on: ubuntu-latest
6+
strategy:
7+
matrix:
8+
python-version: ['3.8', '3.9', '3.10', '3.11']
9+
fail-fast: true
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: actions/setup-python@v2
13+
with:
14+
python-version: ${{ matrix.python-version }}
15+
- name: Install Dependencies
16+
run: |
17+
set -x
18+
set -e
19+
# $CONDA is an environment variable pointing to the root of the miniconda directory
20+
echo $CONDA/bin >> $GITHUB_PATH
21+
conda config --set always_yes yes --set changeps1 no
22+
conda config --add channels conda-forge
23+
conda update -q conda
24+
conda info -a
25+
conda create -n test-environment python=${{ matrix.python-version }} pytest numpy
26+
conda init
27+
28+
- name: Run Tests
29+
run: |
30+
# Copied from .bashrc. We can't just source .bashrc because it exits
31+
# when the shell isn't interactive.
32+
33+
# >>> conda initialize >>>
34+
# !! Contents within this block are managed by 'conda init' !!
35+
__conda_setup="$('/usr/share/miniconda/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
36+
if [ $? -eq 0 ]; then
37+
eval "$__conda_setup"
38+
else
39+
if [ -f "/usr/share/miniconda/etc/profile.d/conda.sh" ]; then
40+
. "/usr/share/miniconda/etc/profile.d/conda.sh"
41+
else
42+
export PATH="/usr/share/miniconda/bin:$PATH"
43+
fi
44+
fi
45+
unset __conda_setup
46+
# <<< conda initialize <<<
47+
48+
set -x
49+
set -e
50+
51+
conda activate test-environment
52+
53+
pytest
54+
55+
# Make sure it installs
56+
python setup.py install

0 commit comments

Comments
 (0)