Use own action runner #2
31
.github/workflows/go.yml
vendored
31
.github/workflows/go.yml
vendored
|
@ -13,18 +13,33 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: '1.22'
|
||||||
|
|
||||||
|
- name: install dnsmasq
|
||||||
|
run: apt update && apt install -y dnsmasq
|
||||||
|
|
||||||
- name: Ensure all files were formatted as per gofmt
|
- name: Ensure all files were formatted as per gofmt
|
||||||
run: |
|
run: |
|
||||||
[ "$(gofmt -l $(find . -name '*.go') 2>&1)" = "" ]
|
[ "$(gofmt -l $(find . -name '*.go') 2>&1)" = "" ]
|
||||||
|
|
||||||
- name: install binaries
|
- name: run tests
|
||||||
run: go install github.com/google/dnsmasq_exporter
|
run: go test ./... -v -race
|
||||||
|
|
||||||
- name: build tests
|
build:
|
||||||
run: go test -c ./collector
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
- name: docker build
|
steps:
|
||||||
run: docker build --pull --no-cache --rm -t=dns -f travis/Dockerfile .
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: run tests in docker
|
- uses: actions/setup-go@v5
|
||||||
run: docker run -v $PWD:/usr/src:ro -e TESTDATA_FILE_PATH=/usr/src/collector/testdata/dnsmasq.leases dns /bin/sh -c './collector.test -test.v'
|
with:
|
||||||
|
go-version: '1.22'
|
||||||
|
|
||||||
|
- name: build binary
|
||||||
|
run: go build
|
||||||
|
- uses: https://github.com/actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: dnsmasq_exporter
|
||||||
|
path: dnsmasq_exporter
|
||||||
|
|
|
@ -55,8 +55,7 @@ func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
var (
|
var (
|
||||||
dnsClient = &dns.Client{
|
dnsClient = &dns.Client{}
|
||||||
}
|
|
||||||
cfg = collector.Config{
|
cfg = collector.Config{
|
||||||
DnsClient: dnsClient,
|
DnsClient: dnsClient,
|
||||||
DnsmasqAddr: *dnsmasqAddr,
|
DnsmasqAddr: *dnsmasqAddr,
|
||||||
|
|
Loading…
Reference in a new issue