-
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.
* refactor: added verifications, ecr image build script, refactored logger logic and code base
- Loading branch information
Showing
16 changed files
with
306 additions
and
91 deletions.
There are no files selected for viewing
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,14 @@ | ||
# Basic set up for three package managers | ||
version: 2 | ||
updates: | ||
# Maintain dependencies for Composer | ||
- package-ecosystem: "gomod" | ||
directory: "./" | ||
reviewers: | ||
- "Matrix278" | ||
- "KostLinux" | ||
schedule: | ||
interval: "weekly" | ||
commit-message: | ||
prefix: '[Go Modules]' | ||
include: scope |
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,10 @@ | ||
name-template: 'v$RESOLVED_VERSION' | ||
tag-template: 'v$RESOLVED_VERSION' | ||
change-template: '- $TITLE @$AUTHOR (#$NUMBER)' | ||
change-title-escapes: '\<*_&' | ||
template: | | ||
# What's Changed | ||
$CHANGES | ||
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION |
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,76 @@ | ||
name: Verify & Release | ||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
- edited | ||
- closed | ||
push: | ||
branches: | ||
- '*' | ||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]+' | ||
|
||
env: | ||
GOPROXY: https://proxy.golang.org | ||
|
||
permissions: | ||
contents: write | ||
packages: read | ||
statuses: write | ||
pull-requests: write | ||
|
||
jobs: | ||
verify_quality: | ||
name: Verify Code Quality | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.22' | ||
|
||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v4 | ||
with: | ||
version: v1.56.2 | ||
working-directory: ./ | ||
only-new-issues: false | ||
args: --concurrency=16 --timeout=5m --out-format=github-actions --issues-exit-code=1 | ||
skip-cache: false | ||
skip-pkg-cache: true | ||
|
||
verify_functionality: | ||
name: Verify Code Functionality | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.22' | ||
|
||
- name: Verify functionality | ||
run: go test -v ./... | ||
|
||
publish_release: | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | ||
needs: | ||
- verify_quality | ||
- verify_functionality | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set version env | ||
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | ||
|
||
- uses: release-drafter/release-drafter@v6 | ||
with: | ||
disable-autolabeler: true | ||
name: ${{ env.RELEASE_VERSION }} | ||
tag: ${{ env.RELEASE_VERSION }} | ||
version: ${{ env.RELEASE_VERSION }} | ||
publish: false | ||
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 |
---|---|---|
@@ -1 +0,0 @@ | ||
benchmarks/ | ||
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,51 @@ | ||
run: | ||
concurrency: 4 | ||
deadline: 5m | ||
tests: true | ||
|
||
linters-settings: | ||
gocyclo: | ||
min-complexity: 20 | ||
|
||
linters: | ||
disable-all: true | ||
enable: | ||
- asasalint | ||
- asciicheck | ||
- bidichk | ||
- bodyclose | ||
- dogsled | ||
- durationcheck | ||
- errcheck | ||
- errchkjson | ||
- forbidigo | ||
- gocognit | ||
- gocritic | ||
- godox | ||
- gofmt | ||
- gofumpt | ||
- goimports | ||
- goprintffuncname | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- misspell | ||
- nakedret | ||
- nestif | ||
- nilerr | ||
- nonamedreturns | ||
- prealloc | ||
- predeclared | ||
- revive | ||
- staticcheck | ||
- stylecheck | ||
- tenv | ||
- typecheck | ||
- unconvert | ||
- unparam | ||
- unused | ||
- usestdlibvars | ||
- whitespace | ||
|
||
issues: | ||
max-same-issues: 0 |
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 @@ | ||
run: | ||
go run main.go | ||
|
||
mod-vendor: | ||
go mod vendor | ||
|
||
linter: | ||
@golangci-lint run | ||
|
||
gosec: | ||
@gosec -quiet ./... | ||
|
||
validate: linter gosec |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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,34 @@ | ||
#!/bin/bash | ||
|
||
# Source environment variables | ||
source ~/dev/lookinlabs/terraform/platform-tf/.env.production | ||
|
||
# Define the image name and tag | ||
IMAGE_NAME="public.ecr.aws/c2w5h6c4/go-logger-middleware" | ||
IMAGE_TAG="latest" | ||
|
||
# Build the Docker image without using the cache | ||
echo "Building Docker image without cache..." | ||
docker build --no-cache -t ${IMAGE_NAME}:${IMAGE_TAG} . | ||
if [ $? -ne 0 ]; then | ||
echo "Failed to build Docker image" | ||
exit 1 | ||
fi | ||
|
||
# Reauthenticate with AWS ECR | ||
echo "Authenticating with AWS ECR..." | ||
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/c2w5h6c4 | ||
if [ $? -ne 0 ]; then | ||
echo "Failed to authenticate with AWS ECR" | ||
exit 1 | ||
fi | ||
|
||
# Push the Docker image | ||
echo "Pushing Docker image..." | ||
docker push ${IMAGE_NAME}:${IMAGE_TAG} | ||
if [ $? -ne 0 ]; then | ||
echo "Failed to push Docker image" | ||
exit 1 | ||
fi | ||
|
||
echo "Docker image pushed successfully" |
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
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 |
---|---|---|
@@ -1,4 +1,2 @@ | ||
github.com/go-chi/chi/v5 v5.1.0 h1:acVI1TYaD+hhedDJ3r54HyA6sExp3HfXq7QWEEY/xMw= | ||
github.com/go-chi/chi/v5 v5.1.0/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= | ||
github.com/lookinlabs/go-logger-middleware v0.0.0-20241023154743-cacce64726f3 h1:FqaC99m8pfUtES08uMX6TWXq6ubo2B+0zHWDDMKvOxk= | ||
github.com/lookinlabs/go-logger-middleware v0.0.0-20241023154743-cacce64726f3/go.mod h1:sLQMeTuFt+ZV367AHHYnGgGtbGwdqEB01Inrg/UH+BQ= |
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
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
Oops, something went wrong.