update workflows and environments #677
Workflow file for this run
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: Python Package with caching | |
# taken from https://github.com/epassaro/cache-conda-envs | |
# cancel any previous running or pending jobs from the same branch | |
concurrency: | |
group: python-package-conda-cache-${{ github.head_ref }} | |
cancel-in-progress: true | |
on: | |
push: | |
branches: | |
- '*' | |
pull_request: | |
branches: | |
- '*' | |
schedule: | |
- cron: '0 0 * * 1' | |
workflow_dispatch: | |
env: | |
CACHE_NUMBER: 0 # increase to reset cache manually | |
jobs: | |
build: | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
label: linux-64 | |
prefix: /usr/share/miniconda3/envs/my-env | |
name: ${{ matrix.label }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Miniforge | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
miniforge-version: latest | |
activate-environment: my-env | |
- name: Set cache date | |
run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV | |
- uses: actions/cache@v2 | |
with: | |
path: ${{ matrix.prefix }} | |
key: ${{ matrix.label }}-conda-${{ hashFiles('environment.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }} | |
id: cache | |
- name: Update environment | |
run: conda env update -n my-env -f environment.yml | |
if: steps.cache.outputs.cache-hit != 'true' | |
- name: Run tests | |
shell: bash -l {0} | |
run: pytest ./tests |