Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
ecf0412496 | |||
8ba14148d7 |
102
.github/workflows/go.yml
vendored
102
.github/workflows/go.yml
vendored
@ -1,102 +0,0 @@
|
|||||||
name: GitHub Actions CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ master ]
|
|
||||||
pull_request:
|
|
||||||
branches: [ master ]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
|
|
||||||
build:
|
|
||||||
name: build
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
|
|
||||||
- name: Set up Go 1.x
|
|
||||||
uses: actions/setup-go@v2
|
|
||||||
with:
|
|
||||||
# Run on the latest minor release of Go 1.14:
|
|
||||||
go-version: ^1.14
|
|
||||||
id: go
|
|
||||||
|
|
||||||
- name: Check out code into the Go module directory
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Share cache with other actions
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: ~/go/pkg/mod
|
|
||||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-go-
|
|
||||||
|
|
||||||
- name: Ensure all files were formatted as per gofmt
|
|
||||||
run: |
|
|
||||||
gofmt -l $(find . -name '*.go') >/dev/null
|
|
||||||
|
|
||||||
- name: Go Vet
|
|
||||||
run: |
|
|
||||||
go vet
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: |
|
|
||||||
go build -v ./cmd/...
|
|
||||||
|
|
||||||
test:
|
|
||||||
name: test
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
|
|
||||||
- name: Set up Go 1.x
|
|
||||||
uses: actions/setup-go@v2
|
|
||||||
with:
|
|
||||||
# Run on the latest minor release of Go 1.14:
|
|
||||||
go-version: ^1.14
|
|
||||||
id: go
|
|
||||||
|
|
||||||
- name: Check out code into the Go module directory
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Share cache with other actions
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: ~/go/pkg/mod
|
|
||||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-go-
|
|
||||||
|
|
||||||
- name: Test
|
|
||||||
run: |
|
|
||||||
go test -v -race ./internal/...
|
|
||||||
|
|
||||||
integrationtest:
|
|
||||||
name: integrationtest
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
|
|
||||||
- name: Set up Go 1.x
|
|
||||||
uses: actions/setup-go@v2
|
|
||||||
with:
|
|
||||||
# Run on the latest minor release of Go 1.14:
|
|
||||||
go-version: ^1.14
|
|
||||||
id: go
|
|
||||||
|
|
||||||
- name: Check out code into the Go module directory
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Share cache with other actions
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: ~/go/pkg/mod
|
|
||||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-go-
|
|
||||||
|
|
||||||
- name: Build Docker container with the tools our tests require
|
|
||||||
run: |
|
|
||||||
docker build --pull --no-cache --rm -t=router7 -f travis/Dockerfile .
|
|
||||||
|
|
||||||
- name: Run tests in Docker container
|
|
||||||
run: |
|
|
||||||
exit=0; for pkg in $(go list ./integration/...); do go test -c $pkg && docker run --privileged --net=host -v $PWD:/usr/src:ro router7 /bin/sh -c "./$(basename $pkg).test -test.v" || exit=1; done; [ $exit = 0 ]
|
|
28
.travis.yml
Normal file
28
.travis.yml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
# Use the (faster) container-based infrastructure, see also
|
||||||
|
# http://docs.travis-ci.com/user/workers/container-based-infrastructure/
|
||||||
|
sudo: required
|
||||||
|
dist: xenial
|
||||||
|
services:
|
||||||
|
- docker
|
||||||
|
|
||||||
|
language: go
|
||||||
|
go:
|
||||||
|
- "1.14"
|
||||||
|
|
||||||
|
install:
|
||||||
|
- go get -t -v -d ./...
|
||||||
|
|
||||||
|
script:
|
||||||
|
# Check whether files are syntactically correct.
|
||||||
|
- "gofmt -l $(find . -name '*.go' | tr '\\n' ' ') >/dev/null"
|
||||||
|
# Check whether files were not gofmt'ed.
|
||||||
|
- "gosrc=$(find . -name '*.go' | tr '\\n' ' '); [ $(gofmt -l $gosrc 2>&- | wc -l) -eq 0 ] || (echo 'gofmt was not run on these files:'; gofmt -l $gosrc 2>&-; false)"
|
||||||
|
# TODO: remove the || true suffix once vet errors are fixed
|
||||||
|
- go vet . || true
|
||||||
|
- sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0
|
||||||
|
- go build ./cmd/...
|
||||||
|
- go test -v -race ./internal/...
|
||||||
|
- docker build --pull --no-cache --rm -t=router7 -f travis/Dockerfile .
|
||||||
|
- sudo service docker restart
|
||||||
|
# NOTE: this must be the last command because of the travis_terminate usage:
|
||||||
|
- exit=0; for pkg in $(go list ./integration/...); do go test -c $pkg && docker run --privileged --net=host -v $PWD:/usr/src:ro router7 /bin/sh -c "./$(basename $pkg).test -test.v" || exit=1; done; [ $exit = 0 ] || travis_terminate 1
|
3
Makefile
3
Makefile
@ -9,7 +9,7 @@ PKGS := github.com/rtr7/router7/cmd/... \
|
|||||||
build:
|
build:
|
||||||
mkdir -p result
|
mkdir -p result
|
||||||
GOOS=linux go build -o ./result github.com/rtr7/router7/cmd/...
|
GOOS=linux go build -o ./result github.com/rtr7/router7/cmd/...
|
||||||
GOOS=linux go build -o ./result/rtr7-init -ldflags "-X main.buildTimestamp=$(shell date '+%Y-%m-%dT%H:%M:%S%z') -X github.com/gokrazy/gokrazy.httpPassword=hello" init/init.go
|
GOOS=linux go build -o ./result/rtr7-init -ldflags "-X main.buildTimestamp=$(shell date '+%Y-%m-%dT%H:%M:%S%z') -X github.com/gokrazy/gokrazy.httpPassword=temp" init/init.go
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf result
|
rm -rf result
|
||||||
@ -94,7 +94,6 @@ qemu:
|
|||||||
-netdev tap,id=uplink,fd=3 3<>/dev/tap184 \
|
-netdev tap,id=uplink,fd=3 3<>/dev/tap184 \
|
||||||
-device virtio-net-pci,netdev=uplink,mac=52:55:00:d1:55:03 \
|
-device virtio-net-pci,netdev=uplink,mac=52:55:00:d1:55:03 \
|
||||||
-device virtio-net-pci,id=lan,mac=52:55:00:d1:55:04 \
|
-device virtio-net-pci,id=lan,mac=52:55:00:d1:55:04 \
|
||||||
-device i6300esb,id=watchdog0 -watchdog-action reset \
|
|
||||||
-smp 8 \
|
-smp 8 \
|
||||||
-machine accel=kvm \
|
-machine accel=kvm \
|
||||||
-m 4096 \
|
-m 4096 \
|
||||||
|
@ -44,9 +44,9 @@ var log = teelogger.NewConsole()
|
|||||||
type lcHostname string
|
type lcHostname string
|
||||||
|
|
||||||
type IP struct {
|
type IP struct {
|
||||||
IPv6 net.IP `json:"ipv6"`
|
IPv6 net.IP
|
||||||
IPv4 net.IP `json:"ipv4"`
|
IPv4 net.IP
|
||||||
Host lcHostname `json:"host"` // lease that the IPs are updated from. If no lease exists for this host it is never updated.
|
Host lcHostname // lease that the IPs are updated from. If no lease exists for this host it is never updated.
|
||||||
}
|
}
|
||||||
|
|
||||||
type Server struct {
|
type Server struct {
|
||||||
|
Reference in New Issue
Block a user