Skip to content

actions: search for pylon install on windows #313

actions: search for pylon install on windows

actions: search for pylon install on windows #313

Workflow file for this run

name: Build pypylon
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches:
- '**'
tags:
- '*.*.*'
pull_request:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
TWINE_USERNAME: __token__
# Uncomment the relevant lines to switch between deployment to test.pypi.org or pypi.org
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
# TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/
# TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
jobs:
setup:
runs-on: ubuntu-latest
outputs:
is_release_build: ${{ env.RELEASE_BUILD == '1' }}
steps:
- uses: jfrog/setup-jfrog-cli@v4
env:
JF_URL: ${{ secrets.SDK_URL }}
JF_ACCESS_TOKEN: ${{ secrets.SDK_TOKEN }}
with:
disable-auto-build-publish: true
disable-job-summary: true
- name: Checkout repository
uses: actions/checkout@v4
# login
- run: |
jf c add --url=$JF_URL --access-token=$JF_ACCESS_TOKEN --interactive=false
# download
- name: Download files from Artifactory
id: get_sdks
run: |
set +x
set -e
build_config=$(cat .github/workflows/build_config.json)
for os in $(echo $build_config | jq -r 'keys[]'); do
for pylon_sdk in $(echo $build_config | jq -r --arg os "$os" '.[$os].pylon_sdks[]'); do
if [[ $os == "windows" || $os == "macos" ]]; then
jf rt dl --flat --props "pylon_os=${os,,};pylon_version=$pylon_sdk" "pylon-sdks-generic/*" ./${os,,}_sdk/
elif [[ $os == "linux-x86_64" ]]; then
jf rt dl --flat --props "pylon_architecture=x86_64;pylon_os=linux;pylon_version=$pylon_sdk" "pylon-sdks-generic/*" ./linux_x86_64_sdk/
elif [[ $os == "linux-aarch64" ]]; then
jf rt dl --flat --props "pylon_architecture=aarch64;pylon_os=linux;pylon_version=$pylon_sdk" "pylon-sdks-generic/*" ./linux_aarch64_sdk/
fi
done
done
- name: Upload Pylon SDK for Linux aarch64
uses: actions/upload-artifact@v4
with:
name: Linux_aarch64_Pylon
path: linux_aarch64_sdk
- name: Upload Pylon SDK for Linux x86_64
uses: actions/upload-artifact@v4
with:
name: Linux_x86_64_Pylon
path: linux_x86_64_sdk
- name: Upload Pylon SDK for Windows
uses: actions/upload-artifact@v4
with:
name: Windows_Pylon
path: windows_sdk
- name: Upload Pylon SDK for macOS
uses: actions/upload-artifact@v4
with:
name: macOS_Pylon
path: macos_sdk
- name: Check for release build
if: startsWith(github.ref, 'refs/tags/')
run: |
echo "Build release for $GITHUB_REF"
echo "RELEASE_BUILD=1" >> $GITHUB_ENV
build-linux:
needs: setup
strategy:
fail-fast: false
matrix:
os: [ ubuntu-24.04, ubuntu-24.04-arm ]
a: [cp39]
p: [manylinux_2_31_x86_64, manylinux_2_31_aarch64]
exclude:
# Exclude manylinux_2_31_aarch64 on ubuntu-24.04
- os: ubuntu-24.04
p: manylinux_2_31_aarch64
# Exclude manylinux_2_31_x86_64 on ubuntu-24.04-arm
- os: ubuntu-24.04-arm
p: manylinux_2_31_x86_64
runs-on: ${{ matrix.os }}
env:
P: ${{ matrix.p }}
A: ${{ matrix.a }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
with:
fetch-depth: 0
# download the pylon sdks
- name: download linux artifacts
uses: actions/download-artifact@v4
with:
pattern: Linux*Pylon
merge-multiple: true
path: pylon-installer
- name: Display Structure of downloaded files
run: ls -R pylon-installer
- name: Build with docker
run: |
pwd
ls
ls pylon-installer
./scripts/build/build-arch.sh --platform-tag $P --abi-tag $A --pylon-dir ./pylon-installer $ARGS
- uses: actions/upload-artifact@v4
with:
name: build-results-${{ matrix.p }}-${{ matrix.a }}
path: dist/*
- name: Upload Release Asset
if: needs.setup.outputs.is_release_build == 'true'
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: dist/*
- name: Publish package to (Test)PyPI
if: needs.setup.outputs.is_release_build == 'true' && startsWith( matrix.p, 'manylinux' )
run: |
sudo pip3 install "twine==6.0.1"
python3 -m twine upload --non-interactive --skip-existing dist/*
build-windows:
needs: setup
runs-on: windows-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.9"
- uses: actions/download-artifact@v4
with:
name: Windows_Pylon
path: pylon-installer
- name: Display Structure of downloaded files
run: dir pylon-installer
- name: Setup pylon
run: |
cd pylon-installer
ren Basler-pylon-*.exe Basler-pylon.exe
$process = Start-Process Basler-pylon.exe -Wait -ArgumentList '/quiet /install=GigE_Runtime;USB_Runtime;Camera_Link_Runtime;GenTL_Consumer_Support;CamEmu_Support;SDKs;DataProcessing_SDK;DataProcessing_vTools;DataProcessing_AI' -PassThru
Write-Host "Process finished with return code:" $process.ExitCode
- name: Set PYLON_DEV_DIR environment variable
run: |
# Find the pylon installation directory - check multiple possible locations
$possiblePaths = @(
"C:\Program Files\Basler",
"D:\Program Files\Basler",
"C:\Program Files (x86)\Basler",
"D:\Program Files (x86)\Basler"
)
$pylonDir = $null
foreach ($basePath in $possiblePaths) {
if (Test-Path $basePath) {
Write-Host "Checking for pylon in: $basePath"
$pylonDirs = Get-ChildItem -Path $basePath -Directory -Filter "pylon*" -ErrorAction SilentlyContinue | Sort-Object Name -Descending
if ($pylonDirs.Count -gt 0) {
$pylonDirName = $pylonDirs[0].Name
$candidateDir = Join-Path $basePath $pylonDirName "Development"
Write-Host "Found pylon candidate at: $candidateDir (from directory: $pylonDirName)"
# Verify this is a valid pylon SDK installation
if (Test-Path "$candidateDir\include\pylon\PylonIncludes.h") {
$pylonDir = $candidateDir
Write-Host "Valid pylon SDK found at: $pylonDir"
break
} else {
Write-Host "Invalid pylon SDK structure at: $candidateDir"
# Let's also check what's actually in the directory for debugging
if (Test-Path $candidateDir) {
Write-Host "Directory exists but missing PylonIncludes.h. Contents:"
Get-ChildItem -Path $candidateDir -ErrorAction SilentlyContinue | ForEach-Object { Write-Host " - $($_.Name)" }
} else {
Write-Host "Directory does not exist: $candidateDir"
}
}
}
}
}
if ($pylonDir) {
# Set environment variable for current session
$env:PYLON_DEV_DIR = $pylonDir
# Set environment variable for subsequent steps
echo "PYLON_DEV_DIR=$pylonDir" >> $env:GITHUB_ENV
Write-Host "PYLON_DEV_DIR set to: $pylonDir"
# Show some additional info about the installation
$pylonVersion = Split-Path (Split-Path $pylonDir -Parent) -Leaf
Write-Host "Pylon version directory: $pylonVersion"
} else {
Write-Host "Error: No valid pylon installation found in any of the checked locations:"
foreach ($path in $possiblePaths) {
Write-Host " - $path"
if (Test-Path $path) {
Write-Host " Exists, contains:"
Get-ChildItem -Path $path -Directory -ErrorAction SilentlyContinue | ForEach-Object { Write-Host " - $($_.Name)" }
} else {
Write-Host " Does not exist"
}
}
exit 1
}
- name: Build wheels
uses: pypa/cibuildwheel@v2.21.3
- uses: actions/upload-artifact@v4
with:
name: build-results-windows
path: ./wheelhouse/*.whl
- name: Upload Release Asset
if: needs.setup.outputs.is_release_build == 'true'
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: ./wheelhouse/*.whl
- name: Publish package to (Test)PyPI
if: needs.setup.outputs.is_release_build == 'true'
run: |
python -m pip install twine
python -m twine upload --non-interactive --skip-existing wheelhouse\\*
shell: cmd
build-macos:
needs: setup
runs-on: macos-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.9"
- uses: actions/download-artifact@v4
with:
name: macOS_Pylon
path: pylon-installer
- name: Setup pylon
run: |
# install universal
cd pylon-installer
hdiutil attach pylon-*.dmg
sudo installer -pkg /Volumes/pylon\ *\ Software\ Suite/pylon-*.pkg -target /
hdiutil detach /Volumes/pylon\ *\ Software\ Suite
- name: Build wheels
uses: pypa/cibuildwheel@v2.21.3
env:
PYLON_FRAMEWORK_ARM64: /Library/Frameworks
PYLON_FRAMEWORK_X86_64: /Library/Frameworks
- uses: actions/upload-artifact@v4
with:
name: build-results-macos
path: ./wheelhouse/*.whl
- name: Upload Release Asset
if: needs.setup.outputs.is_release_build == 'true'
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: ./wheelhouse/*.whl
- name: Publish package to (Test)PyPI
if: needs.setup.outputs.is_release_build == 'true'
run: |
sudo pip3 install twine
python3 -m twine upload --non-interactive --skip-existing wheelhouse/*
cleanup:
if: always()
needs: [
setup,
build-linux,
build-macos,
build-windows
]
runs-on: ubuntu-latest
steps:
- uses: geekyeggo/delete-artifact@v5
continue-on-error: true
with:
name: |
Linux_x86_64_Pylon
Linux_aarch64_Pylon
Windows_Pylon
macOS_Pylon
unit-tests:
if: success()
needs: cleanup
strategy:
fail-fast: false
matrix:
os: [ ubuntu-24.04, ubuntu-24.04-arm, macos-14, windows-latest ]
python-version: [ '3.9', '3.10', '3.11', '3.12', '3.13' ]
architecture: [ x64, arm64 ]
exclude:
# Exclude ARM64 architecture for windows-latest
- os: windows-latest
architecture: arm64
# Exclude ARM64 architecture for ubuntu-24.04
- os: ubuntu-24.04
architecture: arm64
# Exclude X64 architecture for ubuntu-24.04-arm
- os: ubuntu-24.04-arm
architecture: x64
# Exclude python 3.9 - 3.10 on macOS x86_64 due too issues with the runner image
# See also GitHub issue: https://github.com/actions/setup-python/issues/825
- os: macos-14
architecture: x64
python-version: 3.9
- os: macos-14
architecture: x64
python-version: 3.10
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v2
- uses: dkershner6/switch-case-action@v1
id: pypylon-wheel-source
with:
default: "build-results-unknown"
conditionals-with-values: |
${{ runner.os == 'Linux' && matrix.architecture == 'arm64' }} => build-results-manylinux_2_31_aarch64-cp39
${{ runner.os == 'Linux' && matrix.architecture == 'x64' }} => build-results-manylinux_2_31_x86_64-cp39
${{ runner.os == 'Windows' }} => build-results-windows
${{ runner.os == 'macOS' }} => build-results-macos
- name: Download pypylon wheels
uses: actions/download-artifact@v4
with:
name: ${{ steps.pypylon-wheel-source.outputs.value }}
path: pypylon-wheels
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.architecture }}
- name: Set up needed linux requirements
if: runner.os == 'Linux'
run: |
sudo apt-get update && sudo apt-get install -y locales
sudo sed -i 's/^# *\(fr_FR.UTF-8\)/\1/' /etc/locale.gen
sudo locale-gen
- name: Run pypylon unit tests for Python ${{ matrix.python-version }}
if: runner.os != 'macOS'
run: |
python -m pip install --upgrade pip
pip install pytest numpy
pip install --no-index --find-links pypylon-wheels pypylon
pytest tests/genicam_tests tests/pylon_tests/emulated tests/pylondataprocessing_tests
- uses: dkershner6/switch-case-action@v1
if: runner.os == 'macOS'
id: pypylon-macos-arch
with:
default: "unknown"
conditionals-with-values: |
${{ matrix.architecture == 'arm64' }} => arm64
${{ matrix.architecture == 'x64' }} => x86_64
- name: Run pypylon unit tests for Python ${{ matrix.python-version }} without pylon Data Processing
if: runner.os == 'macOS'
run: |
arch -${{ steps.pypylon-macos-arch.outputs.value }} python -m pip install --upgrade pip
arch -${{ steps.pypylon-macos-arch.outputs.value }} pip install pytest numpy
arch -${{ steps.pypylon-macos-arch.outputs.value }} pip install --no-index --find-links pypylon-wheels pypylon
arch -${{ steps.pypylon-macos-arch.outputs.value }} pytest tests/genicam_tests tests/pylon_tests/emulated