Skip to content

Commit

Permalink
update sdk download
Browse files Browse the repository at this point in the history
  • Loading branch information
thiesmoeller committed Jun 14, 2024
1 parent d0e6136 commit 5530304
Show file tree
Hide file tree
Showing 2 changed files with 134 additions and 69 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/build_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"linux-x86_64": {
"pylon_sdks": ["7.5.0.15658"]
},
"linux-aarch64": {
"pylon_sdks": ["7.5.0.15658"]
},
"linux-armhf": {
"pylon_sdks": ["6.2.0.21487"]
},
"windows": {
"pylon_sdks": ["7.5.0.15658"]
},
"macos": {
"pylon_sdks": ["7.3.1.0011"]
}
}
186 changes: 117 additions & 69 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# This is a basic workflow to help you get started with Actions
name: build
name: Build pypylon

# Controls when the action will run.
on:
Expand All @@ -23,60 +22,85 @@ env:
# TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}

jobs:
prepare:
runs-on: ubuntu-22.04
outputs:
is_release_build: ${{ env.RELEASE_BUILD == '1' }}
setup:
runs-on: ubuntu-latest
steps:
- name: Installer list
run: |
tee pylon-installer.txt <<"EOF"
${PYLON_DOWNLOAD_URL_BASE_7_4}pylon_7.4.0.14900_linux_x86_64_setup.tar.gz
${PYLON_DOWNLOAD_URL_BASE_7_4}pylon_7.4.0.14900_linux_aarch64_setup.tar.gz
${PYLON_DOWNLOAD_URL_BASE}pylon_6.2.0.21487_armhf_setup.tar.gz
${PYLON_DOWNLOAD_URL_BASE}pylon_7_3_1_0011.dmg
${PYLON_DOWNLOAD_URL_BASE}basler_pylon_7_4_0_14900.exe
EOF
- uses: actions/cache@v3
id: cache
with:
path: pylon-installer
key: pylon-installer-${{ hashFiles('pylon-installer.txt') }}
- uses: jfrog/setup-jfrog-cli@v3
env:
JF_URL: ${{ secrets.SDK_URL }}
JF_ACCESS_TOKEN: ${{ secrets.SDK_TOKEN }}

- name: Checkout repository
uses: actions/checkout@v2

# 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/
elif [[ $os == "linux-armhf" ]]; then
jf rt dl --flat --props "pylon_architecture=armhf;pylon_os=linux;pylon_version=$pylon_sdk" "pylon-sdks-generic/*" ./linux_armhf_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 armhf
uses: actions/upload-artifact@v4
with:
name: Linux_armhf_Pylon
path: linux_armhf_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: Fetch installers
if: steps.cache.outputs.cache-hit != 'true'
env:
PYLON_DOWNLOAD_URL_BASE: ${{ secrets.PYLON_DOWNLOAD_URL_BASE }}
PYLON_DOWNLOAD_URL_BASE_6_2: ${{ secrets.PYLON_DOWNLOAD_URL_BASE_6_2 }}
PYLON_DOWNLOAD_URL_BASE_6_3: ${{ secrets.PYLON_DOWNLOAD_URL_BASE_6_3 }}
PYLON_DOWNLOAD_URL_BASE_7_4: ${{ secrets.PYLON_DOWNLOAD_URL_BASE_7_4 }}
PYLON_DOWNLOAD_ARM64_URL_BASE: ${{ secrets.PYLON_DOWNLOAD_ARM64_URL_BASE }}
run: |
mkdir pylon-installer && cd pylon-installer
while read line; do
url=$(eval echo "$line")
echo "download $url"
curl -sSfL -O "$url"
done <../pylon-installer.txt
echo "Download result"
ls -l
md5sum *
- name: Upload Pylon SDK for Windows
uses: actions/upload-artifact@v4
with:
name: Windows_Pylon
path: windows_sdk

- uses: actions/upload-artifact@v3
with:
name: pylon-installer
path: pylon-installer
- 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
- name: Check for release build
id: check_release_build
if: startsWith(github.ref, 'refs/tags/')
run: |
echo "Build release for $GITHUB_REF"
echo "release_build=1" >> $GITHUB_OUTPUT
outputs:
is_release_build: ${{ steps.check_release_build.outputs.env.release_build == '1' }}

build-linux:
needs: prepare
runs-on: ubuntu-22.04
needs: setup
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
Expand All @@ -94,11 +118,26 @@ jobs:
with:
fetch-depth: 0

- uses: actions/download-artifact@v3
# download the pylon sdks
- name: download x86_64
uses: actions/download-artifact@v4
with:
name: pylon-installer
name: Linux_x86_64_Pylon
path: pylon-installer

- name: download aarch64
uses: actions/download-artifact@v4
with:
name: Linux_aarch64_Pylon
path: pylon-installer

- name: download armhf
uses: actions/download-artifact@v4
with:
name: Linux_armhf_Pylon
path: pylon-installer


- name: Build with docker
run: |
pwd
Expand All @@ -107,29 +146,30 @@ jobs:
docker run --rm --privileged multiarch/qemu-user-static:register --reset
./scripts/build/build-arch.sh --platform-tag $P --abi-tag $A --pylon-dir ./pylon-installer $ARGS
# TODO: can we use v4 here?
- uses: actions/upload-artifact@v3
with:
name: build-results-${{ matrix.p }}-${{ matrix.a }}
path: dist/*

- name: Upload Release Asset
if: needs.prepare.outputs.is_release_build == 'true'
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.prepare.outputs.is_release_build == 'true' && startsWith( matrix.p, 'manylinux' )
if: needs.setup.outputs.is_release_build == 'true' && startsWith( matrix.p, 'manylinux' )
run: |
sudo pip3 install twine
python3 -m twine upload --non-interactive --skip-existing dist/*
build-windows:
needs: prepare
runs-on: windows-2019
needs: setup
runs-on: windows-latest
strategy:
fail-fast: false
steps:
Expand All @@ -140,15 +180,17 @@ jobs:
with:
python-version: "3.6 - 3.12"

- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: pylon-installer
name: Windows_Pylon
path: pylon-installer

- name: Setup pylon
run: |
cd pylon-installer
basler_pylon_7_4_0_14900.exe /quiet /install="GigE_Support;USB_Support;Camera_Link_Support;CoaXPress_Support;GenTL_Consumer_Support;CamEmu_Support;SDKs;DataProcessing_SDK"
# assert that we only have one installer
[ $(ls Basler-pylon-*.exe 2>/dev/null | wc -l) -eq 1 ] || echo "Error: Expected exactly one file, but found $(ls Basler-pylon-*.exe 2>/dev/null | wc -l)" && exit 1
Basler-pylon-*.exe /quiet /install="GigE_Support;USB_Support;Camera_Link_Support;CoaXPress_Support;GenTL_Consumer_Support;CamEmu_Support;SDKs;DataProcessing_SDK"
shell: cmd

- name: Build wheels
Expand All @@ -161,23 +203,23 @@ jobs:
path: ./wheelhouse/*.whl

- name: Upload Release Asset
if: needs.prepare.outputs.is_release_build == 'true'
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.prepare.outputs.is_release_build == 'true'
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: prepare
needs: setup
runs-on: macos-11
strategy:
fail-fast: false
Expand All @@ -189,16 +231,18 @@ jobs:
with:
python-version: "3.6 - 3.12"

- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: pylon-installer
name: macOS_Pylon
path: pylon-installer

- name: Setup pylon
run: |
# install universal
cd pylon-installer
hdiutil attach pylon_*.dmg
# assert that we only have one installer
[ $(ls pylon-*.dmg 2>/dev/null | wc -l) -eq 1 ] || echo "Error: Expected exactly one file, but found $(ls pylon-*.dmg 2>/dev/null | wc -l)" && exit 1
hdiutil attach pylon-*.dmg
sudo installer -pkg /Volumes/pylon\ *\ Camera\ Software\ Suite/pylon-*.pkg -target /
hdiutil detach /Volumes/pylon\ *\ Camera\ Software\ Suite
Expand All @@ -213,32 +257,36 @@ jobs:
path: ./wheelhouse/*.whl

- name: Upload Release Asset
if: needs.prepare.outputs.is_release_build == 'true'
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.prepare.outputs.is_release_build == 'true'
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: [
prepare,
setup,
build-linux,
build-macos,
build-windows
]
runs-on: ubuntu-latest
steps:
- uses: geekyeggo/delete-artifact@v2
- uses: geekyeggo/delete-artifact@v5
continue-on-error: true
with:
name: pylon-installer
name: |
Linux_x86_64_Pylon
Linux_aarch64_Pylon
Windows_Pylon
macOS_Pylon

0 comments on commit 5530304

Please sign in to comment.