Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
use_docker: false
40 changes: 40 additions & 0 deletions .chglog/CHANGELOG.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{{ if .Versions -}}
{{ if .Unreleased.CommitGroups -}}
<a name="unreleased"></a>
## [Unreleased]

{{ range .Unreleased.CommitGroups -}}
### {{ .Title }}
{{ range .Commits -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{ end -}}
{{ end -}}
{{ end -}}

{{ range .Versions -}}
<a name="{{ .Tag.Name }}"></a>
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]{{ else }}{{ .Tag.Name }}{{ end }} - {{ datetime "2006-01-02" .Tag.Date }}
{{ range .CommitGroups -}}
### {{ .Title }}
{{ range .Commits -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{ end }}
{{ end -}}

{{ if .NoteGroups -}}
{{ range .NoteGroups -}}
### {{ .Title }}
{{ range .Notes }}
{{ .Body }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}

[Unreleased]: {{ .Info.RepositoryURL }}/compare/{{ $latest := index .Versions 0 }}{{ $latest.Tag.Name }}...HEAD
{{ range .Versions -}}
{{ if .Tag.Previous -}}
[{{ .Tag.Name }}]: {{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}
{{ end -}}
{{ end -}}
{{ end -}}
39 changes: 39 additions & 0 deletions .chglog/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
style: github
template: CHANGELOG.tpl.md
info:
title: CHANGELOG
repository_url: https://github.com/xaque208/freebsd_exporter
options:
commits:
filters:
Type:
- docs
- feat
- fix

commit_groups:
title_maps:
docs: Documentation Updates
feat: Features
fix: Bug Fixes

refs:
actions:
- Closes
- Fixes
- Resolves

issues:
prefix:
- "#"

header:
pattern: "^(\\w*)(?:\\(([\\/\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$"
pattern_maps:
- Type
- Scope
- Subject

notes:
keywords:
- BREAKING CHANGE
7 changes: 6 additions & 1 deletion .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,10 @@
"labels": [
"dependencies"
],
"prConcurrentLimit": 4
"prConcurrentLimit": 4,
"automerge": true,
"assignAutomerge": true,
"reviewers": [
"xaque208"
]
}
6 changes: 3 additions & 3 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ name: Changelog

on:
push:
tags: ['v*']
tags: ["v*"]

jobs:
createPullRequest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version: 1.17.x
go-version: 1.18.x

- name: Update Changelog
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ jobs:
strategy:
matrix:
go-version:
- 1.17.x
- 1.18.x
platform:
- ubuntu-latest
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/gitlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
gitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 20
- uses: g4s8/gitlint-action@0.3.1
- uses: g4s8/gitlint-action@0.2
with:
since: "2021-11-18"
since: "2020-03-30"
pattern: '(chore|docs|feat|fix|refactor|tests?)(\([^\)]+\))?: .*'
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.17.x
go-version: 1.18.x

- name: Cache deps
uses: actions/cache@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.17.x
go-version: 1.18.x

- name: Publish Release
shell: bash
Expand Down
26 changes: 13 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.17.x
go-version: 1.18.x

- name: Add GOBIN to PATH
run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
Expand All @@ -36,16 +36,16 @@ jobs:
- name: Integration Tests
run: make test-integration

- name: Coverage Report
run: make cover-report
# - name: Coverage Report
# run: make cover-report

- uses: jandelgado/gcov2lcov-action@v1.0.8
with:
infile: coverage/coverage.out
outfile: coverage/coverage.lcov
# - uses: jandelgado/gcov2lcov-action@v1.0.8
# with:
# infile: coverage/coverage.out
# outfile: coverage/coverage.lcov

- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: coverage/coverage.lcov
# - name: Coveralls
# uses: coverallsapp/github-action@master
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# path-to-lcov: coverage/coverage.lcov
28 changes: 12 additions & 16 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project_name: znet
project_name: freebsd_exporter

env:
- GO111MODULE=on
Expand All @@ -8,21 +8,25 @@ before:
- go mod download

builds:
- id: znet
# dir: cmd/znet
binary: znet
- id: freebsd_exporter
dir: cmd/freebsd_exporter
binary: freebsd_exporter
env:
- CGO_ENABLED=0
goarm:
- "5"
- "6"
- "7"
- 6
- 7
goos:
- linux
- freebsd
goarch:
- amd64
- arm
ldflags:
- -s -w -X main.version={{.Version}} -X main.appName={{.Binary}}
ignore:
- goos: freebsd
goarch: arm

archives:
- replacements:
Expand All @@ -37,14 +41,6 @@ snapshot:
changelog:
skip: true

dockers:
- dockerfile: build/package/Dockerfile
image_templates:
- "xaque208/znet:{{ .Tag }}"
- "xaque208/znet:v{{ .Major }}.{{ .Minor }}"
- "xaque208/znet:latest"
build_flag_templates:
- "--pull"
- "--label=repository=https://github.com/xaque208/znet"

release:
name_template: "{{.ProjectName}} v{{.Version}}"
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ PROJECT_MODULE ?= $(shell $(GO) list -m)
all: build

# Humans running make:
build: check-version clean lint test cover-report proto gofmt-fix compile
build: check-version clean lint test cover-report gofmt-fix compile

# Build command for CI tooling
build-ci: check-version clean lint test compile-only
Expand Down
21 changes: 10 additions & 11 deletions build/compile.mk
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,21 @@ compile-all: deps-only
compile-only: deps-only
@echo "=== $(PROJECT_NAME) === [ compile ]: building commands:"
@mkdir -p $(BUILD_DIR)/$(GOOS)
CGO_ENABLED=0 GOOS=$(GOOS) $(GO) build -ldflags=$(LDFLAGS) -o $(BUILD_DIR)/$(GOOS)/$(PROJECT_NAME) . ;
@# @for b in $(BINS); do \
# echo "=== $(PROJECT_NAME) === [ compile ]: $(BUILD_DIR)$(GOOS)/$$b"; \
# BUILD_FILES=`find $(SRCDIR)/cmd/$$b -type f -name "*.go"` ; \
GOOS=$(GOOS) $(GO) build -ldflags=$(LDFLAGS) -o $(BUILD_DIR)/$(GOOS)/$$b $$BUILD_FILES ; \
# done
@for b in $(BINS); do \
echo "=== $(PROJECT_NAME) === [ compile ]: $(BUILD_DIR)$(GOOS)/$$b"; \
BUILD_FILES=`find $(SRCDIR)/cmd/$$b -type f -name "*.go"` ; \
CGO_ENABLED=0 GOOS=$(GOOS) $(GO) build -ldflags=$(LDFLAGS) -o $(BUILD_DIR)/$(GOOS)/$$b $$BUILD_FILES ; \
done

# Override GOOS for these specific targets
compile-freebsd: GOOS=freebsd
compile-freebsd: deps-only compile-only
compile-darwin: GOOS=darwin
compile-darwin: deps-only compile-only

compile-linux: GOOS=linux
compile-linux: deps-only compile-only

compile-windows: GOOS=windows
compile-windows: deps-only compile-only
compile-freebsd: GOOS=freebsd
compile-freebsd: deps-only compile-only


.PHONY: clean-compile compile compile-freebsd compile-linux compile-only compile-windows
.PHONY: clean-compile compile compile-darwin compile-linux compile-only compile-freebsd
5 changes: 4 additions & 1 deletion build/docker.mk
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ docker-login:
@echo ${DOCKER_PASSWORD} | $(DOCKER) login -u ${DOCKER_USERNAME} --password-stdin

docker:
docker build -t xaque208/znet .
docker build -t xaque208/freebsd_exporter .

docker-snapshot: docker
docker tag xaque208/freebsd_exporter:latest xaque208/freebsd_exporter:${PROJECT_VER}
docker push xaque208/freebsd_exporter:${PROJECT_VER}

.PHONY: docker-login
2 changes: 1 addition & 1 deletion build/lint.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ GOLINTER = golangci-lint
EXCLUDEDIR ?= .git
SRCDIR ?= .
GO_PKGS ?= $(shell ${GO} list ./... | grep -v -e "/vendor/" -e "/example")
FILES ?= $(shell find ${SRCDIR} -type f | grep -v -e '.git/' -e '/vendor/')
FILES ?= $(shell find ${SRCDIR} -type f | grep -v -e '.git/' -e '/vendor/' -e 'go.*')
GO_FILES ?= $(shell find $(SRCDIR) -type f -name "*.go" | grep -v -e ".git/" -e '/vendor/' -e '/example/')
PROJECT_MODULE ?= $(shell $(GO) list -m)

Expand Down
9 changes: 5 additions & 4 deletions build/package/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM alpine:3.15
COPY znet /bin/znet
RUN mkdir /var/znet
ENTRYPOINT ["/bin/znet"]
FROM alpine:3.16
COPY freebsd_exporter /bin/freebsd_exporter
RUN chmod 0700 /bin/freebsd_exporter
RUN apk --update add ca-certificates tzdata
ENTRYPOINT ["/bin/freebsd_exporter"]
Loading