Skip to content

Commit 157525c

Browse files
authored
Merge pull request #118 from essentialkaos/develop
Version 3.2.2
2 parents 670cea6 + c6aa89d commit 157525c

File tree

11 files changed

+796
-618
lines changed

11 files changed

+796
-618
lines changed

.github/workflows/ci.yml

+37-14
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,45 @@ on:
77
branches: [master]
88
schedule:
99
- cron: '0 14 */15 * *'
10+
workflow_dispatch:
11+
inputs:
12+
force_run:
13+
description: 'Force workflow run'
14+
required: true
15+
type: choice
16+
options: [yes, no]
17+
18+
permissions:
19+
actions: read
20+
contents: read
21+
statuses: write
22+
23+
concurrency:
24+
group: ${{ github.workflow }}-${{ github.ref }}
25+
cancel-in-progress: true
1026

1127
jobs:
1228
Go:
1329
name: Go
1430
runs-on: ubuntu-latest
1531

16-
env:
17-
SRC_DIR: src/github.com/${{ github.repository }}
18-
1932
strategy:
2033
matrix:
21-
go: [ '1.18.x', '1.19.x' ]
34+
go: [ '1.21.x', '1.22.x' ]
2235

2336
steps:
37+
- name: Checkout
38+
uses: actions/checkout@v4
39+
2440
- name: Set up Go
25-
uses: actions/setup-go@v3
41+
uses: actions/setup-go@v5
2642
with:
2743
go-version: ${{ matrix.go }}
2844

29-
- name: Checkout
30-
uses: actions/checkout@v3
31-
with:
32-
path: ${{env.SRC_DIR}}
33-
3445
- name: Download dependencies
35-
working-directory: ${{env.SRC_DIR}}
3646
run: make deps
3747

3848
- name: Build binary
39-
working-directory: ${{env.SRC_DIR}}
4049
run: make all
4150

4251
Perfecto:
@@ -47,10 +56,10 @@ jobs:
4756

4857
steps:
4958
- name: Code checkout
50-
uses: actions/checkout@v3
59+
uses: actions/checkout@v4
5160

5261
- name: Login to GitHub Container Registry
53-
uses: docker/login-action@v2
62+
uses: docker/login-action@v3
5463
with:
5564
registry: ghcr.io
5665
username: ${{ github.actor }}
@@ -60,3 +69,17 @@ jobs:
6069
uses: essentialkaos/perfecto-action@v2
6170
with:
6271
files: common/redis-latency-monitor.spec
72+
73+
Typos:
74+
name: Typos
75+
runs-on: ubuntu-latest
76+
77+
needs: Go
78+
79+
steps:
80+
- name: Checkout
81+
uses: actions/checkout@v4
82+
83+
- name: Check spelling
84+
continue-on-error: true
85+
uses: crate-ci/typos@master

.github/workflows/codeql.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ jobs:
2020

2121
steps:
2222
- name: Checkout repository
23-
uses: actions/checkout@v3
23+
uses: actions/checkout@v4
2424
with:
2525
fetch-depth: 2
2626

2727
- name: Initialize CodeQL
28-
uses: github/codeql-action/init@v2
28+
uses: github/codeql-action/init@v3
2929
with:
3030
languages: go
3131

3232
- name: Perform CodeQL Analysis
33-
uses: github/codeql-action/analyze@v2
33+
uses: github/codeql-action/analyze@v3

.typos.toml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[files]
2+
extend-exclude = ["go.sum"]
3+
4+
[default.extend-identifiers]
5+
O_WRONLY = "O_WRONLY"

Makefile

+57-14
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
################################################################################
22

3-
# This Makefile generated by GoMakeGen 1.5.1 using next command:
3+
# This Makefile generated by GoMakeGen 2.2.0 using next command:
44
# gomakegen --mod .
55
#
66
# More info: https://kaos.sh/gomakegen
@@ -9,48 +9,91 @@
99

1010
export GO111MODULE=on
1111

12+
ifdef VERBOSE ## Print verbose information (Flag)
13+
VERBOSE_FLAG = -v
14+
endif
15+
16+
MAKEDIR = $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
17+
GITREV ?= $(shell test -s $(MAKEDIR)/.git && git rev-parse --short HEAD)
18+
19+
################################################################################
20+
1221
.DEFAULT_GOAL := help
13-
.PHONY = fmt vet all clean deps mod-init mod-update mod-vendor help
22+
.PHONY = fmt vet all clean deps update init vendor mod-init mod-update mod-download mod-vendor help
1423

1524
################################################################################
1625

1726
all: redis-latency-monitor ## Build all binaries
1827

19-
redis-latency-monitor: ## Build redis-latency-monitor binary
20-
go build redis-latency-monitor.go
28+
redis-latency-monitor:
29+
go build $(VERBOSE_FLAG) -ldflags="-X main.gitrev=$(GITREV)" redis-latency-monitor.go
2130

2231
install: ## Install all binaries
2332
cp redis-latency-monitor /usr/bin/redis-latency-monitor
2433

2534
uninstall: ## Uninstall all binaries
2635
rm -f /usr/bin/redis-latency-monitor
2736

28-
deps: mod-update ## Download dependencies
37+
init: mod-init ## Initialize new module
2938

30-
mod-init: ## Initialize new module
31-
go mod init
32-
go mod tidy
39+
deps: mod-download ## Download dependencies
40+
41+
update: mod-update ## Update dependencies to the latest versions
3342

34-
mod-update: ## Download modules to local cache
43+
vendor: mod-vendor ## Make vendored copy of dependencies
44+
45+
mod-init:
46+
ifdef MODULE_PATH ## Module path for initialization (String)
47+
go mod init $(MODULE_PATH)
48+
else
49+
go mod init
50+
endif
51+
52+
ifdef COMPAT ## Compatible Go version (String)
53+
go mod tidy $(VERBOSE_FLAG) -compat=$(COMPAT)
54+
else
55+
go mod tidy $(VERBOSE_FLAG)
56+
endif
57+
58+
mod-update:
59+
ifdef UPDATE_ALL ## Update all dependencies (Flag)
60+
go get -u $(VERBOSE_FLAG) all
61+
else
62+
go get -u $(VERBOSE_FLAG) ./...
63+
endif
64+
65+
ifdef COMPAT
66+
go mod tidy $(VERBOSE_FLAG) -compat=$(COMPAT)
67+
else
68+
go mod tidy $(VERBOSE_FLAG)
69+
endif
70+
71+
test -d vendor && rm -rf vendor && go mod vendor $(VERBOSE_FLAG) || :
72+
73+
mod-download:
3574
go mod download
3675

37-
mod-vendor: ## Make vendored copy of dependencies
38-
go mod vendor
76+
mod-vendor:
77+
rm -rf vendor && go mod vendor $(VERBOSE_FLAG)
3978

4079
fmt: ## Format source code with gofmt
4180
find . -name "*.go" -exec gofmt -s -w {} \;
4281

43-
vet: ## Runs go vet over sources
82+
vet: ## Runs 'go vet' over sources
4483
go vet -composites=false -printfuncs=LPrintf,TLPrintf,TPrintf,log.Debug,log.Info,log.Warn,log.Error,log.Critical,log.Print ./...
4584

4685
clean: ## Remove generated files
4786
rm -f redis-latency-monitor
4887

4988
help: ## Show this info
50-
@echo -e '\n\033[1mSupported targets:\033[0m\n'
89+
@echo -e '\n\033[1mTargets:\033[0m\n'
5190
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
5291
| awk 'BEGIN {FS = ":.*?## "}; {printf " \033[33m%-23s\033[0m %s\n", $$1, $$2}'
92+
@echo -e '\n\033[1mVariables:\033[0m\n'
93+
@grep -E '^ifdef [A-Z_]+ .*?## .*$$' $(abspath $(lastword $(MAKEFILE_LIST))) \
94+
| sed 's/ifdef //' \
95+
| awk 'BEGIN {FS = " .*?## "}; {printf " \033[32m%-14s\033[0m %s\n", $$1, $$2}'
5396
@echo -e ''
54-
@echo -e '\033[90mGenerated by GoMakeGen 1.5.1\033[0m\n'
97+
@echo -e '\033[90mGenerated by GoMakeGen 2.2.0\033[0m\n'
5598

5699
################################################################################

README.md

+3-9
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,16 @@ Tiny Redis client for latency measurement. Utility show `PING` command latency o
2222

2323
#### From source
2424

25-
To build the `redis-latency-monitor` from scratch, make sure you have a working Go 1.17+ workspace (_[instructions](https://golang.org/doc/install)_), then:
25+
To build the `redis-latency-monitor` from scratch, make sure you have a working Go 1.19+ workspace (_[instructions](https://go.dev/doc/install)_), then:
2626

2727
```
28-
go get github.com/essentialkaos/redis-latency-monitor
29-
```
30-
31-
If you want to update `redis-latency-monitor` to latest stable release, do:
32-
33-
```
34-
go get -u github.com/essentialkaos/redis-latency-monitor
28+
go install github.com/essentialkaos/redis-latency-monitor@latest
3529
```
3630

3731
#### From [ESSENTIAL KAOS Public Repository](https://yum.kaos.st)
3832

3933
```bash
40-
sudo yum install -y https://yum.kaos.st/get/$(uname -r).rpm
34+
sudo yum install -y https://yum.kaos.st/kaos-repo-latest.el$(grep 'CPE_NAME' /etc/os-release | tr -d '"' | cut -d':' -f5).noarch.rpm
4135
sudo yum install redis-latency-monitor
4236
```
4337

0 commit comments

Comments
 (0)