-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yaml
56 lines (56 loc) · 1.93 KB
/
action.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: "Setup Conda"
description: "Sets up a conda project that is not on the root level of a GitHub repository."
inputs:
path:
description: "Path to the conda project within the repository"
required: true
env-name:
description: "Name of the target conda environment"
required: true
miniconda-version:
description: "Version of miniconda to use"
required: false
default: py39_4.12.0
cache-number:
description: "Identifier for the cache in case it should be refreshed"
required: false
default: "0"
setup-miniconda:
description: "Install miniconda"
required: false
default: "false"
use-cache:
description: "Try to use the cache"
required: false
default: "false"
runs:
using: "composite"
steps:
- name: Setup miniconda
if: inputs.setup-miniconda == 'true'
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: ${{ inputs.env-name }}
miniconda-version: ${{ inputs.miniconda-version }}
- name: Get Date
if: inputs.use-cache == 'true'
id: get-date
run: echo "::set-output name=today::$(/bin/date -u '+%Y%m%d')"
shell: bash
- name: Cache Conda env
if: inputs.use-cache == 'true'
uses: actions/cache@v3
with:
path: ${{ env.CONDA }}/envs
key: conda-${{ runner.os }}--${{ runner.arch }}--${{ steps.get-date.outputs.today }}-${{ hashFiles(format('{0}/env.yml', env.FOLDER )) }}-${{ env.CACHE_NUMBER }}
env:
# Increase this value to reset cache if etc/example-environment.yml has not changed
CACHE_NUMBER: ${{ inputs.cache-number }}
FOLDER: ${{ inputs.path }}
id: cached-conda-dependencies
- name: Install dependencies for image_analysis
if: inputs.use-cache != 'true' || steps.cached-conda-dependencies.outputs.cache-hit != 'true'
run: conda env update -f ${FOLDER}/env.yml
shell: bash
env:
FOLDER: ${{ inputs.path }}