Run Cookiecutter Tests #243
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: Run Cookiecutter Tests | |
on: | |
workflow_dispatch: | |
inputs: | |
debug_enabled: | |
description: "Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)" | |
required: false | |
default: false | |
pull_request: | |
push: | |
branches: | |
- master | |
jobs: | |
run_test: | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
- macos-latest | |
runs-on: ${{ matrix.os }} | |
name: Run pytest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- name: Install Mac dependencies | |
if: runner.os == 'macOS' | |
run: | | |
brew install coreutils direnv | |
$CONDA/bin/python -m pip install --upgrade pip | |
$CONDA/bin/python -m pip install -r requirements.txt | |
conda config --add channels conda-forge | |
$CONDA/bin/conda init bash | |
- name: Fix Conda permissions on macOS | |
if: runner.os == 'macOS' | |
run: sudo chown -R $UID $CONDA | |
- name: Install Linux dependencies | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update -y && sudo apt-get install -y direnv | |
$CONDA/bin/python -m pip install --upgrade pip | |
$CONDA/bin/python -m pip install -r requirements.txt | |
$CONDA/bin/conda init bash | |
- name: Build docs | |
run: | | |
cd docs | |
$CONDA/bin/python -m mkdocs build | |
- name: Git config | |
run: | | |
git config --global user.email [email protected] | |
git config --global user.name "Github Actions" | |
- name: "Set up SSH agent" | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
- name: "Add GitHub to the SSH known hosts file" | |
run: | | |
for ip in $(dig @8.8.8.8 github.com +short); do \ | |
ssh-keyscan github.com,$ip; \ | |
ssh-keyscan $ip; \ | |
done 2>/dev/null >> ~/.ssh/known_hosts | |
- name: Setup tmate session | |
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }} | |
uses: mxschmitt/action-tmate@v3 | |
with: | |
limit-access-to-actor: true | |
- name: Run pytest | |
run: | | |
$CONDA/bin/python -m pytest -vvv |