Allow manual trigger of CI in Github interface #19
This file contains 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: Continuous Integration | |
on: [push, pull_request, workflow_dispatch] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install pcap | |
run: | | |
sudo apt update | |
sudo apt install libpcap-dev | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.20' | |
- name: Build | |
run: go build -v ipxbox.go | |
- name: Test | |
run: | | |
go test network/pipe/*.go | |
go test network/filter/*.go | |
go test ipx/*.go | |
crosscompile: | |
strategy: | |
matrix: | |
goarch: [386, amd64, arm64] | |
goos: [darwin, freebsd, linux, windows] | |
exclude: | |
- goarch: 386 | |
goos: darwin | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.20' | |
- name: Build | |
run: | | |
mkdir artifacts | |
cd artifacts | |
go build -tags nopcap -v ../ipxbox.go | |
go build -tags nopcap -v ../standalone/ipxbox_uplink.go | |
env: | |
GOARCH: ${{ matrix.goarch }} | |
GOOS: ${{ matrix.goos }} | |
# Github packages artifacts in .zip files which don't preserve | |
# permissions, so we must make an inner tar. Sigh. | |
- name: Tar artifacts | |
run: | | |
mv artifacts artifacts2 | |
mkdir artifacts | |
tar -C artifacts2 -czf artifacts/contents.tar.gz . | |
if: ${{ matrix.goos != 'windows' }} | |
- name: Upload build | |
uses: actions/upload-artifact@v1 | |
with: | |
path: "artifacts" | |
name: ipxbox_${{ matrix.goos }}_${{ matrix.goarch }} | |