Skip to content

Commit 625bb03

Browse files
author
Massimiliano Giovagnoli
committed
chore: initial commit
Signed-off-by: Massimiliano Giovagnoli <[email protected]>
0 parents  commit 625bb03

40 files changed

+3751
-0
lines changed

.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
2+
# Ignore build and test binaries.
3+
bin/
4+
testbin/

.github/workflows/lint-code.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Lint code
2+
3+
on:
4+
push:
5+
branches: [ "*" ]
6+
pull_request:
7+
branches: [ "*" ]
8+
9+
jobs:
10+
golangci:
11+
name: lint
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Run golangci-lint
16+
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0
17+
with:
18+
version: v1.55.2
19+
only-new-issues: false
20+
args: --config .golangci.yml --timeout=5m

.github/workflows/lint-commit.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Lint commits
2+
permissions: {}
3+
4+
on:
5+
push:
6+
branches: [ "*" ]
7+
pull_request:
8+
branches: [ "*" ]
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
commit_lint:
16+
runs-on: ubuntu-20.04
17+
steps:
18+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
19+
with:
20+
fetch-depth: 0
21+
- uses: wagoid/commitlint-github-action@0d749a1a91d4770e983a7b8f83d4a3f0e7e0874e #v5.4.4
22+
with:
23+
firstParent: true
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Lint GitHub Actions
2+
permissions: {}
3+
4+
on:
5+
pull_request:
6+
branches: [ "main" ]
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
check:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
18+
- name: Ensure SHA pinned actions
19+
uses: zgosalvez/github-actions-ensure-sha-pinned-actions@b35f285b9bb7e80de0967367cee66d3b6d50ceca # v3.0.1
20+
with:
21+
# slsa-github-generator requires using a semver tag for reusable workflows.
22+
# See: https://github.com/slsa-framework/slsa-github-generator#referencing-slsa-builders-and-generators
23+
allowlist: |
24+
slsa-framework/slsa-github-generator
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Lint pull request
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
10+
permissions:
11+
pull-requests: write
12+
13+
jobs:
14+
main:
15+
name: Validate PR title
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: amannn/action-semantic-pull-request@e9fabac35e210fea40ca5b14c0da95a099eff26f
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
with:
22+
types: |
23+
chore
24+
ci
25+
docs
26+
feat
27+
fix
28+
test
29+
sec
30+
requireScope: false
31+
wip: false
32+
# If the PR only contains a single commit, the action will validate that
33+
# it matches the configured pattern.
34+
validateSingleCommit: true
35+
# Related to `validateSingleCommit` you can opt-in to validate that the PR
36+
# title matches a single commit to avoid confusion.
37+
validateSingleCommitMatchesPrTitle: true

.github/workflows/release.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
permissions:
9+
contents: write # needed to write releases
10+
id-token: write # needed for keyless signing
11+
packages: write # needed for ghcr access
12+
13+
jobs:
14+
goreleaser:
15+
runs-on: ubuntu-22.04
16+
steps:
17+
18+
- name: Checkout
19+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Fetch
24+
run: git fetch --prune --force --tags
25+
26+
- name: Setup Go
27+
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 #v5.0.0
28+
with:
29+
go-version-file: go.mod
30+
- run: go version
31+
32+
- uses: creekorful/goreportcard-action@1f35ced8cdac2cba28c9a2f2288a16aacfd507f9 # v1.0
33+
34+
- uses: sigstore/cosign-installer@1fc5bd396d372bee37d608f955b336615edf79c8 # v3.2.0
35+
36+
- uses: anchore/sbom-action/download-syft@5ecf649a417b8ae17dc8383dc32d46c03f2312df #v0.15.1
37+
38+
- uses: docker/login-action@v2
39+
with:
40+
registry: ghcr.io
41+
username: ${{ github.repository_owner }}
42+
password: ${{ secrets.GITHUB_TOKEN }}
43+
44+
- name: Run GoReleaser
45+
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0
46+
with:
47+
version: latest
48+
args: release --clean
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Report Codecov
2+
permissions: {}
3+
4+
on:
5+
pull_request:
6+
branches: [ "main" ]
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
codecov:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
18+
- name: Setup caches
19+
uses: ./.github/actions/setup-caches
20+
timeout-minutes: 5
21+
continue-on-error: true
22+
with:
23+
build-cache-key: codecov
24+
- name: Check secret
25+
id: checksecret
26+
uses: ./.github/actions/exists
27+
with:
28+
value: ${{ secrets.CODECOV_TOKEN }}
29+
- name: Generate Code Coverage Report
30+
if: steps.checksecret.outputs.result == 'true'
31+
run: make test
32+
- name: Upload Report to Codecov
33+
if: steps.checksecret.outputs.result == 'true'
34+
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
35+
with:
36+
file: ./coverage.out
37+
fail_ci_if_error: true
38+
verbose: true

.github/workflows/scan-code.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Scan code
2+
permissions: {}
3+
on:
4+
push:
5+
branches: [ "*" ]
6+
pull_request:
7+
branches: [ "*" ]
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
tests:
15+
runs-on: ubuntu-20.04
16+
env:
17+
GO111MODULE: on
18+
steps:
19+
- name: Checkout Source
20+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
21+
- name: Run Gosec Security Scanner
22+
uses: securego/gosec@55d79496019a560e16e73e1948dee20a1fad631a # v2.18.2
23+
with:
24+
args: ./...

.gitignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
# Binaries for programs and plugins
3+
*.exe
4+
*.exe~
5+
*.dll
6+
*.so
7+
*.dylib
8+
bin
9+
testbin/*
10+
Dockerfile.cross
11+
12+
# Test binary, build with `go test -c`
13+
*.test
14+
15+
# Output of the go coverage tool, specifically when used with LiteIDE
16+
*.out
17+
18+
# Kubernetes Generated files - skip generated files, except for vendored files
19+
20+
!vendor/**/zz_generated.*
21+
22+
# editor and IDE paraphernalia
23+
.idea
24+
*.swp
25+
*.swo
26+
*~

.golangci.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
linters-settings:
2+
cyclop:
3+
max-complexity: 27
4+
gci:
5+
sections:
6+
- standard # Captures all standard packages if they do not match another section.
7+
- default # Contains all imports that could not be matched to another section type.
8+
- prefix(github.com/maxgio92/capsule-addon-fluxcd) # Groups all imports with the specified Prefix.
9+
goconst:
10+
min-len: 2
11+
min-occurrences: 3
12+
goheader:
13+
template: |-
14+
Copyright 2020-2023 Project Capsule Authors.
15+
SPDX-License-Identifier: Apache-2.0
16+
govet:
17+
check-shadowing: true
18+
maligned:
19+
suggest-new: true
20+
21+
linters:
22+
enable-all: true
23+
disable:
24+
- interfacer
25+
- godox
26+
- golint
27+
- scopelint
28+
- maligned
29+
- gochecknoglobals
30+
- gochecknoinits
31+
- exhaustivestruct
32+
- exhaustruct
33+
- ireturn
34+
- lll
35+
- nonamedreturns
36+
- wrapcheck
37+
- varnamelen
38+
39+
issues:
40+
exclude-rules:
41+
- path: /
42+
linters:
43+
- typecheck

0 commit comments

Comments
 (0)