Skip to content

Commit aa32f5e

Browse files
authored
Merge pull request #15 from funbox/develop
Version 0.12.0
2 parents 3c9ccb0 + d22b459 commit aa32f5e

File tree

8 files changed

+243
-156
lines changed

8 files changed

+243
-156
lines changed

.github/dependabot.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
version: 2
2+
3+
updates:
4+
- package-ecosystem: "gomod"
5+
directory: "/"
6+
target-branch: "develop"
7+
schedule:
8+
interval: "daily"
9+
timezone: "Europe/Moscow"
10+
time: "15:00"
11+
labels:
12+
- "PR • MAINTENANCE"
13+
assignees:
14+
- "andyone"
15+
reviewers:
16+
- "andyone"
17+
18+
- package-ecosystem: "github-actions"
19+
directory: "/"
20+
target-branch: "develop"
21+
schedule:
22+
interval: "daily"
23+
timezone: "Europe/Moscow"
24+
time: "15:00"
25+
labels:
26+
- "PR • MAINTENANCE"
27+
assignees:
28+
- "andyone"
29+
reviewers:
30+
- "andyone"

.github/workflows/ci.yml

Lines changed: 28 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,40 @@ on:
55
branches: [master, develop]
66
pull_request:
77
branches: [master]
8+
workflow_dispatch:
9+
inputs:
10+
force_run:
11+
description: 'Force workflow run'
12+
required: true
13+
type: choice
14+
options: [yes, no]
15+
16+
permissions:
17+
actions: read
18+
contents: read
19+
statuses: write
20+
21+
concurrency:
22+
group: ${{ github.workflow }}-${{ github.ref }}
23+
cancel-in-progress: true
24+
25+
env:
26+
SRC_DIR: src/github.com/${{ github.repository }}
827

928
jobs:
1029
Go:
1130
name: Go
1231
runs-on: ubuntu-latest
1332

14-
env:
15-
SRC_DIR: src/github.com/${{ github.repository }}
16-
GO111MODULE: auto
17-
1833
strategy:
1934
matrix:
20-
go: [ '1.17.x', '1.18.x' ]
35+
go: [ '1.19.x', '1.20.x' ]
2136

2237
steps:
2338
- name: Set up Go
2439
uses: actions/setup-go@v2
2540
with:
2641
go-version: ${{ matrix.go }}
27-
id: go
28-
29-
- name: Setup PATH
30-
run: |
31-
echo "GOPATH=${{ github.workspace }}" >> "$GITHUB_ENV"
32-
echo "GOBIN=${{ github.workspace }}/bin" >> "$GITHUB_ENV"
33-
echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH"
3442

3543
- name: Checkout
3644
uses: actions/checkout@v3
@@ -39,8 +47,7 @@ jobs:
3947

4048
- name: Download dependencies
4149
working-directory: ${{env.SRC_DIR}}
42-
run: |
43-
make deps
50+
run: make deps
4451

4552
- name: Build binaries
4653
working-directory: ${{env.SRC_DIR}}
@@ -52,22 +59,11 @@ jobs:
5259

5360
needs: Go
5461

55-
env:
56-
SRC_DIR: src/github.com/${{ github.repository }}
57-
GO111MODULE: auto
58-
5962
steps:
6063
- name: Set up Go
6164
uses: actions/setup-go@v2
6265
with:
63-
go-version: '1.17.x'
64-
id: go
65-
66-
- name: Setup PATH
67-
run: |
68-
echo "GOPATH=${{ github.workspace }}" >> "$GITHUB_ENV"
69-
echo "GOBIN=${{ github.workspace }}/bin" >> "$GITHUB_ENV"
70-
echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH"
66+
go-version: '1.19.x'
7167

7268
- name: Checkout
7369
uses: actions/checkout@v3
@@ -94,16 +90,14 @@ jobs:
9490
- name: Code checkout
9591
uses: actions/checkout@v3
9692

97-
- name: Login to DockerHub
98-
uses: docker/login-action@v1
99-
env:
100-
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
101-
if: ${{ env.DOCKERHUB_USERNAME != '' }}
93+
- name: Login to GitHub Container Registry
94+
uses: docker/login-action@v2
10295
with:
103-
username: ${{ secrets.DOCKERHUB_USERNAME }}
104-
password: ${{ secrets.DOCKERHUB_TOKEN }}
96+
registry: ghcr.io
97+
username: ${{ github.actor }}
98+
password: ${{ secrets.GITHUB_TOKEN }}
10599

106100
- name: Check specs with Perfecto
107-
uses: essentialkaos/perfecto-action@v1
101+
uses: essentialkaos/perfecto-action@v2
108102
with:
109103
files: common/init-exporter-converter.spec

Makefile

Lines changed: 57 additions & 14 deletions
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: init-exporter-converter ## Build all binaries
1827

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

2231
install: ## Install all binaries
2332
cp init-exporter-converter /usr/bin/init-exporter-converter
2433

2534
uninstall: ## Uninstall all binaries
2635
rm -f /usr/bin/init-exporter-converter
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 init-exporter-converter
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%-25s\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

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,16 @@ Utility for converting [`init-exporter`](https://github.com/funbox/init-exporter
66

77
#### From sources
88

9-
To build the `init-exporter-converter` from scratch, make sure you have a working Go 1.16+ workspace ([instructions](https://golang.org/doc/install)), then:
9+
To build the `init-exporter-converter` from scratch, make sure you have a working Go 1.18+ workspace ([instructions](https://golang.org/doc/install)), then:
1010

1111
```
12-
go get github.com/funbox/init-exporter-converter
13-
```
14-
15-
If you want to update `init-exporter-converter` to latest stable release, do:
16-
17-
```
18-
go get -u github.com/funbox/init-exporter-converter
12+
go install github.com/funbox/init-exporter-converter@latest
1913
```
2014

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

2317
```
24-
sudo yum install -y https://yum.kaos.st/get/$(uname -r).rpm
18+
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
2519
sudo yum install init-exporter-converter
2620
```
2721

common/init-exporter-converter.spec

Lines changed: 27 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,24 @@
11
################################################################################
22

3-
# rpmbuilder:relative-pack true
3+
%define debug_package %{nil}
44

55
################################################################################
66

7-
%define _posixroot /
8-
%define _root /root
9-
%define _bin /bin
10-
%define _sbin /sbin
11-
%define _srv /srv
12-
%define _home /home
13-
%define _lib32 %{_posixroot}lib
14-
%define _lib64 %{_posixroot}lib64
15-
%define _libdir32 %{_prefix}%{_lib32}
16-
%define _libdir64 %{_prefix}%{_lib64}
17-
%define _logdir %{_localstatedir}/log
18-
%define _rundir %{_localstatedir}/run
19-
%define _lockdir %{_localstatedir}/lock/subsys
20-
%define _cachedir %{_localstatedir}/cache
21-
%define _spooldir %{_localstatedir}/spool
22-
%define _crondir %{_sysconfdir}/cron.d
23-
%define _loc_prefix %{_prefix}/local
24-
%define _loc_exec_prefix %{_loc_prefix}
25-
%define _loc_bindir %{_loc_exec_prefix}/bin
26-
%define _loc_libdir %{_loc_exec_prefix}/%{_lib}
27-
%define _loc_libdir32 %{_loc_exec_prefix}/%{_lib32}
28-
%define _loc_libdir64 %{_loc_exec_prefix}/%{_lib64}
29-
%define _loc_libexecdir %{_loc_exec_prefix}/libexec
30-
%define _loc_sbindir %{_loc_exec_prefix}/sbin
31-
%define _loc_bindir %{_loc_exec_prefix}/bin
32-
%define _loc_datarootdir %{_loc_prefix}/share
33-
%define _loc_includedir %{_loc_prefix}/include
34-
%define _rpmstatedir %{_sharedstatedir}/rpm-state
35-
%define _pkgconfigdir %{_libdir}/pkgconfig
7+
Summary: Utility for converting init-exporter procfiles from v1 to v2 format
8+
Name: init-exporter-converter
9+
Version: 0.12.0
10+
Release: 0%{?dist}
11+
Group: Development/Tools
12+
License: MIT
13+
URL: https://github.com/funbox/init-exporter-converter
3614

37-
################################################################################
38-
39-
%define debug_package %{nil}
40-
41-
################################################################################
15+
Source0: %{name}-%{version}.tar.gz
4216

43-
Summary: Utility for converting init-exporter procfiles from v1 to v2 format
44-
Name: init-exporter-converter
45-
Version: 0.11.2
46-
Release: 0%{?dist}
47-
Group: Development/Tools
48-
License: MIT
49-
URL: https://github.com/funbox/init-exporter-converter
17+
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
5018

51-
Source0: %{name}-%{version}.tar.gz
19+
BuildRequires: golang >= 1.19
5220

53-
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
54-
55-
BuildRequires: golang >= 1.17
56-
57-
Provides: %{name} = %{version}-%{release}
21+
Provides: %{name} = %{version}-%{release}
5822

5923
################################################################################
6024

@@ -67,17 +31,21 @@ Utility for exporting services described by Procfile to init system.
6731
%setup -q
6832

6933
%build
70-
export GOPATH=$(pwd)
71-
pushd src/github.com/funbox/%{name}
72-
go build -mod vendor %{name}.go
34+
if [[ ! -d "%{name}/vendor" ]] ; then
35+
echo "This package requires vendored dependencies"
36+
exit 1
37+
fi
38+
39+
pushd %{name}
40+
%{__make} %{?_smp_mflags} all
41+
cp LICENSE ..
7342
popd
7443

7544
%install
7645
rm -rf %{buildroot}
7746

7847
install -dm 755 %{buildroot}%{_bindir}
79-
install -pm 755 src/github.com/funbox/%{name}/%{name} \
80-
%{buildroot}%{_bindir}/
48+
install -pm 755 %{name}/%{name} %{buildroot}%{_bindir}/
8149

8250
%clean
8351
rm -rf %{buildroot}
@@ -86,11 +54,17 @@ rm -rf %{buildroot}
8654

8755
%files
8856
%defattr(-,root,root,-)
57+
%doc LICENSE
8958
%{_bindir}/init-exporter-converter
9059

9160
################################################################################
9261

9362
%changelog
63+
* Fri Mar 10 2023 Anton Novojilov <andyone@fun-box.ru> - 0.12.0-0
64+
- Added verbose version output
65+
- Dependencies update
66+
- Code refactoring
67+
9468
* Fri Apr 01 2022 Anton Novojilov <andyone@fun-box.ru> - 0.11.2-0
9569
- Removed pkg.re usage
9670
- Added module info

0 commit comments

Comments
 (0)