Simplifying test setup #157
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: tests | |
# We run the test suite on every push | |
on: [push, pull_request] | |
jobs: | |
build-linux: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
# Note that miniconda is installed by default in environments | |
- name: Set up conda environment | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
activate-environment: datascience | |
environment-file: linux_environment.yml | |
python-version: '3.10' | |
auto-activate-base: true | |
- name: Add conda to system path | |
run: | | |
# $CONDA is an environment variable pointing to the root of the miniconda directory | |
echo $CONDA/bin >> $GITHUB_PATH | |
export PATH="$CONDA/bin:$PATH" | |
conda init bash | |
- name: Setup python requirements | |
run: | | |
source activate datascience | |
python -m pip install --upgrade pip | |
python -m pip --version | |
python -m pip install -r requirements.txt | |
python -m pip install -r docs/requirements.txt | |
python -m pip install -r requirements-tests.txt | |
python setup.py develop | |
- name: Run Tests | |
run: | | |
source activate datascience | |
make test | |
- name: Upload coverage data to Coveralls | |
run: | | |
source activate datascience | |
coveralls --service=github | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push docs | |
if: github.ref_name == 'master' && github.event_name == 'push' | |
run: | | |
source activate datascience | |
python -m pip install -r docs/requirements.txt | |
python -m pip uninstall pandoc | |
conda install pandoc | |
git config --global user.name github-actions | |
git config --global user.email [email protected] | |
echo "-- building docs --" | |
make docs | |
echo "-- pushing docs --" | |
rm -rf doc_build | |
git clone --quiet --branch=gh-pages $GITHUB_SERVER_URL/$GITHUB_REPOSITORY doc_build | |
cp -r docs/_build/html/* doc_build | |
cd doc_build | |
git add -A | |
git commit -m "Generated by commit $GITHUB_SHA, pushed by GitHub run $GITHUB_RUN_ID." | |
echo "-- try to push --" | |
git push "https://${{github.actor}}:${{github.token}}@github.com/${{github.repository}}.git" | |
rm -rf doc_build |