Skip to content

test(hw): runtime device-tree overlay lifecycle for AD9081+ZCU102 and ADRV9009+ZC706 #204

test(hw): runtime device-tree overlay lifecycle for AD9081+ZCU102 and ADRV9009+ZC706

test(hw): runtime device-tree overlay lifecycle for AD9081+ZCU102 and ADRV9009+ZC706 #204

Workflow file for this run

name: Build and Deploy adidt (debian)
permissions:
contents: read
env:
APP_NAME: adidt
on:
workflow_dispatch:
push:
branches:
- main
- '20[1-9][0-9]_R[1-9]'
- staging/*
tags:
- 'v*'
pull_request:
branches:
- main
- '20[1-9][0-9]_R[1-9]'
jobs:
identify_version:
runs-on: ubuntu-latest
outputs:
app-version: ${{ steps.set_version.outputs.version }}
steps:
- name: Checkout code repository
uses: actions/checkout@v6
- name: Set app version
id: set_version
run: |
# Regex to match semantic versioning (from semver.org)
# Regex will match valid version number https://regex101.com/r/jPSdnV/1
regex='^(v|)((0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\.((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)))*))?(\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?)$'
app_version=""
latest_released_tag=$(curl "https://api.github.com/repos/${{github.repository}}/releases/latest" | jq -r .tag_name)
if [[ "${{github.ref_type}}" == "tag" ]]; then
pushed_tag="${{github.ref_name}}"
if [[ "$pushed_tag" =~ $regex ]]; then
app_version="${BASH_REMATCH[2]}"
if [[ "$latest_released_tag" =~ $regex ]]; then
IFS='.' read -r major minor patch <<< "${BASH_REMATCH[2]}"
next_patch="$major.$minor.$((patch + 1))"
next_minor="$major.$((minor + 1)).0"
next_major="$((major + 1)).0.0"
if ! [[ "$app_version" == "$next_patch" || "$app_version" == "$next_minor" || "$app_version" == "$next_major" ]]; then
echo "Valid tag, but invalid version incrementation, release will NOT be created"
fi
else
echo "Invalid relesed version, skip incrementation validation! Release will be created"
fi
else
echo "Invalid tag format, release will NOT be created"
app_version=0.0.1+${{ github.sha }}
fi
else
if [[ "$latest_released_tag" =~ $regex ]]; then
app_version=${BASH_REMATCH[2]}+${{ github.sha }}
else
echo "Invalid relesed version. Setting default version"
app_version=0.0.1+${{ github.sha }}
fi
fi
echo "Version to use $app_version"
echo "version=$app_version" >> "$GITHUB_OUTPUT"
build_and_deploy_for_kuiper:
runs-on: ubuntu-24.04-arm
needs: identify_version
env:
CONTAINER_BASE_NAME: kuiper-container-basic
strategy:
fail-fast: false
matrix:
include:
- docker_image: aandrisa/kuiper_basic_64:latest
image_arch: linux/arm64
architecture: arm64
- docker_image: aandrisa/kuiper_basic_32:latest
image_arch: linux/arm/v7
architecture: armhf
steps:
- name: Checkout code repository
uses: actions/checkout@v6
with:
path: ${{env.APP_NAME}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Start persistent container
run: |
docker run -d \
--platform ${{matrix.image_arch}} \
--name ${{env.CONTAINER_BASE_NAME}}-${{matrix.architecture}} \
-v "$GITHUB_WORKSPACE/${{env.APP_NAME}}:/workspace/${{env.APP_NAME}}" \
-w /workspace/${{env.APP_NAME}} \
${{matrix.docker_image}} tail -f /dev/null
- name: Create debian package
run: |
docker exec ${{env.CONTAINER_BASE_NAME}}-${{matrix.architecture}} sh -c ".github/scripts/create_debian.sh ${{needs.identify_version.outputs.app-version}} ${{matrix.architecture}}"
- name: Install application
env:
DEB_FILE_NAME: python3-${{env.APP_NAME}}_${{needs.identify_version.outputs.app-version}}-1_${{matrix.architecture}}
run: |
docker exec ${{env.CONTAINER_BASE_NAME}}-${{matrix.architecture}} sh -c "sudo dpkg -i ${{env.DEB_FILE_NAME}}.deb"
- name: Verify install locations
run: |
docker exec ${{env.CONTAINER_BASE_NAME}}-${{matrix.architecture}} sh -c ".github/scripts/verify_install.sh"
- name: Copy .deb from container to host
env:
DEB_FILE_NAME: python3-${{env.APP_NAME}}_${{needs.identify_version.outputs.app-version}}-1_${{matrix.architecture}}
run: |
docker cp ${{env.CONTAINER_BASE_NAME}}-${{matrix.architecture}}:/workspace/${{env.APP_NAME}}/${{env.DEB_FILE_NAME}}.deb ./${{env.DEB_FILE_NAME}}.deb
- name: Upload .deb artifacts to github
uses: actions/upload-artifact@v7
with:
name: ${{env.APP_NAME}}-${{matrix.architecture}}
path: python3-${{env.APP_NAME}}_${{needs.identify_version.outputs.app-version}}-1_${{matrix.architecture}}.deb
if-no-files-found: error
build_and_deploy_for_ubuntu:
runs-on: ubuntu-latest
needs: identify_version
env:
architecture: amd64
defaults:
run:
working-directory: ${{env.APP_NAME}}
steps:
- name: Checkout code repository
uses: actions/checkout@v6
with:
path: ${{env.APP_NAME}}
- name: Create .deb package
run: |
.github/scripts/create_debian.sh ${{needs.identify_version.outputs.app-version}} ${{env.architecture}}
- name: Install application
env:
DEB_FILE_NAME: python3-${{env.APP_NAME}}_${{needs.identify_version.outputs.app-version}}-1_${{env.architecture}}
run: |
sudo dpkg -i ${{env.DEB_FILE_NAME}}.deb
- name: Verify install locations
run: |
.github/scripts/verify_install.sh
- name: Upload .deb artifacts to github
uses: actions/upload-artifact@v7
with:
name: ${{env.APP_NAME}}-ubuntu
path: ${{env.APP_NAME}}/python3-${{env.APP_NAME}}_${{needs.identify_version.outputs.app-version}}-1_${{env.architecture}}.deb
if-no-files-found: error