Skip to content

Continuous Integration #103

Continuous Integration

Continuous Integration #103

Workflow file for this run

name: Continuous Integration
on:
push:
pull_request:
workflow_dispatch:
schedule: # Nightly build
- cron: "30 0 * * *"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install pcap
run: |
sudo apt update
sudo apt install libpcap-dev
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.21'
- name: Build
run: go build -v ipxbox.go
- name: Test
run: |
go test -cover \
$PWD/ipx \
$PWD/network/doom \
$PWD/network/pipe \
$PWD/network/filter
crosscompile:
strategy:
matrix:
goarch: [amd64, arm64]
goos: [darwin, freebsd, linux, windows]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.21'
- name: Build
run: |
mkdir artifacts
cd artifacts
go build -v ../standalone/ipxbox_minimal.go
go build -tags nopcap -v ../ipxbox.go
go build -tags nopcap -v ../standalone/ipxbox_uplink.go
go build -tags nopcap -v ../standalone/standalone_ipxpkt.go
go build -tags nopcap -v ../standalone/standalone_pptp.go
go build -tags nopcap -v ../standalone/standalone_qproxy.go
env:
GOARCH: ${{ matrix.goarch }}
GOOS: ${{ matrix.goos }}
- name: Find Git version
id: version
run: |
if git describe --exact-match --tags >/dev/null; then
VERSION=$(git describe --exact-match --tags)
else
VERSION=git-$(git rev-parse --short HEAD)
fi
OS_ARCH=${{ matrix.goos }}-${{ matrix.goarch }}
OS_ARCH=${OS_ARCH/darwin/macos}
echo "VERSION=$OS_ARCH-$VERSION" >> $GITHUB_OUTPUT
# We package the artifacts in a .tar to preserve permissions.
- name: Tar artifacts
run: |
mv artifacts ipxbox-${{steps.version.outputs.VERSION}}
tar -czf ipxbox-${{steps.version.outputs.VERSION}}.tar.gz \
ipxbox-${{steps.version.outputs.VERSION}}
if: ${{ matrix.goos != 'windows' }}
- name: Upload build
uses: actions/upload-artifact@v7
if: ${{ matrix.goos != 'windows' }}
with:
path: "ipxbox-${{steps.version.outputs.VERSION}}.tar.gz"
name: "ipxbox-${{steps.version.outputs.VERSION}}"
archive: false
- name: Upload build (Windows)
uses: actions/upload-artifact@v7
if: ${{ matrix.goos == 'windows' }}
with:
path: "artifacts"
name: "ipxbox-${{steps.version.outputs.VERSION}}"