use aligned buffer under Linux #457
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI for gstreamer | |
on: | |
push: | |
pull_request: | |
branches: ["main"] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: jfrog/setup-jfrog-cli@v4 | |
env: | |
JF_URL: ${{ secrets.SDK_URL }} | |
JF_ACCESS_TOKEN: ${{ secrets.SDK_TOKEN }} | |
- 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_matrix | |
run: | | |
set +x | |
set -e | |
build_config=$(cat .github/workflows/build_config.json) | |
for os in $(echo $build_config | jq -r 'keys[]'); do | |
# setup matrix keys | |
if [[ $os == "windows" || $os == "macos" ]]; then | |
targets=$(echo $build_config | jq -c ".\"$os\".targets") | |
echo "${os}_targets=$targets" >> $GITHUB_OUTPUT | |
pylon_sdks=$(echo $build_config | jq -c ".\"$os\".pylon_sdks") | |
echo "${os}_pylon_sdks=$pylon_sdks" >> $GITHUB_OUTPUT | |
elif [[ $os == "linux-x86_64" || $os == "linux-aarch64" ]]; then | |
targets=$(echo $build_config | jq -c ".\"$os\".targets") | |
echo "${os}_targets=$targets" >> $GITHUB_OUTPUT | |
pylon_sdks=$(echo $build_config | jq -c ".\"$os\".pylon_sdks") | |
echo "${os}_pylon_sdks=$pylon_sdks" >> $GITHUB_OUTPUT | |
fi | |
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 | |
outputs: | |
linux_x86_64_targets: ${{ steps.get_matrix.outputs.linux-x86_64_targets }} | |
linux_x86_64_pylon_sdks: ${{ steps.get_matrix.outputs.linux-x86_64_pylon_sdks }} | |
linux_aarch64_targets: ${{ steps.get_matrix.outputs.linux-aarch64_targets }} | |
linux_aarch64_pylon_sdks: ${{ steps.get_matrix.outputs.linux-aarch64_pylon_sdks }} | |
windows_targets: ${{ steps.get_matrix.outputs.windows_targets }} | |
windows_pylon_sdks: ${{ steps.get_matrix.outputs.windows_pylon_sdks }} | |
macos_targets: ${{ steps.get_matrix.outputs.macos_targets }} | |
macos_pylon_sdks: ${{ steps.get_matrix.outputs.macos_pylon_sdks }} | |
build_windows_x86_64: | |
needs: setup | |
strategy: | |
matrix: | |
os: ${{ fromJson(needs.setup.outputs.windows_targets ) }} | |
pylon_sdk: ${{ fromJson(needs.setup.outputs.windows_pylon_sdks ) }} | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
name: Build gstreamer for ${{ matrix.pylon_sdk }} on ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: Windows_Pylon | |
path: pylon-installer | |
- name: install pylon | |
run: | | |
Start-Process .\pylon-installer\Basler-pylon-${{ matrix.pylon_sdk }}.exe -Wait -ArgumentList '/quiet /install=SDKs;Cpp_Runtime;CamEmu_Support' | |
- name: install meson | |
run: | | |
pip install meson ninja | |
- name: Download Gstreamer | |
uses: suisei-cn/actions-download-file@v1 | |
with: | |
url: https://gstreamer.freedesktop.org/data/pkg/windows/1.22.7/msvc//gstreamer-1.0-msvc-x86_64-1.22.7.msi | |
target: ${{ runner.temp }}\ | |
- name: Download Gstreamer dev | |
uses: suisei-cn/actions-download-file@v1 | |
with: | |
url: https://gstreamer.freedesktop.org/data/pkg/windows/1.22.7/msvc/gstreamer-1.0-devel-msvc-x86_64-1.22.7.msi | |
target: ${{ runner.temp }}\ | |
- name: Install Gstreamer | |
run: | | |
cmd /c start /wait msiexec /package ${{ runner.temp }}\gstreamer-1.0-msvc-x86_64-1.22.7.msi TARGETDIR="C:\" /quiet ADDLOCAL=ALL /L*V gst.log | |
cmd /c start /wait msiexec /package ${{ runner.temp }}\gstreamer-1.0-devel-msvc-x86_64-1.22.7.msi TARGETDIR="C:\" /quiet ADDLOCAL=ALL /L*V dev.log | |
cat gst.log | |
cat dev.log | |
- name: Set up Visual Studio shell | |
uses: egor-tensin/vs-shell@v2 | |
with: | |
arch: x64 | |
- name: compile | |
run: | | |
# access to pkg-config | |
$env:GSTREAMER_1_0_ROOT_MSVC_X86_64 = "C:\gstreamer\1.0\msvc_x86_64" | |
$env:CMAKE_PREFIX_PATH = "C:\Program Files\Basler\pylon 7\Development\CMake\pylon\" | |
$env:Path = "$env:GSTREAMER_1_0_ROOT_MSVC_X86_64\bin;" + $env:Path | |
$env:PKG_CONFIG_PATH = "$env:GSTREAMER_1_0_ROOT_MSVC_X86_64\lib\pkgconfig" | |
$env:PKG_CONFIG = "$env:GSTREAMER_1_0_ROOT_MSVC_X86_64\bin\pkg-config" | |
meson setup build --prefix="$env:GSTREAMER_1_0_ROOT_MSVC_X86_64" | |
ninja -C build | |
ninja -C build test | |
ninja -C build install | |
- name: Print meson log | |
if: ${{ failure() }} | |
run: | | |
cat build/meson-logs/meson-log.txt | |
- name: test | |
run: | | |
$env:PYLON_CAMEMU="1" | |
$env:GSTREAMER_1_0_ROOT_MSVC_X86_64 = "C:\gstreamer\1.0\msvc_x86_64\" | |
$env:Path = "C:\Program Files\Basler\pylon 7\Runtime\x64\;$env:GSTREAMER_1_0_ROOT_MSVC_X86_64\bin;" + $env:Path | |
gst-inspect-1.0.exe pylonsrc | |
gst-launch-1.0.exe pylonsrc num-buffers=10 ! fakesink | |
build_linux_aarch64: | |
needs: setup | |
strategy: | |
matrix: | |
os: ${{ fromJson(needs.setup.outputs.linux_aarch64_targets) }} | |
pylon_sdk: ${{ fromJson(needs.setup.outputs.linux_aarch64_pylon_sdks) }} | |
fail-fast: false | |
runs-on: ubuntu-latest | |
name: Build pylon ${{ matrix.pylon_sdk }} on ${{ matrix.os }}-aarch64 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: Linux_aarch64_Pylon | |
path: pylon-installer | |
- uses: uraimo/run-on-arch-action@v2 | |
name: build and test aarch64 | |
id: runcmd | |
with: | |
arch: aarch64 | |
distro: ${{ matrix.os }} | |
# Create an artifacts directory | |
setup: | | |
mkdir -p "${PWD}/artifacts" | |
dockerRunArgs: | | |
--volume "${PWD}/pylon-installer:/pylon-installer" | |
run: | | |
uname -a | |
# install pylon | |
PYLON_TGZ=$(readlink -m /pylon-installer/pylon-${{ matrix.pylon_sdk }}-linux-aarch64_setup.tar.gz) | |
mkdir pylon_tmp | |
pushd pylon_tmp | |
tar -xf $PYLON_TGZ | |
mkdir -p /opt/pylon | |
tar -C /opt/pylon -xzf pylon*aarch64.tar.gz | |
popd | |
# install required environment | |
apt-get update | |
# remove conflicting package | |
dpkg-query -W -f='${Status}' libunwind-14-dev | grep "ok installed" && apt-get remove -y libunwind-14-dev | |
# install required build tools | |
apt-get -y install python3 python3-pip libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev cmake clang gstreamer1.0-tools python3-venv | |
python3 -m venv build_python | |
# activate the python environment | |
. build_python/bin/activate | |
pip install pip --upgrade | |
pip install meson ninja | |
# compile gcc | |
export PYLON_ROOT=/opt/pylon | |
export CC=gcc | |
export CXX=g++ | |
meson setup builddir_gcc --prefix $PWD/install_gcc | |
ninja -C builddir_gcc | |
ninja -C builddir_gcc test | |
ninja -C builddir_gcc install | |
# compile clang | |
export PYLON_ROOT=/opt/pylon | |
export CC=clang | |
export CXX=clang++ | |
meson setup builddir_clang --prefix $PWD/install_clang | |
ninja -C builddir_clang | |
ninja -C builddir_clang test | |
ninja -C builddir_clang install | |
# run tests gcc | |
export GST_PLUGIN_PATH=$PWD/install_gcc/lib/aarch64-linux-gnu/gstreamer-1.0 | |
export LD_LIBRARY_PATH=$PWD/install_gcc/lib/aarch64-linux-gnu | |
export PYLON_CAMEMU=1 | |
gst-inspect-1.0 pylonsrc | |
gst-launch-1.0 pylonsrc num-buffers=10 ! fakesink | |
# run tests clang | |
export GST_PLUGIN_PATH=$PWD/install_clang/lib/aarch64-linux-gnu/gstreamer-1.0 | |
export LD_LIBRARY_PATH=$PWD/install_clang/lib/aarch64-linux-gnu | |
export PYLON_CAMEMU=1 | |
gst-inspect-1.0 pylonsrc | |
gst-launch-1.0 pylonsrc num-buffers=10 ! fakesink | |
build_linux_x86_64: | |
needs: setup | |
strategy: | |
matrix: | |
os: ${{ fromJson(needs.setup.outputs.linux_x86_64_targets) }} | |
pylon_sdk: ${{ fromJson(needs.setup.outputs.linux_x86_64_pylon_sdks) }} | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
name: Build pylon ${{ matrix.pylon_sdk }} on ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: Linux_x86_64_Pylon | |
path: pylon-installer | |
- name: install pylon | |
run: | | |
PYLON_TGZ=$(readlink -m pylon-installer/pylon-${{ matrix.pylon_sdk }}-linux-x86_64_setup.tar.gz) | |
mkdir pylon_tmp | |
pushd pylon_tmp | |
tar -xf $PYLON_TGZ | |
sudo mkdir -p /opt/pylon | |
sudo tar -C /opt/pylon -xzf pylon*x86_64.tar.gz | |
# install codemeter | |
sudo apt-get install -y /opt/pylon/share/pylon/codemeter_*.deb --fix-broken || echo "Codemeter install failed" | |
popd | |
- name: install required environment | |
run: | | |
sudo apt-get update | |
# remove conflicting package | |
sudo dpkg-query -W -f='${Status}' libunwind-14-dev | grep "ok installed" && sudo apt-get remove -y libunwind-14-dev | |
# install required build tools | |
sudo apt-get -y install python3 python3-pip libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev cmake clang gstreamer1.0-tools python3-venv | |
python3 -m venv build_python | |
. build_python/bin/activate | |
pip install pip --upgrade | |
pip install meson ninja | |
- name: compile gcc | |
run: | | |
export PYLON_ROOT=/opt/pylon | |
export CC=gcc | |
export CXX=g++ | |
. build_python/bin/activate | |
meson setup builddir_gcc --prefix $PWD/install_gcc | |
ninja -C builddir_gcc | |
ninja -C builddir_gcc test | |
ninja -C builddir_gcc install | |
- name: compile clang | |
run: | | |
export PYLON_ROOT=/opt/pylon | |
export CC=clang | |
export CXX=clang++ | |
. build_python/bin/activate | |
meson setup builddir_clang --prefix $PWD/install_clang | |
ninja -C builddir_clang | |
ninja -C builddir_clang test | |
ninja -C builddir_clang install | |
- name: run tests gcc | |
run: | | |
export GST_PLUGIN_PATH=$PWD/install_gcc/lib/x86_64-linux-gnu/gstreamer-1.0 | |
export LD_LIBRARY_PATH=$PWD/install_gcc/lib/x86_64-linux-gnu/ | |
export PYLON_CAMEMU=1 | |
gst-inspect-1.0 pylonsrc | |
gst-launch-1.0 pylonsrc num-buffers=10 ! fakesink | |
- name: run tests clang | |
run: | | |
export GST_PLUGIN_PATH=$PWD/install_clang/lib/x86_64-linux-gnu/gstreamer-1.0 | |
export LD_LIBRARY_PATH=$PWD/install_clang/lib/x86_64-linux-gnu/ | |
export PYLON_CAMEMU=1 | |
gst-inspect-1.0 pylonsrc | |
gst-launch-1.0 pylonsrc num-buffers=10 ! fakesink | |
cleanup: | |
if: always() | |
needs: [ | |
setup, | |
build_linux_x86_64, | |
build_linux_aarch64, | |
build_windows_x86_64 | |
] | |
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 |