2022-01-29 22:31:27 +01:00
|
|
|
name: test
|
2021-09-30 13:36:00 +02:00
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- 'master'
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- 'master'
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
test:
|
2021-12-15 07:15:49 +01:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- os: ubuntu-latest
|
|
|
|
label: linux-64
|
|
|
|
prefix: /usr/share/miniconda3/envs/test
|
2021-09-30 13:36:00 +02:00
|
|
|
|
2021-12-15 07:15:49 +01:00
|
|
|
name: ${{ matrix.label }}
|
|
|
|
runs-on: ${{ matrix.os }}
|
2021-09-30 13:36:00 +02:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2021-12-15 07:15:49 +01: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 13:36:00 +02:00
|
|
|
with:
|
2021-12-15 07:15:49 +01:00
|
|
|
miniforge-variant: Mambaforge
|
|
|
|
miniforge-version: latest
|
2021-09-30 13:36:00 +02:00
|
|
|
activate-environment: test
|
2021-12-15 07:15:49 +01:00
|
|
|
use-mamba: true
|
2022-01-29 09:43:34 +01:00
|
|
|
environment-file: config/environment.yml
|
2021-09-30 13:36:00 +02:00
|
|
|
python-version: 3.8
|
|
|
|
auto-activate-base: false
|
2021-10-03 10:04:14 +02:00
|
|
|
use-only-tar-bz2: true
|
2021-12-15 07:15:49 +01: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 09:43:34 +01:00
|
|
|
key: ${{ matrix.label }}-conda-${{ hashFiles('config/environment.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }}
|
2021-12-15 07:15:49 +01: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 09:43:34 +01:00
|
|
|
run: mamba env update -n test -f config/environment.yml
|
2021-12-15 07:15:49 +01:00
|
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
|
|
|
2021-09-30 13:36:00 +02:00
|
|
|
- name: Run Pytest
|
2021-12-15 07:15:49 +01:00
|
|
|
shell: bash -l {0}
|
|
|
|
run: python -m pytest
|