From 7761e63fa393cb9bd2d0bbd1d051839dd249ff43 Mon Sep 17 00:00:00 2001
From: Redmar van den Berg <RedmarvandenBerg@lumc.nl>
Date: Wed, 10 Mar 2021 16:32:14 +0100
Subject: [PATCH] Add conda cache

---
 .github/workflows/ci.yml | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 3b63ee6..8c1a6ce 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -18,16 +18,31 @@ jobs:
     steps:
     - uses: actions/checkout@v2
 
-    - uses: eWaterCycle/setup-singularity@v6
+    - name: Install singularity
+      uses: eWaterCycle/setup-singularity@v6
       with:
         singularity-version: 3.6.4
 
-    - uses: conda-incubator/setup-miniconda@v2.0.1
+    - name: Cache conda environment
+      uses: actions/cache@v2
+      env:
+        cache-name: cache-conda-environment
+        # Increase this value to reset the cache without changing
+        # environment.yml
+        cache-number: 0
+        with:
+          path: ~/conda_pkgs_dir
+          key: build-${{ env.cache-name }}-${{ env.cache-number }}-{{ hashFiles('environment.yml') }}
+
+    - name: Install miniconda
+      uses: conda-incubator/setup-miniconda@v2.0.1
       # https://github.com/conda-incubator/setup-miniconda.
+      # https://github.com/marketplace/actions/setup-miniconda
       with:
         activate-environment: hutspot
         environment-file: environment.yml
         auto-activate-base: false
+        use-only-tar-bz2: true
 
     - name: Run test in conda evironment
       # Use --symlink to limit disk usage.
@@ -54,7 +69,7 @@ jobs:
       if: ${{ failure() }}
       run: >-
         bash -c '
-        for file in $(find /tmp/pytest_workflow_*/log/ -type f); do
+        for file in $(find /tmp/pytest_workflow_*/${{ matrix.test}}/log/ -type f); do
           echo $file; cat $file
         done
         '
-- 
GitLab