-
Notifications
You must be signed in to change notification settings - Fork 2
/
action.yml
84 lines (72 loc) · 2.09 KB
/
action.yml
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Setup Cylc
description: Install Cylc.
inputs:
cylc_version:
description: 'The Cylc version to install (or an abbreviation e.g. 8 to pick up the latest version).'
default: '8'
cylc_rose:
description: 'Install cylc-rose?'
default: false
runs:
using: composite
steps:
# check if micromamba is already installed
- name: Check Mamba
id: check_mamba
continue-on-error: true
shell: bash
run: micromamba --version
# install micromamba if necessary
- name: Install Mamba
if: steps.check_mamba.outcome == 'failure'
uses: mamba-org/setup-micromamba@v1
with:
init-shell: bash
post-cleanup: 'all'
# install cylc (and cylc-rose if requested) into a mamba environment
- name: Install Cylc
shell: bash
run: |
# write env file
cat > cylc_env.yml <<__ENV__
name: cylc
channels:
- conda-forge
dependencies:
- cylc-flow-base=${{ inputs.cylc_version }}
__ENV__
# install cylc-rose?
if ${{ inputs.cylc_rose }}; then
echo ' - cylc-rose' >> cylc_env.yml
fi
# create environment
micromamba env create -y --file=cylc_env.yml
rm cylc_env.yml
# create required wrapper scripts
- name: Install Wrapper
shell: bash -el {0}
run: |
# create a temp dir for wrapper scripts
cd $(mktemp -d)
# determine which wrappers to create
micromamba activate cylc
wrappers=(cylc isodatetime)
if ${{ inputs.cylc_rose }}; then
wrappers+=(rose)
fi
# create a wrapper for each command in the temp dir
for wrapper in "${wrappers[@]}"; do
EXE="$(command -v "$wrapper")"
cat > "$wrapper" <<__WRAPPER__
#!/usr/bin/env bash
exec "${EXE}" "\$@"
__WRAPPER__
chmod +x "$wrapper"
done
# add the temp dir to $PATH for future steps
echo "$PWD" >> $GITHUB_PATH
# check the install worked
- name: Test
shell: bash
run: |
cylc version