@@ -15,9 +15,13 @@ inputs:
1515 required : false
1616 default : " true"
1717 use_conda :
18- description : " Whether to build with conda."
18+ description : " DEPRECATED: use 'management_tool: conda' instead. Whether to build with conda."
1919 required : false
20- default : " false"
20+ default : " unset"
21+ management_tool :
22+ description : " Which project and dependency management tool to use. Can be 'conda', 'uv' or '' (none). Defaults to none."
23+ required : false
24+ default : " "
2125 python :
2226 description : " which python version to build with."
2327 required : true
@@ -57,84 +61,116 @@ inputs:
5761runs :
5862 using : " composite"
5963 steps :
60- - uses : actions/checkout@v4
64+ - name : Prepare workflow
65+ id : compat
66+ shell : bash
67+ run : |
68+ # Handle deprecated 'use_conda' input
69+ MANAGEMENT_TOOL="${{ inputs.management_tool }}"
70+ if [[ "${{ inputs.use_conda }}" != "unset" ]]; then
71+ echo "::warning::The 'use_conda' input is deprecated and will be removed in a future version. Use 'management_tool: conda' instead."
72+ if [[ "${{ inputs.use_conda }}" == "true" ]]; then
73+ MANAGEMENT_TOOL="conda"
74+ fi
75+ fi
76+ echo "management_tool=$MANAGEMENT_TOOL" >> "$GITHUB_OUTPUT"
77+
78+ # Handle skip test for certain environments
79+ if [[ "${{ runner.os }}" == "macOS" && "${{ inputs.python }}" == "3.9" ]]; then
80+ echo "skip=true" >> "$GITHUB_OUTPUT"
81+ else
82+ echo "skip=false" >> "$GITHUB_OUTPUT"
83+ fi
84+
85+ - uses : actions/checkout@v6
86+ if : steps.compat.outputs.skip == 'false'
6187 with :
6288 submodules : ${{ inputs.submodules }}
63- if : runner.os != 'macOS' || inputs.python != '3.9'
6489
65- # Build as PYPI package.
66- - if : inputs.use_conda == 'false' && (runner.os != 'macOS' || inputs.python != '3.9')
67- uses : actions/setup-python@v5
90+ # Management tool: none and uv
91+ # NOTE: We install Python even for uv as we require a system-wide binary
92+ - uses : actions/setup-python@v6
93+ if : steps.compat.outputs.management_tool != 'conda' && steps.compat.outputs.skip == 'false'
6894 with :
6995 python-version : ${{ inputs.python }}
7096
71- - if : inputs.use_conda == 'false' && (runner.os != 'macOS' || inputs.python != '3.9')
97+ # Management tool: uv
98+ - uses : astral-sh/setup-uv@v8.2.0
99+ if : steps.compat.outputs.management_tool == 'uv' && steps.compat.outputs.skip == 'false'
100+
101+ - if : steps.compat.outputs.management_tool != 'conda' && steps.compat.outputs.skip == 'false'
72102 shell : bash
73103 env :
74104 EXTRAS : ${{ inputs.extras }}
75105 run : |
76- echo "This is a PYPI package."
77- python -m pip install --upgrade pip
106+ if [[ "${{ steps.compat.outputs.management_tool }}" == "uv" ]]; then
107+ echo "This is a PYPI package (installed with uv)."
108+ PIP_INSTALL="uv pip install --system"
109+ else
110+ echo "This is a PYPI package."
111+ python -m pip install --upgrade pip
112+ PIP_INSTALL="pip install"
113+ fi
78114
79115 if [[ -n "$EXTRAS" ]]; then
80- pip install -e ".[$EXTRAS]"
116+ $PIP_INSTALL -e ".[$EXTRAS]"
81117 fi
82118
83- if [[ ${{ inputs.run_prebuild }} = "true" ]]; then
119+ if [[ " ${{ inputs.run_prebuild }}" = "true" ]]; then
84120 echo Running pre-build task
85121 invoke pre-build
86122 fi;
87123
88- if [[ ${{ inputs.invoke_lint }} == "true" ]]; then
124+ if [[ " ${{ inputs.invoke_lint }}" == "true" ]]; then
89125 invoke lint
90126 fi;
91127
92- if [[ ${{ inputs.check_import }} == "true" ]]; then
128+ if [[ " ${{ inputs.check_import }}" == "true" ]]; then
93129 python -m compas
94130 fi;
95131
96- if [[ ${{ inputs.invoke_test }} == "true" ]]; then
132+ if [[ " ${{ inputs.invoke_test }}" == "true" ]]; then
97133 invoke test
98134 fi;
99135
100- - uses : NuGet/setup-nuget@v1.0.5
101- if : inputs.build_ghpython_components == 'true' && (runner.os != 'macOS' || inputs.python != '3.9')
136+ - uses : NuGet/setup-nuget@v4.0
137+ if : inputs.build_ghpython_components == 'true' && steps.compat.outputs.skip == 'false'
102138
103139 - shell : bash
104- if : inputs.build_ghpython_components == 'true' && (runner.os != 'macOS' || inputs.python != '3.9')
140+ if : inputs.build_ghpython_components == 'true' && steps.compat.outputs.skip == 'false'
105141 run : |
106142 choco install ironpython --version=2.7.8.1
107143
108144 - name : 🦗 Build grasshopper components
109145 uses : compas-dev/compas-actions.ghpython_components@v5
110- if : inputs.build_ghpython_components == 'true' && (runner.os != 'macOS' || inputs.python != '3.9')
146+ if : inputs.build_ghpython_components == 'true' && steps.compat.outputs.skip == 'false'
111147 with :
112148 source : ${{ inputs.gh_source }}
113149 target : ${{ inputs.gh_target }}
114150 prefix : ${{ inputs.gh_prefix }}
115151 interpreter : ${{ inputs.gh_interpreter }}
116152
117153 # Build as conda package.
118- - if : inputs.use_conda == 'true ' && (runner.os != 'macOS' || inputs.python != '3.9')
119- uses : conda-incubator/setup-miniconda@v2
154+ - if : steps.compat.outputs.management_tool == 'conda ' && steps.compat.outputs.skip == 'false'
155+ uses : conda-incubator/setup-miniconda@v4
120156 with :
121157 miniconda-version : latest
122158 channels : conda-forge
123159 activate-environment : compas
124160 python-version : ${{ inputs.python }}
125161
126- - if : inputs.use_conda == 'true ' && (runner.os != 'macOS' || inputs.python != '3.9')
162+ - if : steps.compat.outputs.management_tool == 'conda ' && steps.compat.outputs.skip == 'false'
127163 shell : bash -l {0}
128164 run : |
129165 echo "This is a conda package."
130166
131- if [[ ${{ runner.os }} == "Windows" && -f env_win.yml ]]; then
167+ if [[ " ${{ runner.os }}" == "Windows" && -f env_win.yml ]]; then
132168 echo using env_win.yml
133169 conda env update -f env_win.yml -n compas
134- elif [[ ${{ runner.os }} == "macOS" && -f env_osx.yml ]]; then
170+ elif [[ " ${{ runner.os }}" == "macOS" && -f env_osx.yml ]]; then
135171 echo using env_osx.yml
136172 conda env update -f env_osx.yml -n compas
137- elif [[ ${{ runner.os }} == "Linux" && -f env_linux.yml ]]; then
173+ elif [[ " ${{ runner.os }}" == "Linux" && -f env_linux.yml ]]; then
138174 echo using env_linux.yml
139175 conda env update -f env_linux.yml -n compas
140176 elif [[ -f environment.yml ]]; then
@@ -145,23 +181,23 @@ runs:
145181 exit 1
146182 fi
147183
148- if [[ ${{ inputs.run_prebuild }} = "true" ]]; then
184+ if [[ " ${{ inputs.run_prebuild }}" = "true" ]]; then
149185 echo Running pre-build task
150186 invoke pre-build
151187 fi;
152188
153- if [[ ${{ inputs.invoke_lint }} = "true" ]]; then
189+ if [[ " ${{ inputs.invoke_lint }}" = "true" ]]; then
154190 invoke lint
155191 fi;
156192
157- if [[ ${{ inputs.check_import }} = "true" ]]; then
193+ if [[ " ${{ inputs.check_import }}" = "true" ]]; then
158194 python -m compas
159195 fi;
160196
161- if [[ ${{ inputs.invoke_test }} = "true" ]]; then
197+ if [[ " ${{ inputs.invoke_test }}" = "true" ]]; then
162198 invoke test
163199 fi;
164200
165- - if : runner.os == 'macOS' && inputs.python == '3.9 '
201+ - if : steps.compat.outputs.skip == 'true '
166202 shell : bash
167203 run : echo "The test is skipped on macOS with Python 3.9."
0 commit comments