2022-01-29 21:31:27 +00:00
|
|
|
name: test
|
2021-09-30 11:36:00 +00:00
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- 'master'
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- 'master'
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
test:
|
2021-12-15 06:15:49 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- os: ubuntu-latest
|
|
|
|
label: linux-64
|
|
|
|
prefix: /usr/share/miniconda3/envs/test
|
2021-09-30 11:36:00 +00:00
|
|
|
|
2021-12-15 06:15:49 +00:00
|
|
|
name: ${{ matrix.label }}
|
|
|
|
runs-on: ${{ matrix.os }}
|
2021-09-30 11:36:00 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2021-12-15 06:15:49 +00:00
|
|
|
|
|
|
|
- name: Install Environment Dependencies
|
|
|
|
shell: bash -l {0}
|
|
|
|
run: sudo apt-get -y install libimage-exiftool-perl
|
|
|
|
|
|
|
|
- name: Setup Mambaforge
|
|
|
|
uses: conda-incubator/setup-miniconda@v2
|
2021-09-30 11:36:00 +00:00
|
|
|
with:
|
2021-12-15 06:15:49 +00:00
|
|
|
miniforge-variant: Mambaforge
|
|
|
|
miniforge-version: latest
|
2021-09-30 11:36:00 +00:00
|
|
|
activate-environment: test
|
2021-12-15 06:15:49 +00:00
|
|
|
use-mamba: true
|
2022-01-29 08:43:34 +00:00
|
|
|
environment-file: config/environment.yml
|
2021-09-30 11:36:00 +00:00
|
|
|
python-version: 3.8
|
|
|
|
auto-activate-base: false
|
2021-10-03 08:04:14 +00:00
|
|
|
use-only-tar-bz2: true
|
2021-12-15 06:15:49 +00:00
|
|
|
|
|
|
|
- name: Set cache date
|
|
|
|
run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ${{ matrix.prefix }}
|
2022-01-29 08:43:34 +00:00
|
|
|
key: ${{ matrix.label }}-conda-${{ hashFiles('config/environment.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }}
|
2021-12-15 06:15:49 +00:00
|
|
|
env:
|
|
|
|
# Increase this value to reset cache if environment.yml has not changed
|
|
|
|
CACHE_NUMBER: 0
|
|
|
|
id: cache
|
|
|
|
|
|
|
|
- name: Update environment
|
2022-01-29 08:43:34 +00:00
|
|
|
run: mamba env update -n test -f config/environment.yml
|
2021-12-15 06:15:49 +00:00
|
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
|
|
|
2021-09-30 11:36:00 +00:00
|
|
|
- name: Run Pytest
|
2021-12-15 06:15:49 +00:00
|
|
|
shell: bash -l {0}
|
|
|
|
run: python -m pytest
|