-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
1,346 additions
and
1 deletion.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* @insightsengineering/idr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: Lint 🧶 | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
- reopened | ||
- ready_for_review | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: lint-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
Lint: | ||
name: SuperLinter 🦸🏻♀️ | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repo 🛎 | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Lint Code Base 🕵🏻♀️ | ||
uses: github/super-linter/slim@v4 | ||
env: | ||
LINTER_RULES_PATH: / | ||
VALIDATE_ALL_CODEBASE: false | ||
VALIDATE_GITHUB_ACTIONS: true | ||
VALIDATE_MARKDOWN: true | ||
VALIDATE_DOCKERFILE_HADOLINT: true | ||
VALIDATE_GITLEAKS: true | ||
DEFAULT_BRANCH: main | ||
VALIDATE_JSON: true | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
GoLint: | ||
name: Lint Go Code 🔍 | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
go-version: | ||
- 1.21.3 | ||
steps: | ||
- name: Checkout Repo 🛎 | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Go 🐹 | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
cache: true | ||
cache-dependency-path: go.sum | ||
|
||
- name: Lint Go Code 🕵🏻♂️ | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: latest | ||
only-new-issues: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Release 🎈 | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: release-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
|
||
permissions: read-all | ||
|
||
jobs: | ||
release: | ||
name: Create Release 🥇 | ||
permissions: | ||
contents: write | ||
packages: write | ||
defaults: | ||
run: | ||
shell: bash | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repo 🛎 | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup Go 🐹 | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.21.3 | ||
cache: true | ||
cache-dependency-path: go.sum | ||
|
||
- name: Log in to the Container registry 🗝 | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Run GoReleaser 🚀 | ||
uses: goreleaser/goreleaser-action@v3 | ||
with: | ||
distribution: goreleaser | ||
version: latest | ||
args: release --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
name: Test 🧪 | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
- reopened | ||
- ready_for_review | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: test-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
test: | ||
name: Test 🔍 | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
go-version: | ||
- 1.21.3 | ||
defaults: | ||
run: | ||
shell: bash | ||
steps: | ||
- name: Checkout Repo 🛎 | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Go 🐹 | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
cache: true | ||
cache-dependency-path: go.sum | ||
|
||
- name: Run Tests 🧨 | ||
run: make test | ||
|
||
- name: Check whether JUnit XML report exists 🚦 | ||
id: check-junit-xml | ||
uses: andstor/file-existence-action@v2 | ||
with: | ||
files: junit-report.xml | ||
|
||
- name: Publish Unit Test Summary 📑 | ||
uses: EnricoMi/publish-unit-test-result-action@v2 | ||
id: test-results | ||
if: steps.check-junit-xml.outputs.files_exists == 'true' && github.event_name == 'pull_request' | ||
with: | ||
check_name: Unit Tests Summary | ||
junit_files: junit-report.xml | ||
|
||
- name: Check whether coverage reports exists 💭 | ||
id: check-coverage-reports | ||
uses: andstor/file-existence-action@v2 | ||
with: | ||
files: >- | ||
coverage.xml, | ||
coverage.html | ||
- name: Post coverage report 🗞 | ||
if: steps.check-coverage-reports.outputs.files_exists == 'true' | ||
uses: insightsengineering/coverage-action@v2 | ||
with: | ||
path: coverage.xml | ||
threshold: 80 | ||
fail: false | ||
publish: true | ||
diff: true | ||
coverage-reduction-failure: true | ||
new-uncovered-statements-failure: true | ||
continue-on-error: true | ||
|
||
- name: Upload report 🔼 | ||
if: steps.check-coverage-reports.outputs.files_exists == 'true' | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: coverage-report | ||
path: | | ||
coverage.html | ||
continue-on-error: true | ||
|
||
compilation: | ||
name: Build 🏗 | ||
strategy: | ||
matrix: | ||
go-version: | ||
- 1.21.3 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repo 🛎 | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Go 🐹 | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
cache: true | ||
cache-dependency-path: go.sum | ||
|
||
- name: Check if compilation works 🧱 | ||
run: make build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,5 @@ | |
|
||
# Go workspace file | ||
go.work | ||
|
||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# See https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml | ||
issues: | ||
exclude-rules: | ||
- path: _test\.go | ||
linters: | ||
- dupl | ||
- gosec | ||
- goconst | ||
linters: | ||
enable: | ||
- gosec | ||
- unconvert | ||
- gocyclo | ||
- goconst | ||
- goimports | ||
- gocritic | ||
- govet | ||
- revive | ||
linters-settings: | ||
errcheck: | ||
# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`; | ||
# default is false: such cases aren't reported by default. | ||
check-blank: true | ||
govet: | ||
# report about shadowed variables | ||
check-shadowing: true | ||
gocyclo: | ||
# minimal code complexity to report, 30 by default | ||
min-complexity: 15 | ||
maligned: | ||
# print struct with more effective memory layout or not, false by default | ||
suggest-new: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Customization options: https://goreleaser.com/customization/ | ||
project_name: locksmith | ||
before: | ||
hooks: | ||
- go mod tidy | ||
- go generate ./... | ||
builds: | ||
- no_unique_dist_dir: false | ||
env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
- darwin | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
ldflags: | ||
- -s -w | ||
- -X go.szostok.io/version.version={{.Version}} | ||
- -X go.szostok.io/version.buildDate={{.Date}} | ||
checksum: | ||
name_template: '{{ .ProjectName }}_checksums.txt' | ||
algorithm: sha512 | ||
changelog: | ||
sort: asc | ||
dockers: | ||
- goos: linux | ||
goarch: amd64 | ||
image_templates: | ||
- "ghcr.io/insightsengineering/{{ .ProjectName }}:{{ .Version }}" | ||
- "ghcr.io/insightsengineering/{{ .ProjectName }}:latest" | ||
skip_push: false | ||
build_flag_templates: | ||
- "--pull" | ||
- "--label=org.opencontainers.image.created={{ .Date }}" | ||
- "--label=org.opencontainers.image.title={{ .ProjectName }}" | ||
- "--label=org.opencontainers.image.revision={{ .FullCommit }}" | ||
- "--label=org.opencontainers.image.version={{ .Version }}" | ||
- "--build-arg=PROJECT_NAME={{ .ProjectName }}" | ||
- "--platform=linux/amd64" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
exclude: "^dist" | ||
|
||
# See https://pre-commit.com/#pre-commit-configyaml---repos | ||
# for more information on the format of the content below | ||
repos: | ||
# ------------------------- | ||
# Standard pre-commit hooks | ||
# ------------------------- | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.3.0 | ||
hooks: | ||
- id: check-added-large-files | ||
- id: check-ast | ||
- id: check-builtin-literals | ||
- id: check-case-conflict | ||
- id: check-docstring-first | ||
- id: check-executables-have-shebangs | ||
- id: check-json | ||
exclude: ".devcontainer/devcontainer.json" | ||
- id: check-merge-conflict | ||
- id: check-shebang-scripts-are-executable | ||
- id: check-symlinks | ||
- id: check-vcs-permalinks | ||
- id: check-xml | ||
- id: check-yaml | ||
args: [--allow-multiple-documents] | ||
- id: debug-statements | ||
- id: destroyed-symlinks | ||
- id: detect-private-key | ||
- id: end-of-file-fixer | ||
- id: fix-byte-order-marker | ||
- id: fix-encoding-pragma | ||
args: [--remove] | ||
- id: mixed-line-ending | ||
args: [--fix=lf] | ||
- id: no-commit-to-branch | ||
- id: requirements-txt-fixer | ||
- id: trailing-whitespace | ||
args: [--markdown-linebreak-ext=md] | ||
|
||
# --------------------------- | ||
# Extra hooks for go projects | ||
# --------------------------- | ||
- repo: https://github.com/dnephin/pre-commit-golang | ||
rev: v0.5.1 | ||
hooks: | ||
- id: go-fmt | ||
- id: go-vet | ||
- id: go-lint | ||
- id: go-imports | ||
- id: go-cyclo | ||
args: [-over=15] | ||
- id: no-go-testing | ||
- id: golangci-lint | ||
- id: go-critic | ||
- id: go-unit-tests | ||
- id: go-build | ||
- id: go-mod-tidy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM scratch | ||
ARG PROJECT_NAME="locksmith" | ||
ENV PROJECT_NAME=${PROJECT_NAME} | ||
COPY ${PROJECT_NAME} / | ||
WORKDIR / | ||
# hadolint ignore=DL3025 | ||
ENTRYPOINT ${PROJECT_NAME} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Copyright 2023 F. Hoffmann-La Roche AG | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
Oops, something went wrong.