You've already forked dyndns-client
Compare commits
1 Commits
master
...
ddbd2f89d9
Author | SHA1 | Date | |
---|---|---|---|
ddbd2f89d9
|
@ -6,19 +6,17 @@ on:
|
||||
push:
|
||||
branches: [ '**' ]
|
||||
tags-ignore: [ '**' ]
|
||||
workflow_dispatch: {}
|
||||
|
||||
jobs:
|
||||
unittest:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go: [ stable ]
|
||||
os: [ ubuntu-latest-amd64, ubuntu-latest-arm64 ]
|
||||
runs-on:
|
||||
- ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4.2.2
|
||||
- uses: actions/setup-go@v5.5.0
|
||||
with:
|
||||
go-version: ${{ matrix.go }}
|
||||
go-version: stable
|
||||
- env:
|
||||
GOPROXY: ${{ vars.GOPROXY }}
|
||||
run: make test/unit
|
||||
|
@ -1,27 +0,0 @@
|
||||
name: Golang CI lint
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [ "opened", "reopened", "synchronize" ]
|
||||
push:
|
||||
branches: [ '**' ]
|
||||
tags-ignore: [ '**' ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
golangci:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go: [ stable ]
|
||||
os: [ ubuntu-latest-amd64, ubuntu-latest-arm64 ]
|
||||
steps:
|
||||
- uses: actions/checkout@v4.2.2
|
||||
- uses: actions/setup-go@v5.5.0
|
||||
with:
|
||||
go-version: ${{ matrix.go }}
|
||||
- uses: golangci/golangci-lint-action@v8.0.0
|
||||
with:
|
||||
version: v2.1
|
28
.golangci.yml
Normal file
28
.golangci.yml
Normal file
@ -0,0 +1,28 @@
|
||||
issues:
|
||||
exclude-dirs:
|
||||
- it
|
||||
|
||||
run:
|
||||
timeout: 10m
|
||||
tests: true
|
||||
|
||||
linters:
|
||||
disable-all: true
|
||||
enable:
|
||||
# Default
|
||||
- errcheck
|
||||
- gosimple
|
||||
- govet
|
||||
- ineffassign
|
||||
- staticcheck
|
||||
- typecheck
|
||||
- unused
|
||||
|
||||
# Additionally linters
|
||||
- bodyclose
|
||||
- misspell
|
||||
- nilerr
|
||||
- rowserrcheck
|
||||
- sqlclosecheck
|
||||
- unparam
|
||||
- whitespace
|
125
Makefile
125
Makefile
@ -1,114 +1,53 @@
|
||||
dcmergeEXECUTABLE=dyndns-client
|
||||
VERSION?=$(shell git describe --abbrev=0)+hash.$(shell git rev-parse --short HEAD)
|
||||
# VERSION
|
||||
VERSION ?= $(shell git describe --abbrev=0)+hash.$(shell git rev-parse --short HEAD)
|
||||
|
||||
# Destination directory and prefix to place the compiled binaries, documentaions
|
||||
# and other files.
|
||||
DESTDIR?=
|
||||
PREFIX?=/usr/local
|
||||
DESTDIR ?=
|
||||
PREFIX ?= /usr/local
|
||||
EXECUTABLE := dyndns-client
|
||||
|
||||
# CONTAINER_RUNTIME
|
||||
# The CONTAINER_RUNTIME variable will be used to specified the path to a
|
||||
# container runtime. This is needed to start and run a container image.
|
||||
CONTAINER_RUNTIME?=$(shell which podman)
|
||||
|
||||
# DYNDNS_CLIENT_IMAGE_REGISTRY_NAME
|
||||
# Defines the name of the new container to be built using several variables.
|
||||
DYNDNS_CLIENT_IMAGE_REGISTRY_NAME:=git.cryptic.systems
|
||||
DYNDNS_CLIENT_IMAGE_REGISTRY_USER:=volker.raschek
|
||||
|
||||
DYNDNS_CLIENT_IMAGE_NAMESPACE?=${DYNDNS_CLIENT_IMAGE_REGISTRY_USER}
|
||||
DYNDNS_CLIENT_IMAGE_NAME:=${EXECUTABLE}
|
||||
_IMAGE_VERSION?=latest
|
||||
DYNDNS_CLIENT_IMAGE_FULLY_QUALIFIED=${DYNDNS_CLIENT_IMAGE_REGISTRY_NAME}/${DYNDNS_CLIENT_IMAGE_NAMESPACE}/${DYNDNS_CLIENT_IMAGE_NAME}:${DYNDNS_CLIENT_IMAGE_VERSION}
|
||||
|
||||
# BIN
|
||||
# BINARIES
|
||||
# ==============================================================================
|
||||
dyndns-client:
|
||||
all: ${EXECUTABLE}
|
||||
|
||||
${EXECUTABLE}:
|
||||
CGO_ENABLED=0 \
|
||||
GOPRIVATE=$(shell go env GOPRIVATE) \
|
||||
GOPROXY=$(shell go env GOPROXY) \
|
||||
go build -ldflags "-X 'main.version=${VERSION}'" -o ${@} main.go
|
||||
go build -ldflags "-X main.version=${VERSION:v%=%}" -o ${@}
|
||||
|
||||
# TEST
|
||||
# ==============================================================================
|
||||
PHONY+=test/unit
|
||||
test/unit: clean ${EXECUTABLE}
|
||||
go test -v ./pkg/...
|
||||
|
||||
# CLEAN
|
||||
# ==============================================================================
|
||||
PHONY+=clean
|
||||
clean:
|
||||
rm --force --recursive dyndns-client
|
||||
rm --force ${EXECUTABLE} || true
|
||||
rm --force --recursive bin || true
|
||||
|
||||
# TESTS
|
||||
# UN/INSTALL
|
||||
# ==============================================================================
|
||||
PHONY+=test/unit
|
||||
test/unit:
|
||||
CGO_ENABLED=0 \
|
||||
GOPROXY=$(shell go env GOPROXY) \
|
||||
go test -v -p 1 -coverprofile=coverage.txt -covermode=count -timeout 1200s ./pkg/...
|
||||
|
||||
PHONY+=test/integration
|
||||
test/integration:
|
||||
CGO_ENABLED=0 \
|
||||
GOPROXY=$(shell go env GOPROXY) \
|
||||
go test -v -p 1 -count=1 -timeout 1200s ./it/...
|
||||
|
||||
PHONY+=test/coverage
|
||||
test/coverage: test/unit
|
||||
CGO_ENABLED=0 \
|
||||
GOPROXY=$(shell go env GOPROXY) \
|
||||
go tool cover -html=coverage.txt
|
||||
|
||||
# GOLANGCI-LINT
|
||||
# ==============================================================================
|
||||
PHONY+=golangci-lint
|
||||
golangci-lint:
|
||||
golangci-lint run --concurrency=$(shell nproc)
|
||||
|
||||
# INSTALL
|
||||
# ==============================================================================
|
||||
PHONY+=uninstall
|
||||
install: dyndns-client
|
||||
install --directory ${DESTDIR}/etc/bash_completion.d
|
||||
./dyndns-client completion bash > ${DESTDIR}/etc/bash_completion.d/${EXECUTABLE}
|
||||
|
||||
PHONY+=install
|
||||
install: ${EXECUTABLE}
|
||||
install --directory ${DESTDIR}${PREFIX}/bin
|
||||
install --mode 0755 ${EXECUTABLE} ${DESTDIR}${PREFIX}/bin/${EXECUTABLE}
|
||||
install --mode 755 ${EXECUTABLE} ${DESTDIR}${PREFIX}/bin/${EXECUTABLE}
|
||||
|
||||
install --directory ${DESTDIR}${PREFIX}/share/licenses/${EXECUTABLE}
|
||||
install --mode 0644 LICENSE ${DESTDIR}${PREFIX}/share/licenses/${EXECUTABLE}/LICENSE
|
||||
install --directory ${DESTDIR}/usr/lib/systemd/system
|
||||
install --mode 644 systemd/${EXECUTABLE}.service ${DESTDIR}/usr/lib/systemd/system
|
||||
|
||||
install --directory ${DESTDIR}/usr/share/licenses/${EXECUTABLE}
|
||||
install --mode 644 LICENSE ${DESTDIR}/usr/share/licenses/${EXECUTABLE}/LICENSE
|
||||
|
||||
# UNINSTALL
|
||||
# ==============================================================================
|
||||
PHONY+=uninstall
|
||||
uninstall:
|
||||
-rm --force --recursive \
|
||||
${DESTDIR}/etc/bash_completion.d/${EXECUTABLE} \
|
||||
-rm --recursive --force \
|
||||
${DESTDIR}${PREFIX}/bin/${EXECUTABLE} \
|
||||
${DESTDIR}${PREFIX}/share/licenses/${EXECUTABLE}
|
||||
|
||||
# BUILD CONTAINER IMAGE
|
||||
# ==============================================================================
|
||||
PHONY+=container-image/build
|
||||
container-image/build:
|
||||
${CONTAINER_RUNTIME} build \
|
||||
--build-arg VERSION=${VERSION} \
|
||||
--file Dockerfile \
|
||||
--no-cache \
|
||||
--pull \
|
||||
--tag ${DYNDNS_CLIENT_IMAGE_FULLY_QUALIFIED} \
|
||||
.
|
||||
|
||||
# DELETE CONTAINER IMAGE
|
||||
# ==============================================================================
|
||||
PHONY:=container-image/delete
|
||||
container-image/delete:
|
||||
- ${CONTAINER_RUNTIME} image rm ${DYNDNS_CLIENT_IMAGE_FULLY_QUALIFIED}
|
||||
|
||||
# PUSH CONTAINER IMAGE
|
||||
# ==============================================================================
|
||||
PHONY+=container-image/push
|
||||
container-image/push:
|
||||
echo ${DYNDNS_CLIENT_IMAGE_REGISTRY_PASSWORD} | ${CONTAINER_RUNTIME} login ${DYNDNS_CLIENT_IMAGE_REGISTRY_NAME} --username ${DYNDNS_CLIENT_IMAGE_REGISTRY_USER} --password-stdin
|
||||
${CONTAINER_RUNTIME} push ${DYNDNS_CLIENT_IMAGE_FULLY_QUALIFIED}
|
||||
${DESTDIR}/usr/lib/systemd/system/${EXECUTABLE}.service \
|
||||
${DESTDIR}/usr/share/licenses/${EXECUTABLE}/LICENSE
|
||||
|
||||
# PHONY
|
||||
# ==============================================================================
|
||||
# Declare the contents of the PHONY variable as phony. We keep that information
|
||||
# in a variable so we can use it in if_changed.
|
||||
.PHONY: ${PHONY}
|
||||
.PHONY: ${PHONY}
|
||||
|
2
go.mod
2
go.mod
@ -3,7 +3,7 @@ module git.cryptic.systems/volker.raschek/dyndns-client
|
||||
go 1.20
|
||||
|
||||
require (
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2
|
||||
github.com/asaskevich/govalidator/v11 v11.0.1
|
||||
github.com/sirupsen/logrus v1.9.3
|
||||
github.com/vishvananda/netlink v1.3.1
|
||||
)
|
||||
|
@ -152,7 +152,7 @@ func getOutboundIP() net.IP {
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
defer func() { _ = conn.Close() }()
|
||||
defer conn.Close()
|
||||
localAddr := conn.LocalAddr().(*net.UDPAddr)
|
||||
return localAddr.IP
|
||||
}
|
||||
|
@ -6,16 +6,5 @@
|
||||
"local>volker.raschek/renovate-config:actions#master",
|
||||
"local>volker.raschek/renovate-config:golang#master",
|
||||
"local>volker.raschek/renovate-config:regexp#master"
|
||||
],
|
||||
"packageRules": [
|
||||
{
|
||||
"enabled": false,
|
||||
"matchDatasources":[
|
||||
"go"
|
||||
],
|
||||
"matchPackageNames": [
|
||||
"^github\\.com/asaskevich/govalidator"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Reference in New Issue
Block a user