Skip to content

Commit 57288fe

Browse files
committed
Initial commit
0 parents  commit 57288fe

17 files changed

+519
-0
lines changed

.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = space
6+
indent_size = 4
7+
tab_width = 4
8+
9+
[*.go]
10+
indent_style = tab
11+
12+
[Makefile]
13+
indent_style = tab
14+
15+
[*.{yaml,yml}]
16+
indent_size = 2

.github/workflows/build.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Build
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
types: [opened, synchronize, reopened]
8+
jobs:
9+
sonarcloud:
10+
name: SonarCloud
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
with:
15+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
16+
- name: SonarCloud Scan
17+
uses: SonarSource/sonarcloud-github-action@master
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
20+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.github/workflows/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: gomod
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
open-pull-requests-limit: 5

.github/workflows/gitleaks.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Gitleaks
2+
3+
on: [pull_request, push, workflow_dispatch]
4+
5+
jobs:
6+
gitleaks:
7+
name: Secret Scan
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Check out the repo
11+
uses: actions/checkout@v2
12+
- name: Run gitleaks
13+
run: docker run -v ${{ github.workspace }}:/path zricethezav/gitleaks:latest detect -v --source="/path" --redact
14+
15+
run-if-failed:
16+
name: Github Security Report (if gitleaks job fails)
17+
runs-on: ubuntu-latest
18+
needs: [gitleaks]
19+
if: always() && (needs.gitleaks.result == 'failure')
20+
permissions:
21+
security-events: write
22+
steps:
23+
- name: Check out the repo
24+
uses: actions/checkout@v2
25+
- name: Generate gitleaks SARIF file
26+
# Exit 0 so we can get the failed report results from this step.
27+
run: docker run -v ${{ github.workspace }}:/path zricethezav/gitleaks:latest detect -v --source="/path" --redact --report-format sarif --report-path="/path/result.sarif" --exit-code=0
28+
- name: Upload SARIF file
29+
uses: github/codeql-action/upload-sarif@v2
30+
with:
31+
# Path to SARIF file relative to the root of the repository
32+
sarif_file: result.sarif
33+
# Optional category for the results
34+
category: secret-analysis
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
6+
# This workflow lets you compile your Go project using a SLSA3 compliant builder.
7+
# This workflow will generate a so-called "provenance" file describing the steps
8+
# that were performed to generate the final binary.
9+
# The project is an initiative of the OpenSSF (openssf.org) and is developed at
10+
# https://github.com/slsa-framework/slsa-github-generator.
11+
# The provenance file can be verified using https://github.com/slsa-framework/slsa-verifier.
12+
# For more information about SLSA and how it improves the supply-chain, visit slsa.dev.
13+
14+
name: SLSA Go releaser
15+
on:
16+
workflow_dispatch:
17+
release:
18+
types: [created]
19+
20+
permissions: read-all
21+
22+
jobs:
23+
build:
24+
permissions:
25+
id-token: write # To sign.
26+
contents: write # To upload release assets.
27+
actions: read # To read workflow path.
28+
# If you need more configuration options, such as ldflag examples,
29+
# visit https://github.com/slsa-framework/slsa-github-generator#golang-projects.
30+
uses: slsa-framework/slsa-github-generator/.github/workflows/builder_go_slsa3.yml@v1.1.1
31+
with:
32+
# By default, the config file is .slsa-goreleaser.yml in the root directory.
33+
# The format of the config file is described in
34+
# https://github.com/slsa-framework/slsa-github-generator/blob/main/internal/builders/go/README.md#configuration-file.
35+
go-version: 1.17

.github/workflows/golangci-lint.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: golangci-lint
2+
on:
3+
push:
4+
pull_request:
5+
permissions:
6+
contents: read
7+
# Optional: allow read access to pull request. Use with `only-new-issues` option.
8+
# pull-requests: read
9+
jobs:
10+
golangci:
11+
name: lint
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/setup-go@v3
15+
with:
16+
go-version: 1.17
17+
- uses: actions/checkout@v3
18+
- name: golangci-lint
19+
uses: golangci/golangci-lint-action@v3
20+
with:
21+
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
22+
version: v1.29
23+
24+
# Optional: working directory, useful for monorepos
25+
# working-directory: somedir
26+
27+
# Optional: golangci-lint command line arguments.
28+
# args: --issues-exit-code=0
29+
30+
# Optional: show only new issues if it's a pull request. The default value is `false`.
31+
# only-new-issues: true
32+
33+
# Optional: if set to true then the all caching functionality will be complete disabled,
34+
# takes precedence over all other caching options.
35+
# skip-cache: true
36+
37+
# Optional: if set to true then the action don't cache or restore ~/go/pkg.
38+
# skip-pkg-cache: true
39+
40+
# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
41+
# skip-build-cache: true

.github/workflows/release.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Release Package
2+
on:
3+
push:
4+
branches:
5+
- main
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
node-version:
12+
- 16.x
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
- name: Release
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
run: npx semantic-release

.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Binaries for programs and plugins
2+
*.exe
3+
*.exe~
4+
*.dll
5+
*.so
6+
*.dylib
7+
8+
# Test binary, built with `go test -c`
9+
*.test
10+
11+
# Output of the go coverage tool, specifically when used with LiteIDE
12+
*.out
13+
14+
# Dependency directories (remove the comment below to include it)
15+
# vendor/
16+
17+
bin/

.pre-commit-config.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v4.3.0
6+
hooks:
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: check-yaml
10+
- id: check-added-large-files
11+
- repo: https://github.com/golangci/golangci-lint
12+
rev: v1.46.2
13+
hooks:
14+
- id: golangci-lint
15+
16+
ci:
17+
autofix_commit_msg: |
18+
[pre-commit.ci] auto fixes from pre-commit.com hooks
19+
20+
for more information, see https://pre-commit.ci
21+
autofix_prs: true
22+
autoupdate_branch: ''
23+
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
24+
autoupdate_schedule: weekly
25+
skip: []
26+
submodules: false

.releaserc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"branches": [
3+
"main"
4+
],
5+
"ci": true,
6+
"plugins": [
7+
"@semantic-release/commit-analyzer",
8+
"@semantic-release/release-notes-generator",
9+
"@semantic-release/github"
10+
]
11+
}

Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM golang:1.18 as build
2+
WORKDIR /go/src/app
3+
COPY . .
4+
RUN mkdir -p /go/bin && go build -ldflags="-w -s" -o /go/bin/app ./...
5+
6+
# Using a distroless image from https://github.com/GoogleContainerTools/distroless
7+
# Image sourced from https://console.cloud.google.com/gcr/images/distroless/global/static
8+
FROM gcr.io/distroless/static:nonroot
9+
COPY --from=build /go/bin/app /
10+
# numeric version of user nonroot:nonroot provided in image
11+
USER 65532:65532
12+
CMD ["/app"]

0 commit comments

Comments
 (0)