Files
Nexus-Guard-Suite/.gitea/workflows/build_device_agent.yaml
T
datadunia 014309c390 fix(ci): strip debug symbols from device-agent release build
- CI build: add -ldflags='-s -w' to reduce binary size ~30%
- Update device-agent submodule reference (heartbeat fixes)
2026-06-18 20:07:13 +07:00

84 lines
2.6 KiB
YAML

name: Build Device Agent
on:
workflow_call:
jobs:
cross-build:
runs-on: ubuntu-latest
env:
RUNNER_TOOL_CACHE: /toolcache
steps:
- name: Configure git auth for submodules
run: git config --global url."https://x-access-token:${{ secrets.BUILD_TOKEN }}@git.datadunia.com/".insteadOf "https://git.datadunia.com/"
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
token: ${{ secrets.BUILD_TOKEN }}
persist-credentials: true
- uses: actions/setup-go@v5
with:
go-version: '1.26'
cache: true
- uses: https://gitea.com/actions/go-hashfiles@v0.0.1
id: hash-src
with:
patterns: |
apps/device-agent/**/*.go
apps/device-agent/go.mod
apps/device-agent/go.sum
- uses: actions/cache@v3
id: cache-build
with:
path: apps/device-agent/bin
key: build-device-agent-${{ steps.hash-src.outputs.hash }}
- name: Generate Windows resources (UAC manifest + icon)
if: steps.cache-build.outputs.cache-hit != 'true'
working-directory: apps/device-agent
run: |
go install github.com/tc-hib/go-winres@latest
go-winres make
- name: Build all platforms
if: steps.cache-build.outputs.cache-hit != 'true'
working-directory: apps/device-agent
shell: bash
run: |
set -e
mkdir -p bin
for PAIR in linux/amd64 linux/arm64 windows/amd64; do
GOOS="${PAIR%%/*}"
GOARCH="${PAIR##*/}"
EXT=""
if [ "$GOOS" = "windows" ]; then EXT=".exe"; fi
OUT="bin/nexus-device-agent-${GOOS}-${GOARCH}${EXT}"
echo "Building $OUT ..."
CGO_ENABLED=0 GOOS="$GOOS" GOARCH="$GOARCH" go build -ldflags="-s -w" -o "$OUT" .
done
echo "=== Build output ==="
ls -la bin/
- name: Upload linux/amd64
uses: actions/upload-artifact@v3
with:
name: nexus-device-agent-linux-amd64
path: apps/device-agent/bin/nexus-device-agent-linux-amd64
- name: Upload linux/arm64
uses: actions/upload-artifact@v3
with:
name: nexus-device-agent-linux-arm64
path: apps/device-agent/bin/nexus-device-agent-linux-arm64
- name: Upload windows/amd64
uses: actions/upload-artifact@v3
with:
name: nexus-device-agent-windows-amd64
path: apps/device-agent/bin/nexus-device-agent-windows-amd64.exe