name: test on: pull_request: branches: - 'master' paths: - src/** - tests/** - config/** - .github/workflows/test.yml push: branches: - 'master' paths: - src/** - tests/** - config/** - .github/workflows/test.yml jobs: test: strategy: matrix: include: - os: ubuntu-latest label: linux-64 prefix: /usr/share/miniconda3/envs/test name: ${{ matrix.label }} runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 - 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 with: miniforge-variant: Mambaforge miniforge-version: latest activate-environment: test use-mamba: true environment-file: config/environment.yml python-version: 3.8 auto-activate-base: false use-only-tar-bz2: true - 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('config/environment.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }} env: # Increase this value to reset cache if environment.yml has not changed CACHE_NUMBER: 0 id: cache - name: Update environment run: mamba env update -n test -f config/environment.yml if: steps.cache.outputs.cache-hit != 'true' - name: Run Pytest shell: bash -l {0} run: python -m pytest