add workflow for build #9
This file contains hidden or 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: build | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
goos: [linux, darwin] | |
goarch: [amd64, arm64] | |
steps: | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt install -y libpcap-dev | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.24.2' | |
- name: Test | |
run: go test -v ./... | |
- name: Build | |
env: | |
goos: ${{ matrix.goos }} | |
goarch: ${{ matrix.arch }} | |
run: | | |
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -ldflags="-s -w" -trimpath -o boop-${{ matrix.goos }}.${{ matrix.goarch }} ./... |