Skip to content

Add github workflow for tests #13

Add github workflow for tests

Add github workflow for tests #13

Workflow file for this run

name: Run tests
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
pull-requests: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: "3.11"
- name: Cache conda environment
uses: actions/cache@v3
with:
path: |
~/conda_pkgs_dir
~/conda_envs_dir
key: ${{ runner.os }}-conda-${{ hashFiles('environment.yml') }}
restore-keys: |
${{ runner.os }}-conda-
- name: Set up Conda
shell: bash
run: |
CONDA_DIR=~/conda
if [ ! -d "$CONDA_DIR" ]; then
wget -nv https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
bash miniconda.sh -b -p $CONDA_DIR
fi
echo "$CONDA_DIR/bin" >> $GITHUB_PATH
conda config --set pkgs_dirs ~/conda_pkgs_dir
conda config --set envs_dirs ~/conda_envs_dir
source $CONDA_DIR/etc/profile.d/conda.sh
- name: Create and activate conda environment
shell: bash
run: |
source ~/conda/etc/profile.d/conda.sh
conda env create --file environment.yml --name asp_plot --force
conda activate asp_plot
- name: Install package
shell: bash
run: |
source ~/conda/etc/profile.d/conda.sh
conda activate asp_plot
pip install .
- name: Test with pytest
shell: bash
run: |
source ~/conda/etc/profile.d/conda.sh
conda activate asp_plot
pytest