Skip to content

Commit b870582

Browse files
committed
update build system and lint
Signed-off-by: Markus Blaschke <[email protected]>
1 parent d1ab4c4 commit b870582

16 files changed

+374
-177
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/test
22
/vendor
33
/kube-pool-manager
4+
/release-assets

.editorconfig

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
root = true
55

66
[*]
7+
charset = utf-8
8+
trim_trailing_whitespace = true
79
end_of_line = lf
810
insert_final_newline = true
911
indent_style = space
@@ -12,15 +14,38 @@ indent_size = 4
1214
[Makefile]
1315
indent_style = tab
1416

15-
[*.yml]
16-
indent_size = 2
17-
18-
[*.yaml]
17+
[{*.yml, *.yaml}]
1918
indent_size = 2
2019

2120
[*.conf]
2221
indent_size = 2
2322

2423
[*.go]
25-
indent_style = tab
2624
indent_size = 4
25+
indent_style = tab
26+
ij_continuation_indent_size = 4
27+
ij_go_GROUP_CURRENT_PROJECT_IMPORTS = true
28+
ij_go_add_leading_space_to_comments = true
29+
ij_go_add_parentheses_for_single_import = true
30+
ij_go_call_parameters_new_line_after_left_paren = true
31+
ij_go_call_parameters_right_paren_on_new_line = true
32+
ij_go_call_parameters_wrap = off
33+
ij_go_fill_paragraph_width = 80
34+
ij_go_group_stdlib_imports = true
35+
ij_go_import_sorting = goimports
36+
ij_go_keep_indents_on_empty_lines = false
37+
ij_go_local_group_mode = project
38+
ij_go_move_all_imports_in_one_declaration = true
39+
ij_go_move_all_stdlib_imports_in_one_group = true
40+
ij_go_remove_redundant_import_aliases = false
41+
ij_go_run_go_fmt_on_reformat = true
42+
ij_go_use_back_quotes_for_imports = false
43+
ij_go_wrap_comp_lit = off
44+
ij_go_wrap_comp_lit_newline_after_lbrace = true
45+
ij_go_wrap_comp_lit_newline_before_rbrace = true
46+
ij_go_wrap_func_params = off
47+
ij_go_wrap_func_params_newline_after_lparen = true
48+
ij_go_wrap_func_params_newline_before_rparen = true
49+
ij_go_wrap_func_result = off
50+
ij_go_wrap_func_result_newline_after_lparen = true
51+
ij_go_wrap_func_result_newline_before_rparen = true

.github/workflows/ci-docker.yml renamed to .github/workflows/ci-docker.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ jobs:
88
steps:
99
- uses: actions/checkout@v2
1010

11-
- name: Run Gosec Security Scanner
12-
uses: securego/gosec@master
11+
- name: Set Swap Space
12+
uses: pierotofy/set-swap-space@master
1313
with:
14-
args: ./...
14+
swap-size-gb: 12
1515

1616
- name: Run Golangci lint
1717
uses: golangci/golangci-lint-action@v2
1818
with:
1919
version: latest
20-
args: -E exportloopref,gofmt --timeout=30m
20+
args: --print-resources-usage
2121

2222
- name: Docker meta
2323
id: docker_meta
@@ -39,6 +39,6 @@ jobs:
3939
context: .
4040
file: ./Dockerfile
4141
push: false
42-
platforms: linux/amd64,linux/arm,linux/arm64
42+
platforms: linux/amd64,linux/arm64
4343
tags: ${{ steps.docker_meta.outputs.tags }}
4444
labels: ${{ steps.docker_meta.outputs.labels }}

.github/workflows/release-assets.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: "Release: assets"
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
release:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
13+
- name: Set Swap Space
14+
uses: pierotofy/set-swap-space@master
15+
with:
16+
swap-size-gb: 12
17+
18+
- uses: actions/setup-go@v2
19+
with:
20+
go-version: '1.19'
21+
check-latest: true
22+
23+
- name: Build
24+
run: |
25+
make release-assets
26+
27+
- name: Upload assets to release
28+
uses: svenstaro/upload-release-action@v2
29+
with:
30+
repo_token: ${{ secrets.GITHUB_TOKEN }}
31+
file: ./release-assets/*
32+
tag: ${{ github.ref }}
33+
overwrite: true
34+
file_glob: true

.github/workflows/release-docker.yaml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: "Release: docker"
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
tags:
8+
- '*.*.*'
9+
10+
jobs:
11+
lint:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
16+
- name: Set Swap Space
17+
uses: pierotofy/set-swap-space@master
18+
with:
19+
swap-size-gb: 12
20+
21+
- name: Run Golangci lint
22+
uses: golangci/golangci-lint-action@v2
23+
with:
24+
version: latest
25+
args: --print-resources-usage
26+
27+
build:
28+
needs: lint
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
Dockerfile: [Dockerfile]
33+
suffix: [""]
34+
latest: ["auto"]
35+
include: []
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v2
39+
40+
- name: Set Swap Space
41+
uses: pierotofy/set-swap-space@master
42+
with:
43+
swap-size-gb: 12
44+
45+
- name: Docker meta
46+
id: docker_meta
47+
uses: docker/metadata-action@v4
48+
with:
49+
images: ${{ github.repository }},quay.io/${{ github.repository }}
50+
labels: |
51+
io.artifacthub.package.readme-url=https://raw.githubusercontent.com/${{ github.repository }}/${{ github.event.repository.default_branch }}/README.md
52+
flavor: |
53+
latest=${{ matrix.latest }}
54+
suffix=${{ matrix.suffix }}
55+
56+
- name: Set up QEMU
57+
uses: docker/setup-qemu-action@v1
58+
59+
- name: Set up Docker Buildx
60+
uses: docker/setup-buildx-action@v1
61+
62+
- name: Login to DockerHub
63+
uses: docker/login-action@v1
64+
with:
65+
username: ${{ secrets.DOCKERHUB_USERNAME }}
66+
password: ${{ secrets.DOCKERHUB_TOKEN }}
67+
68+
- name: Login to Quay
69+
uses: docker/login-action@v1
70+
with:
71+
registry: quay.io
72+
username: ${{ secrets.QUAY_USERNAME }}
73+
password: ${{ secrets.QUAY_TOKEN }}
74+
75+
- name: Build and push
76+
uses: docker/build-push-action@v2
77+
with:
78+
context: .
79+
file: ./${{ matrix.Dockerfile }}
80+
platforms: linux/amd64,linux/arm64
81+
push: ${{ github.event_name != 'pull_request' }}
82+
tags: ${{ steps.docker_meta.outputs.tags }}
83+
labels: ${{ steps.docker_meta.outputs.labels }}

.github/workflows/release-docker.yml

Lines changed: 0 additions & 62 deletions
This file was deleted.
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: "Scheduled: docker"
2+
3+
on:
4+
schedule:
5+
- cron: '0 6 * * 1'
6+
7+
jobs:
8+
lint:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
13+
- name: Set Swap Space
14+
uses: pierotofy/set-swap-space@master
15+
with:
16+
swap-size-gb: 12
17+
18+
- name: Run Golangci lint
19+
uses: golangci/golangci-lint-action@v2
20+
with:
21+
version: latest
22+
args: --print-resources-usage
23+
24+
build:
25+
needs: lint
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
Dockerfile: [Dockerfile]
30+
suffix: [""]
31+
latest: ["auto"]
32+
include: []
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@v2
36+
37+
- name: Set Swap Space
38+
uses: pierotofy/set-swap-space@master
39+
with:
40+
swap-size-gb: 12
41+
42+
- name: Docker meta
43+
id: docker_meta
44+
uses: docker/metadata-action@v4
45+
with:
46+
images: ${{ github.repository }},quay.io/${{ github.repository }}
47+
labels: |
48+
io.artifacthub.package.readme-url=https://raw.githubusercontent.com/${{ github.repository }}/${{ github.event.repository.default_branch }}/README.md
49+
flavor: |
50+
latest=${{ matrix.latest }}
51+
suffix=${{ matrix.suffix }}
52+
53+
- name: Set up QEMU
54+
uses: docker/setup-qemu-action@v1
55+
56+
- name: Set up Docker Buildx
57+
uses: docker/setup-buildx-action@v1
58+
59+
- name: Login to DockerHub
60+
uses: docker/login-action@v1
61+
with:
62+
username: ${{ secrets.DOCKERHUB_USERNAME }}
63+
password: ${{ secrets.DOCKERHUB_TOKEN }}
64+
65+
- name: Login to Quay
66+
uses: docker/login-action@v1
67+
with:
68+
registry: quay.io
69+
username: ${{ secrets.QUAY_USERNAME }}
70+
password: ${{ secrets.QUAY_TOKEN }}
71+
72+
- name: Build and push
73+
uses: docker/build-push-action@v2
74+
with:
75+
context: .
76+
file: ./${{ matrix.Dockerfile }}
77+
platforms: linux/amd64,linux/arm64
78+
push: ${{ github.event_name != 'pull_request' }}
79+
tags: ${{ steps.docker_meta.outputs.tags }}
80+
labels: ${{ steps.docker_meta.outputs.labels }}

0 commit comments

Comments
 (0)