Skip to content

EOT detection cleanup #73

EOT detection cleanup

EOT detection cleanup #73

Workflow file for this run

name: Build and Package
on:
workflow_dispatch:
push:
branches: [ master ]
tags: [ 'v*' ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
# with:
# fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.24.x'
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y dpkg-dev
- name: Get version
id: version
run: |
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
else
VERSION="0.0.0-dev.${GITHUB_SHA::8}"
fi
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "Building version: $VERSION"
- name: Download dependencies
run: go mod download
- name: Run tests
run: go test .
- name: Build for Raspberry Pi (ARM64)
run: |
cd cmd/m17-gateway
echo "Building M17 Gateway for ARM64 architecture (64-bit Raspberry Pi OS)..."
GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -o m17-gateway .
echo "Build completed successfully"
ls -la m17-gateway
file m17-gateway
- name: Make build script executable
run: |
cd cmd/m17-gateway
chmod +x ./packaging/scripts/build-deb.sh
- name: Build .deb package
run: |
cd cmd/m17-gateway
./packaging/scripts/build-deb.sh ${{ steps.version.outputs.VERSION }}
- name: List build artifacts
run: |
cd cmd/m17-gateway
ls -la build/
- name: Upload .deb package
uses: actions/upload-artifact@v4
with:
name: m17-gateway-debian-package
path: cmd/m17-gateway/build/*.deb
- name: Create Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
files: cmd/m17-gateway/build/*.deb
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
test:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- name: Download .deb package
uses: actions/download-artifact@v4
with:
name: m17-gateway-debian-package
path: ./
- name: Test package info
run: |
# Install dpkg tools
sudo apt-get update
sudo apt-get install -y dpkg-dev
# Check package info
DEB_FILE=$(ls *.deb)
echo "Package contents:"
dpkg -c "$DEB_FILE"
echo "Package info:"
dpkg -I "$DEB_FILE"