Skip to content

Commit

Permalink
Merge pull request #113 from essentialkaos/develop
Browse files Browse the repository at this point in the history
Version 1.3.0
  • Loading branch information
andyone authored Feb 17, 2024
2 parents d2a5fe3 + e00cac1 commit a39b193
Show file tree
Hide file tree
Showing 16 changed files with 167 additions and 114 deletions.
57 changes: 30 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,35 +24,28 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

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

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

strategy:
matrix:
go: [ '1.19.x', '1.20.x' ]
go: [ '1.21.x', '1.22.x' ]

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

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

- name: Checkout
uses: actions/checkout@v3
with:
path: ${{env.SRC_DIR}}

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

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

Aligo:
Expand All @@ -62,24 +55,20 @@ jobs:
needs: Go

steps:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.19.x'

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

- name: Set up Go
uses: actions/setup-go@v5
with:
path: ${{env.SRC_DIR}}
go-version: '1.21.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: ./...

Shellcheck:
Expand All @@ -90,7 +79,7 @@ jobs:

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

- name: Check scripts with Shellcheck
uses: essentialkaos/shellcheck-action@v1
Expand All @@ -105,13 +94,27 @@ jobs:

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

- name: Check dockerfiles with Hadolint
uses: essentialkaos/hadolint-action@v1
with:
files: .docker/ol7.docker .docker/ol8.docker .docker/ol9.docker

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

DockerBuild:
name: Docker Build Check
runs-on: ubuntu-latest
Expand All @@ -136,11 +139,11 @@ jobs:
# More info about issue: https://github.com/actions/runner/issues/491
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
if: ${{ github.event_name == 'pull_request' }}

- name: Login to DockerHub
uses: docker/login-action@v2
uses: docker/login-action@v3
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
if: ${{ github.event_name == 'pull_request' && env.DOCKERHUB_USERNAME != '' }}
Expand All @@ -149,7 +152,7 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
if: ${{ github.event_name == 'pull_request' }}
with:
registry: ghcr.io
Expand Down
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@v2
uses: github/codeql-action/init@v3
with:
languages: go

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
10 changes: 5 additions & 5 deletions .github/workflows/docker-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,18 @@ jobs:

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

- name: Login to DockerHub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
Expand Down Expand Up @@ -149,7 +149,7 @@ jobs:
- name: Build and push Docker images (Docker)
if: ${{ steps.build_check.outputs.build == 'true' }}
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
push: true
context: .
Expand All @@ -160,7 +160,7 @@ jobs:

- name: Build and push Docker images (GHCR)
if: ${{ steps.build_check.outputs.build == 'true' }}
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
push: true
context: .
Expand Down
5 changes: 5 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[files]
extend-exclude = ["go.sum"]

[default.extend-identifiers]
O_WRONLY = "O_WRONLY"
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#### From source

To build the `bop` from scratch, make sure you have a working Go 1.18+ workspace (_[instructions](https://golang.org/doc/install)_), then:
To build the `bop` from scratch, make sure you have a working Go 1.18+ workspace (_[instructions](https://go.dev/doc/install)_), then:

```bash
go install github.com/essentialkaos/bop@latest
Expand All @@ -34,7 +34,7 @@ bash <(curl -fsSL https://apps.kaos.st/get) bop

#### Container image

Official `bop` images available on [GitHub Container Registry](https://kaos.sh/p/bop) and [Docker Hub](https://kaos.sh/d/bop). Install the latest version of Podman or Docker, then:
Official `bop` images available on [GitHub Container Registry](https://kaos.sh/p/bop) and [Docker Hub](https://kaos.sh/d/bop). Install the latest version of [Podman](https://podman.io/getting-started/installation.html) or [Docker](https://docs.docker.com/engine/install/), then:

```bash
curl -#L -o bop-container https://kaos.sh/bop/bop-container
Expand Down Expand Up @@ -80,7 +80,7 @@ Usage: bop {options} name package…
Options
--output, -o file Output file
--service, -s service List of services for checking (mergable)
--service, -s service List of services for checking (mergeable)
--no-color, -nc Disable colors in output
--help, -h Show this help message
--version, -v Show version
Expand Down
2 changes: 1 addition & 1 deletion bop-container
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ main() {
engine=$(getContainerEngine)

if [[ -z "$engine" ]] ; then
error "You must install Docker first"
error "You must install Podman or Docker first"
exit 1
fi

Expand Down
2 changes: 1 addition & 1 deletion bop.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package main

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2023 ESSENTIAL KAOS //
// Copyright (c) 2024 ESSENTIAL KAOS //
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down
52 changes: 27 additions & 25 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package cli

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2023 ESSENTIAL KAOS //
// Copyright (c) 2024 ESSENTIAL KAOS //
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
Expand All @@ -19,6 +19,7 @@ import (
"github.com/essentialkaos/ek/v12/fsutil"
"github.com/essentialkaos/ek/v12/options"
"github.com/essentialkaos/ek/v12/pluralize"
"github.com/essentialkaos/ek/v12/terminal/tty"
"github.com/essentialkaos/ek/v12/timeutil"
"github.com/essentialkaos/ek/v12/usage"
"github.com/essentialkaos/ek/v12/usage/completion/bash"
Expand All @@ -38,7 +39,7 @@ import (
// App info
const (
APP = "bop"
VER = "1.2.2"
VER = "1.3.0"
DESC = "Utility for generating formal bibop tests for RPM packages"
)

Expand Down Expand Up @@ -71,6 +72,8 @@ var optMap = options.Map{
OPT_GENERATE_MAN: {Type: options.BOOL},
}

var colorTagApp, colorTagVer string

// ////////////////////////////////////////////////////////////////////////////////// //

// Run is main utility function
Expand Down Expand Up @@ -113,25 +116,17 @@ func Run(gitRev string, gomod []byte) {

// preConfigureUI preconfigures UI based on information about user terminal
func preConfigureUI() {
term := os.Getenv("TERM")

fmtc.DisableColors = true

if term != "" {
switch {
case strings.Contains(term, "xterm"),
strings.Contains(term, "color"),
term == "screen":
fmtc.DisableColors = false
}
}

if !fsutil.IsCharacterDevice("/dev/stdout") && os.Getenv("FAKETTY") == "" {
if !tty.IsTTY() {
fmtc.DisableColors = true
}

if os.Getenv("NO_COLOR") != "" {
fmtc.DisableColors = true
switch {
case fmtc.IsTrueColorSupported():
colorTagApp, colorTagVer = "{*}{#9966CC}", "{#9966CC}"
case fmtc.Is256ColorsSupported():
colorTagApp, colorTagVer = "{*}{#140}", "{#140}"
default:
colorTagApp, colorTagVer = "{*}{m}", "{m}"
}
}

Expand Down Expand Up @@ -229,7 +224,7 @@ func printWarn(f string, a ...interface{}) {
fmtc.Fprintf(os.Stderr, "{y}"+f+"{!}\n", a...)
}

// printErrorAndExit print error mesage and exit with exit code 1
// printErrorAndExit print error message and exit with exit code 1
func printErrorAndExit(f string, a ...interface{}) {
printError(f, a...)
os.Exit(1)
Expand Down Expand Up @@ -269,8 +264,10 @@ func printMan() {
func genUsage() *usage.Info {
info := usage.NewInfo("", "name", "package…")

info.AppNameColorTag = colorTagApp

info.AddOption(OPT_OUTPUT, "Output file", "file")
info.AddOption(OPT_SERVICE, "List of services for checking {c}(mergable){!}", "service")
info.AddOption(OPT_SERVICE, "List of services for checking {c}(mergeable){!}", "service")
info.AddOption(OPT_NO_COLOR, "Disable colors in output")
info.AddOption(OPT_HELP, "Show this help message")
info.AddOption(OPT_VER, "Show version")
Expand All @@ -285,11 +282,16 @@ func genUsage() *usage.Info {
// genAbout generates info about version
func genAbout(gitRev string) *usage.About {
about := &usage.About{
App: APP,
Version: VER,
Desc: DESC,
Year: 2006,
Owner: "ESSENTIAL KAOS",
App: APP,
Version: VER,
Desc: DESC,
Year: 2006,
Owner: "ESSENTIAL KAOS",

AppNameColorTag: colorTagApp,
VersionColorTag: colorTagVer,
DescSeparator: "{s}—{!}",

License: "Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0>",
UpdateChecker: usage.UpdateChecker{"essentialkaos/bop", update.GitHubChecker},
}
Expand Down
Loading

0 comments on commit a39b193

Please sign in to comment.