-
Notifications
You must be signed in to change notification settings - Fork 11
/
action.yaml
90 lines (80 loc) · 3.57 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
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
85
86
87
88
89
90
name: Setup Nextstrain CLI
description: >-
This GitHub Actions action is intended to be called by workflows in our other
repos when they need a working copy of the Nextstrain CLI (the `nextstrain`
program) installed and don't particularly care about the exact Python
environment in which its installed.
For example, this is typically the case when the workflow's primary step
invokes `nextstrain build` to run a build in a container runtime (locally via
Docker or remotely via AWS Batch). Workflows that are more complex (e.g.
have additional dependencies to install, care about Conda, etc.) should
probably continue to install the Nextstrain CLI themselves for now.
inputs:
cli-version:
description: >-
Version of Nextstrain CLI to install, as a dependency version spec
understood by Pip (i.e. conforming to PEP-0508, e.g. >3.2 or ==3.2.4).
Defaults to none, which means the latest version available will be
installed.
type: string
default: ""
required: false
runtime:
description: >-
Nextstrain runtime to configure and set as the default, as a string
understood by `nextstrain setup`. Defaults to "docker" on Linux and
"conda" on macOS (where, on GitHub Actions, Docker isn't supported). On
Windows, no runtime is set up by default: GitHub Actions runners can't run
Linux containers via WSL2 and our Conda runtime doesn't support Windows.
type: string
default: ${{ runner.os == 'Linux' && 'docker' || runner.os == 'macOS' && 'conda' || '' }}
required: false
# XXX TODO: Remove this in coordination with existing callers. Callers must
# stop specifying it before we remove it here in order to not break. I've
# audited all of our internal usages¹ of this action to check that they don't
# rely on the setup-python call and prepped those usages for the removal of
# this input. There are also many external usages², mostly existing in forks
# of our repos.
# -trs, 13 Feb 2024
#
# ¹ <https://github.com/search?q=org%3Anextstrain+%2Fsetup-nextstrain-cli%40master%2F+%28path%3A*.yaml+OR+path%3A*.yml%29&type=code&p=1>
# ² <https://github.com/search?q=%28NOT+org%3Anextstrain%29+%2Fsetup-nextstrain-cli%40master%2F+%28path%3A*.yaml+OR+path%3A*.yml%29&type=code&p=1>
#
python-version:
description: >-
Do not use. Deprecated and retained (for now) only for backwards
compatibility with existing callers. Will be removed in the future, at
which point any callers that still specify a value will break.
type: string
default: ""
required: false
runs:
using: composite
steps:
- if: runner.os != 'Windows'
run: |
curl -fsSL --proto '=https' https://nextstrain.org/cli/installer/"$OS" | bash
env:
OS: ${{ runner.os == 'Linux' && 'linux' || runner.os == 'macOS' && 'mac' || '' }}
VERSION: ${{ inputs.cli-version }}
DESTINATION: ${{ runner.temp }}/nextstrain-cli
shell: bash
- if: runner.os == 'Windows'
run: Invoke-RestMethod https://nextstrain.org/cli/installer/windows | Invoke-Expression
env:
VERSION: ${{ inputs.cli-version }}
DESTINATION: ${{ runner.temp }}/nextstrain-cli
shell: pwsh
- run: echo "$DESTINATION" | tee -a "$GITHUB_PATH"
env:
DESTINATION: ${{ runner.temp }}/nextstrain-cli
shell: bash
- run: nextstrain version
shell: bash
- if: inputs.runtime
run: nextstrain setup --set-default "$runtime"
shell: bash
env:
runtime: ${{ inputs.runtime }}
- run: nextstrain version --verbose
shell: bash