Adds ARM (Raspberry Pi) cross-compilation support for harmony_agent and harmony_inventory_agent. - .cargo/config.toml: aarch64-linux-gnu-gcc linker - build/cross-arm.sh: local cross-build script with prereq checks - .gitea/workflows/arm-agents.yaml: CI workflow that builds both agents for aarch64 on tagged releases and uploads them as release assets (same pattern as harmony_inventory_agent already uses) Removes the unused 'harmony' dependency from harmony_agent — it was vestigial (no actual imports) and was the only thing pulling in heavy C deps (libvirt via virt) that blocked ARM builds.
79 lines
2.8 KiB
YAML
79 lines
2.8 KiB
YAML
name: Build ARM agent binaries
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
- 'snapshot-*'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build_arm_agents:
|
|
container:
|
|
image: hub.nationtech.io/harmony/harmony_composer:latest
|
|
runs-on: docker
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: 'recursive'
|
|
fetch-depth: 1
|
|
|
|
- name: Install ARM cross-compilation toolchain
|
|
run: |
|
|
apt-get update -qq
|
|
apt-get install -y -qq gcc-aarch64-linux-gnu
|
|
rustup target add aarch64-unknown-linux-gnu
|
|
|
|
- name: Build agent crates for aarch64
|
|
run: |
|
|
cargo build --release --target aarch64-unknown-linux-gnu \
|
|
-p harmony_agent \
|
|
-p harmony_inventory_agent
|
|
|
|
- name: Install jq
|
|
run: apt-get install -y -qq jq
|
|
|
|
- name: Get or create release
|
|
run: |
|
|
TAG_NAME="${GITHUB_REF_NAME}"
|
|
|
|
# Try to get existing release
|
|
RELEASE_ID=$(curl -s -X GET \
|
|
-H "Authorization: token ${{ secrets.GITEATOKEN }}" \
|
|
"https://git.nationtech.io/api/v1/repos/nationtech/harmony/releases/tags/${TAG_NAME}" \
|
|
| jq -r '.id // empty')
|
|
|
|
if [ -z "$RELEASE_ID" ]; then
|
|
# Create new release
|
|
RESPONSE=$(curl -s -X POST \
|
|
-H "Authorization: token ${{ secrets.GITEATOKEN }}" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{
|
|
\"tag_name\": \"${TAG_NAME}\",
|
|
\"name\": \"${TAG_NAME}\",
|
|
\"body\": \"Release ${TAG_NAME}\",
|
|
\"draft\": false,
|
|
\"prerelease\": true
|
|
}" \
|
|
"https://git.nationtech.io/api/v1/repos/nationtech/harmony/releases")
|
|
RELEASE_ID=$(echo "$RESPONSE" | jq -r '.id')
|
|
fi
|
|
|
|
echo "RELEASE_ID=$RELEASE_ID" >> $GITHUB_ENV
|
|
|
|
- name: Upload harmony_agent ARM binary
|
|
run: |
|
|
curl -X POST \
|
|
-H "Authorization: token ${{ secrets.GITEATOKEN }}" \
|
|
-H "Content-Type: application/octet-stream" \
|
|
--data-binary "@target/aarch64-unknown-linux-gnu/release/harmony_agent" \
|
|
"https://git.nationtech.io/api/v1/repos/nationtech/harmony/releases/${{ env.RELEASE_ID }}/assets?name=harmony_agent-aarch64-linux"
|
|
|
|
- name: Upload harmony_inventory_agent ARM binary
|
|
run: |
|
|
curl -X POST \
|
|
-H "Authorization: token ${{ secrets.GITEATOKEN }}" \
|
|
-H "Content-Type: application/octet-stream" \
|
|
--data-binary "@target/aarch64-unknown-linux-gnu/release/harmony_inventory_agent" \
|
|
"https://git.nationtech.io/api/v1/repos/nationtech/harmony/releases/${{ env.RELEASE_ID }}/assets?name=harmony_inventory_agent-aarch64-linux"
|