Skip to content

Commit

Permalink
Merge pull request #73 from essentialkaos/develop
Browse files Browse the repository at this point in the history
Version 1.1.2
  • Loading branch information
andyone committed Sep 25, 2023
2 parents e6effa4 + 5f43c14 commit 52e4225
Show file tree
Hide file tree
Showing 14 changed files with 251 additions and 333 deletions.
98 changes: 48 additions & 50 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,45 @@ on:
branches: [master, develop]
pull_request:
branches: [master]
workflow_dispatch:
inputs:
force_run:
description: 'Force workflow run'
required: true
type: choice
options: [yes, no]

permissions:
actions: read
contents: read
statuses: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
Go:
name: Go
runs-on: ubuntu-latest

env:
SRC_DIR: src/github.com/${{ github.repository }}
GO111MODULE: auto

strategy:
matrix:
go: [ '1.17.x', '1.18.x' ]
go: [ '1.20.x', '1.21.x' ]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
id: go

- name: Setup PATH
run: |
echo "GOPATH=${{ github.workspace }}" >> "$GITHUB_ENV"
echo "GOBIN=${{ github.workspace }}/bin" >> "$GITHUB_ENV"
echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH"
- name: Checkout
uses: actions/checkout@v3
with:
path: ${{env.SRC_DIR}}

- name: Download dependencies
working-directory: ${{env.SRC_DIR}}
run: make deps

- name: Run tests
working-directory: ${{env.SRC_DIR}}
run: make all

Aligo:
Expand All @@ -51,36 +52,21 @@ jobs:

needs: Go

env:
SRC_DIR: src/github.com/${{ github.repository }}
GO111MODULE: auto

steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.17.x'
id: go

- name: Setup PATH
run: |
echo "GOPATH=${{ github.workspace }}" >> "$GITHUB_ENV"
echo "GOBIN=${{ github.workspace }}/bin" >> "$GITHUB_ENV"
echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH"
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
path: ${{env.SRC_DIR}}
go-version: '1.20.x'

- name: Download dependencies
working-directory: ${{env.SRC_DIR}}
run: make deps

- name: Check Golang sources with Aligo
uses: essentialkaos/aligo-action@v1
uses: essentialkaos/aligo-action@v2
with:
path: ${{env.SRC_DIR}}
files: ./...

Perfecto:
Expand All @@ -91,18 +77,30 @@ jobs:

steps:
- name: Code checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Login to DockerHub
uses: docker/login-action@v1
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
if: ${{ env.DOCKERHUB_USERNAME != '' }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Check specs with Perfecto
uses: essentialkaos/perfecto-action@v1
uses: essentialkaos/perfecto-action@v2
with:
files: common/updown-badge-server.spec

Typos:
name: Typos
runs-on: ubuntu-latest

needs: Go

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Check spelling
continue-on-error: true
uses: crate-ci/typos@master
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: go

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2
2 changes: 2 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[files]
extend-exclude = ["go.sum"]
71 changes: 57 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
################################################################################

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

export GO111MODULE=on

ifdef VERBOSE ## Print verbose information (Flag)
VERBOSE_FLAG = -v
endif

MAKEDIR = $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
GITREV ?= $(shell test -s $(MAKEDIR)/.git && git rev-parse --short HEAD)

################################################################################

.DEFAULT_GOAL := help
.PHONY = fmt vet all clean deps mod-init mod-update mod-vendor help
.PHONY = fmt vet all clean deps update init vendor mod-init mod-update mod-download mod-vendor help

################################################################################

all: updown-badge-server ## Build all binaries

updown-badge-server: ## Build updown-badge-server binary
go build updown-badge-server.go
updown-badge-server:
go build $(VERBOSE_FLAG) -ldflags="-X main.gitrev=$(GITREV)" updown-badge-server.go

install: ## Install all binaries
cp updown-badge-server /usr/bin/updown-badge-server

uninstall: ## Uninstall all binaries
rm -f /usr/bin/updown-badge-server

deps: mod-update ## Download dependencies
init: mod-init ## Initialize new module

mod-init: ## Initialize new module
go mod init
go mod tidy
deps: mod-download ## Download dependencies

update: mod-update ## Update dependencies to the latest versions

mod-update: ## Download modules to local cache
vendor: mod-vendor ## Make vendored copy of dependencies

mod-init:
ifdef MODULE_PATH ## Module path for initialization (String)
go mod init $(MODULE_PATH)
else
go mod init
endif

ifdef COMPAT ## Compatible Go version (String)
go mod tidy $(VERBOSE_FLAG) -compat=$(COMPAT)
else
go mod tidy $(VERBOSE_FLAG)
endif

mod-update:
ifdef UPDATE_ALL ## Update all dependencies (Flag)
go get -u $(VERBOSE_FLAG) all
else
go get -u $(VERBOSE_FLAG) ./...
endif

ifdef COMPAT
go mod tidy $(VERBOSE_FLAG) -compat=$(COMPAT)
else
go mod tidy $(VERBOSE_FLAG)
endif

test -d vendor && rm -rf vendor && go mod vendor $(VERBOSE_FLAG) || :

mod-download:
go mod download

mod-vendor: ## Make vendored copy of dependencies
go mod vendor
mod-vendor:
rm -rf vendor && go mod vendor $(VERBOSE_FLAG)

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

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

clean: ## Remove generated files
rm -f updown-badge-server

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

################################################################################
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@

### Installation

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

```bash
sudo yum install -y https://yum.kaos.st/get/$(uname -r).rpm
sudo yum install -y https://pkgs.kaos.st/kaos-repo-latest.el$(grep 'CPE_NAME' /etc/os-release | tr -d '"' | cut -d':' -f5).noarch.rpm
sudo yum install updown-badge-server
```

Expand Down
85 changes: 0 additions & 85 deletions common/updown-badge-server.init

This file was deleted.

4 changes: 2 additions & 2 deletions common/updown-badge-server.knf
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
[updown]

# updown.io read-only API key
api-key:
api-key:

[badge]

# Path to font for badge (we recommend using Verdana)
font:
font: /usr/share/fonts/Verdana.ttf

# Badge style (plastic, flat, flat-square)
style: flat
Expand Down
Loading

0 comments on commit 52e4225

Please sign in to comment.