-
Notifications
You must be signed in to change notification settings - Fork 1
/
action.yml
144 lines (127 loc) · 4.67 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: "compas-actions.build"
description: "Build and test COMPAS or its plugins."
inputs:
invoke_lint:
description: "Whether to test lint errors."
required: true
default: "false"
check_import:
description: "Whether to test with python -m compas."
required: true
default: "false"
invoke_test:
description: "Whether to run invoke test."
required: false
default: "true"
use_conda:
description: "Whether to build with conda."
required: false
default: "false"
python:
description: "which python version to build with."
required: true
default: "3.10"
build_ghpython_components:
description: "Whether to build Grasshopper components."
required: false
default: "false"
gh_source:
description: "The source path to build Grasshopper components"
required: false
default: "src/compas_ghpython/components"
gh_target:
description: "The target path to build Grasshopper components"
required: false
default: "src/compas_ghpython/components/ghuser"
gh_prefix:
description: "optional prefix added to the name of each generated Grasshopper component"
required: false
gh_interpreter:
description: "interpreter used to build Grasshopper components, either 'ironpython' or 'cpython'. Defaults to 'ironpython'"
required: false
default: "ironpython"
submodules:
description: "Whether to checkout submodules, value can be 'true', 'recursive', or 'false'"
required: false
default: "true"
runs:
using: "composite"
steps:
- uses: actions/checkout@v4
with:
submodules: ${{ inputs.submodules }}
if: runner.os != 'macOS' || inputs.python != '3.9'
# Build as PYPI package.
- if: inputs.use_conda == 'false' && (runner.os != 'macOS' || inputs.python != '3.9')
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python }}
- if: inputs.use_conda == 'false' && (runner.os != 'macOS' || inputs.python != '3.9')
shell: bash
run: |
echo "This is a PYPI package."
python -m pip install --upgrade pip
pip install -e ".[dev]"
if [[ ${{ inputs.invoke_lint }} == "true" ]]; then
invoke lint
fi;
if [[ ${{ inputs.check_import }} == "true" ]]; then
python -m compas
fi;
if [[ ${{ inputs.invoke_test }} == "true" ]]; then
invoke test
fi;
- uses: NuGet/[email protected]
if: inputs.build_ghpython_components == 'true' && (runner.os != 'macOS' || inputs.python != '3.9')
- shell: bash
if: inputs.build_ghpython_components == 'true' && (runner.os != 'macOS' || inputs.python != '3.9')
run: |
choco install ironpython --version=2.7.8.1
- name: 🦗 Build grasshopper components
uses: compas-dev/compas-actions.ghpython_components@v5
if: inputs.build_ghpython_components == 'true' && (runner.os != 'macOS' || inputs.python != '3.9')
with:
source: ${{ inputs.gh_source }}
target: ${{ inputs.gh_target }}
prefix: ${{ inputs.gh_prefix }}
interpreter: ${{ inputs.gh_interpreter }}
# Build as conda package.
- if: inputs.use_conda == 'true' && (runner.os != 'macOS' || inputs.python != '3.9')
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: latest
channels: conda-forge
activate-environment: compas
python-version: ${{ inputs.python }}
- if: inputs.use_conda == 'true' && (runner.os != 'macOS' || inputs.python != '3.9')
shell: bash -l {0}
run: |
echo "This is a conda package."
if [[ ${{ runner.os }} == "Windows" && -f env_win.yml ]]; then
echo using env_win.yml
conda env update -f env_win.yml -n compas
elif [[ ${{ runner.os }} == "macOS" && -f env_osx.yml ]]; then
echo using env_osx.yml
conda env update -f env_osx.yml -n compas
elif [[ ${{ runner.os }} == "Linux" && -f env_linux.yml ]]; then
echo using env_linux.yml
conda env update -f env_linux.yml -n compas
elif [[ -f environment.yml ]]; then
echo using environment.yml
conda env update -f environment.yml -n compas
else
echo ERROR: Failed find environment yml file.
exit 1
fi
if [[ ${{ inputs.invoke_lint }} = "true" ]]; then
invoke lint
fi;
if [[ ${{ inputs.check_import }} = "true" ]]; then
python -m compas
fi;
if [[ ${{ inputs.invoke_test }} = "true" ]]; then
invoke test
fi;
- if: runner.os == 'macOS' && inputs.python == '3.9'
shell: bash
run: echo "The test is skipped on macOS with Python 3.9."