Skip to content

Commit 299512a

Browse files
author
Aliaksandr Adziareika
committed
Rename build-bindings-* to package-bindings-*, add upload support
- Rename build-bindings-python to package-bindings-python - Rename build-bindings-csharp to package-bindings-csharp - Add package-artifact-name input to enable upload within action - Add package-artifact-retention-days input (default 7)
1 parent de9d01e commit 299512a

File tree

3 files changed

+54
-41
lines changed

3 files changed

+54
-41
lines changed

.github/actions/build-bindings-csharp/action.yml renamed to .github/actions/package-bindings-csharp/action.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build C# Bindings
1+
name: Package C# Bindings
22
description: Build .NET/C# bindings for openDAQ
33

44
inputs:
@@ -9,6 +9,14 @@ inputs:
99
description: 'Build type (Release/Debug)'
1010
required: false
1111
default: 'Release'
12+
package-artifact-name:
13+
description: 'Artifact name for uploading NuGet packages. If empty, no upload is performed'
14+
required: false
15+
default: ''
16+
package-artifact-retention-days:
17+
description: 'Number of days to retain the artifact'
18+
required: false
19+
default: '7'
1220

1321
outputs:
1422
nuget-path:
@@ -67,3 +75,13 @@ runs:
6775
else
6876
echo "nuget-path=$NUGET_PATH" >> $GITHUB_OUTPUT
6977
fi
78+
79+
- name: Upload C# Bindings
80+
if: inputs.package-artifact-name != ''
81+
uses: actions/upload-artifact@v4
82+
with:
83+
name: ${{ inputs.package-artifact-name }}
84+
path: |
85+
${{ steps.build.outputs.nuget-path }}
86+
!${{ steps.build.outputs.nuget-path }}/**/*.json
87+
retention-days: ${{ inputs.package-artifact-retention-days }}

.github/actions/build-bindings-python/action.yml renamed to .github/actions/package-bindings-python/action.yml

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build Python Wheels
1+
name: Package Python Bindings
22
description: Build Python wheels for multiple Python versions (requires prior CMake configuration)
33

44
inputs:
@@ -14,6 +14,14 @@ inputs:
1414
description: 'Build type (Release/Debug)'
1515
required: false
1616
default: 'Release'
17+
package-artifact-name:
18+
description: 'Artifact name for uploading wheels. If empty, no upload is performed'
19+
required: false
20+
default: ''
21+
package-artifact-retention-days:
22+
description: 'Number of days to retain the artifact'
23+
required: false
24+
default: '7'
1725

1826
outputs:
1927
wheels-path:
@@ -44,7 +52,7 @@ runs:
4452
env:
4553
CMAKE_BUILD_TYPE: ${{ inputs.cmake-build-type }}
4654
CMAKE_BUILD_PATH: ${{ inputs.build-path }}
47-
PYTHON_VERSION_BUILD: ${{ steps.python-setup.outputs.python-version }}
55+
PYTHON_VERSION_LATEST: ${{ steps.python-setup.outputs.python-version }}
4856
run: |
4957
if command -v cygpath &> /dev/null; then
5058
CMAKE_BUILD_PATH=$(cygpath -u "$CMAKE_BUILD_PATH")
@@ -66,7 +74,6 @@ runs:
6674
PYTHON_CMD="python"
6775
PYTHON_VENV_PATH="$CMAKE_BUILD_PATH/venv"
6876
PYTHON_VENV_ACTIVATE="$PYTHON_VENV_PATH/bin/activate"
69-
PYTHON_VERSION_BUILD=$(echo "$PYTHON_VERSION_BUILD" | cut -d. -f1,2)
7077
if [[ "$RUNNER_OS" == "Windows" ]]; then
7178
PYTHON_CMD="py -"
7279
PYTHON_VENV_ACTIVATE="$PYTHON_VENV_PATH/Scripts/activate"
@@ -85,7 +92,8 @@ runs:
8592
CMAKE_BUILD_ARGS="--config $CMAKE_BUILD_TYPE"
8693
fi
8794
88-
echo "Using Python $PYTHON_VERSION_BUILD for build_pip.py"
95+
PYTHON_VERSION_LATEST=$(echo "$PYTHON_VERSION_LATEST" | cut -d. -f1,2)
96+
echo "Using Python $PYTHON_VERSION_LATEST for build_pip.py"
8997
9098
while IFS= read -r version; do
9199
echo "::group::CMake Configure (Python $version)"
@@ -107,7 +115,7 @@ runs:
107115
pip install --quiet numpy pybind11-stubgen
108116
109117
# Build Python wheels (-r removes .pyd after packaging)
110-
${PYTHON_CMD}${PYTHON_VERSION_BUILD} bindings/python/package/build_pip.py -l "$BIN_PATH" -r
118+
${PYTHON_CMD}${PYTHON_VERSION_LATEST} bindings/python/package/build_pip.py -l "$BIN_PATH" -r
111119
112120
cp pip/packages/*.whl "$WHEELS_PATH/"
113121
@@ -118,3 +126,11 @@ runs:
118126
119127
echo "Built wheels:"
120128
ls -la "$WHEELS_PATH/"
129+
130+
- name: Upload Python Wheels
131+
if: inputs.package-artifact-name != ''
132+
uses: actions/upload-artifact@v4
133+
with:
134+
name: ${{ inputs.package-artifact-name }}
135+
path: ${{ steps.build-wheels.outputs.wheels-path }}
136+
retention-days: ${{ inputs.package-artifact-retention-days }}

.github/workflows/package-sandbox.yml

Lines changed: 14 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ jobs:
9696
# test_path: ''
9797
windows_x64_artifact_name: ${{ env.windows_x64_artifact }}
9898
# short_sha: ${{ env.short_sha }}
99-
short_sha_dotnet: ${{ steps.build-csharp-bindings.outputs.short-sha-dotnet }}
99+
short_sha_dotnet: ${{ steps.package-csharp-bindings.outputs.short-sha-dotnet }}
100100

101101
env:
102102
short_sha: 'package' # for .NET Bindings build
@@ -163,40 +163,25 @@ jobs:
163163
path: ${{ steps.build-sdk.outputs.package-path }}
164164
retention-days: 7
165165

166-
- name: Build Python Wheels
167-
id: build-python-bindings
166+
- name: Package Python Bindings
168167
if: matrix.generate-python-bindings == true
169-
uses: ./.github/actions/build-bindings-python
168+
uses: ./.github/actions/package-bindings-python
170169
with:
171170
python-versions: ${{ env.python_versions }}
172171
build-path: ${{ steps.build-sdk.outputs.build-path }}
173172
cmake-build-type: ${{ matrix.cmake-build-type }}
173+
package-artifact-name: Wheels (${{ matrix.name }})
174+
package-artifact-retention-days: 7
174175

175-
- name: Upload Python Wheels
176-
if: matrix.generate-python-bindings == true
177-
uses: actions/upload-artifact@v4
178-
with:
179-
name: Wheels (${{ matrix.name }})
180-
path: ${{ steps.build-python-bindings.outputs.wheels-path }}
181-
retention-days: 7
182-
183-
- name: Build C# Bindings
184-
id: build-csharp-bindings
176+
- name: Package C# Bindings
177+
id: package-csharp-bindings
185178
if: matrix.generate-csharp-bindings == true
186-
uses: ./.github/actions/build-bindings-csharp
179+
uses: ./.github/actions/package-bindings-csharp
187180
with:
188181
build-path: ${{ steps.build-sdk.outputs.build-path }}
189182
cmake-build-type: ${{ matrix.cmake-build-type }}
190-
191-
- name: Upload C# Bindings
192-
if: matrix.generate-csharp-bindings == true
193-
uses: actions/upload-artifact@v4
194-
with:
195-
name: ${{ env.windows_x64_artifact }}
196-
path: |
197-
${{ steps.build-csharp-bindings.outputs.nuget-path }}
198-
!${{ steps.build-csharp-bindings.outputs.nuget-path }}/**/*.json
199-
retention-days: 1
183+
package-artifact-name: ${{ env.windows_x64_artifact }}
184+
package-artifact-retention-days: 7
200185

201186
package_linux:
202187
runs-on: ${{ matrix.runner }}
@@ -484,20 +469,14 @@ jobs:
484469
generate-csharp-bindings: false
485470
generate-python-bindings: false
486471

487-
- name: Build Python Wheels
488-
id: build-python-bindings
489-
uses: ./.github/actions/build-bindings-python
472+
- name: Package Python Bindings
473+
uses: ./.github/actions/package-bindings-python
490474
with:
491475
python-versions: ${{ env.python_versions }}
492476
build-path: ${{ steps.build-sdk.outputs.build-path }}
493477
cmake-build-type: ${{ matrix.cmake-build-type }}
494-
495-
- name: Upload Python Wheels
496-
uses: actions/upload-artifact@v4
497-
with:
498-
name: Wheels (${{ matrix.name }})
499-
path: ${{ steps.build-python-bindings.outputs.wheels-path }}
500-
retention-days: 7
478+
package-artifact-name: Wheels (${{ matrix.name }})
479+
package-artifact-retention-days: 7
501480

502481
simulator-build:
503482
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)