Fix up Actions (#2)
All checks were successful
CI / tests (push) Successful in 27s
CI / build (push) Successful in 35s

Reviewed-on: #2
Co-authored-by: Gabriel Simmer <g@gmem.ca>
Co-committed-by: Gabriel Simmer <g@gmem.ca>
This commit is contained in:
Gabriel Simmer 2024-04-24 10:27:18 +01:00 committed by Gabriel Simmer
parent 54d87b724f
commit 15a997cf5b
Signed by: Arch Forgejo
GPG key ID: E58BBEB3C95BA466
2 changed files with 25 additions and 11 deletions

View file

@ -13,18 +13,33 @@ jobs:
steps:
- 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
run: |
[ "$(gofmt -l $(find . -name '*.go') 2>&1)" = "" ]
- name: install binaries
run: go install github.com/google/dnsmasq_exporter
- name: run tests
run: go test ./... -v -race
- name: build tests
run: go test -c ./collector
build:
runs-on: ubuntu-latest
- name: docker build
run: docker build --pull --no-cache --rm -t=dns -f travis/Dockerfile .
steps:
- uses: actions/checkout@v2
- name: run tests in docker
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'
- uses: actions/setup-go@v5
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

View file

@ -55,9 +55,8 @@ func main() {
flag.Parse()
var (
dnsClient = &dns.Client{
}
cfg = collector.Config{
dnsClient = &dns.Client{}
cfg = collector.Config{
DnsClient: dnsClient,
DnsmasqAddr: *dnsmasqAddr,
LeasesPath: *leasesPath,