Skip to content

Commit

Permalink
Refactor workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
joeig committed Apr 10, 2024
1 parent 0271530 commit 33b4df3
Show file tree
Hide file tree
Showing 9 changed files with 119 additions and 47 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: build
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
concurrency:
group: "${{ github.workflow }}-$${{ github.pull_request.number || github.run_id }}"
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- run: go build ./cmd/dyndns-pdns
24 changes: 24 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: golangci-lint
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
concurrency:
group: "${{ github.workflow }}-$${{ github.pull_request.number || github.run_id }}"
cancel-in-progress: true
jobs:
golangci-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- uses: golangci/golangci-lint-action@v4
with:
version: v1.57.2
24 changes: 24 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: lint
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
concurrency:
group: "${{ github.workflow }}-$${{ github.pull_request.number || github.run_id }}"
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- run: |
gofmt -d .
test -z $(gofmt -l .)
23 changes: 23 additions & 0 deletions .github/workflows/staticcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: staticcheck
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
concurrency:
group: "${{ github.workflow }}-$${{ github.pull_request.number || github.run_id }}"
cancel-in-progress: true
jobs:
staticcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- run: go install honnef.co/go/tools/cmd/staticcheck@latest
- run: $(go env GOPATH)/bin/staticcheck ./...
23 changes: 23 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: test
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
concurrency:
group: "${{ github.workflow }}-$${{ github.pull_request.number || github.run_id }}"
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- run: go test -v -coverprofile="coverage.out" ./...
- run: go tool cover -func="coverage.out"
43 changes: 0 additions & 43 deletions .github/workflows/tests.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/configs/server.crt
/configs/server.csr
/configs/server.key
/c.out
/coverage.out
/dyndns-pdns
/dyndns-pdns_linux_amd64
/vendor/
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ build-linux-amd64:
GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(BINARY_NAME)_linux_amd64 -v ./cmd/dyndns-pdns

test:
$(GOTEST) -v ./... -covermode=count -coverprofile=c.out
$(GOTEST) -v ./... -covermode=count -coverprofile=coverage.out

coverage:
$(GOCOVER) -func=c.out
$(GOCOVER) -func=coverage.out

check-fmt:
$(GOFMT) -d ${GOFILES}
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

Collects IPv4/IPv6 addresses of network devices (routers, firewalls etc.) and writes the corresponding PowerDNS resource records.

[![Tests](https://github.com/joeig/dyndns-pdns/actions/workflows/tests.yml/badge.svg)](https://github.com/joeig/dyndns-pdns/actions/workflows/tests.yml)
[![Go Report Card](https://goreportcard.com/badge/github.com/joeig/dyndns-pdns)](https://goreportcard.com/report/github.com/joeig/dyndns-pdns)

## Setup
Expand Down

0 comments on commit 33b4df3

Please sign in to comment.