-
Notifications
You must be signed in to change notification settings - Fork 1
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
0 parents
commit 1dad859
Showing
99 changed files
with
6,016 additions
and
0 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,49 @@ | ||
# Config file for [Air](https://github.com/cosmtrek/air) in TOML format | ||
|
||
# Working directory | ||
# . or absolute path, please note that the directories following must be under root. | ||
root = "." | ||
tmp_dir = "tmp" | ||
|
||
[build] | ||
# Just plain old shell command. You could use `make` as well. | ||
cmd = "go build -o ./tmp/main ." | ||
# Binary file yields from `cmd`. | ||
bin = "tmp/main" | ||
# Customize binary. | ||
full_bin = "PBB_LOCAL=true ./tmp/main" | ||
# Watch these filename extensions. | ||
include_ext = ["go", "tmpl", "css"] | ||
# Ignore these filename extensions or directories. | ||
exclude_dir = ["tmp", "vendor"] | ||
# Watch these directories if you specified. | ||
include_dir = ["app", "assets", "cmd", "html"] | ||
# Exclude files. | ||
exclude_file = [] | ||
# Exclude unchanged files. | ||
exclude_unchanged = true | ||
# This log file places in your tmp_dir. | ||
log = "air.log" | ||
# It's not necessary to trigger build each time file changes if it's too frequent. | ||
delay = 1000 # ms | ||
# Stop running old binary when build errors occur. | ||
stop_on_error = true | ||
# Send Interrupt signal before killing process (windows does not support this feature) | ||
send_interrupt = false | ||
# Delay after sending Interrupt signal | ||
kill_delay = 500 # ms | ||
|
||
[log] | ||
# Show log time | ||
time = false | ||
|
||
[color] | ||
# Customize each part's color. If no color found, use the raw app log. | ||
build = "yellow" | ||
main = "magenta" | ||
runner = "green" | ||
watcher = "cyan" | ||
|
||
[misc] | ||
# Delete tmp directory on exit | ||
clean_on_exit = 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,17 @@ | ||
# The .dockerignore file excludes files from the container build process. | ||
# | ||
# https://docs.docker.com/engine/reference/builder/#dockerignore-file | ||
|
||
# Exclude locally vendored dependencies. | ||
vendor/ | ||
|
||
# Exclude "build-time" ignore files. | ||
.dockerignore | ||
.gcloudignore | ||
|
||
# Exclude git history and configuration. | ||
.gitignore | ||
|
||
# Exclude .env files | ||
.env | ||
.envrc |
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,95 @@ | ||
# Run this workflow every time a new commit or PR pushed to the repository. | ||
on: | ||
push: | ||
tags: | ||
- '*' | ||
# Name of the workflow. If this is blank, it will default to the path of the | ||
# file. | ||
name: release | ||
jobs: | ||
# Name of the job. | ||
unit-tests: | ||
# run the job on these Go versions and operating systems. | ||
strategy: | ||
matrix: | ||
go-version: [1.16.x] | ||
os: [ubuntu-latest, macos-latest] | ||
# Don't cancel all jobs if one fails. | ||
fail-fast: false | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
|
||
# install go. | ||
- name: Install Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
|
||
# checkout the code. | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
# run all the unit tests. | ||
- name: Run all unit tests | ||
run: go test -race -covermode atomic -coverprofile=covprofile ./... | ||
|
||
release-image: | ||
needs: [unit-tests] | ||
runs-on: ubuntu-latest | ||
steps: | ||
# install Go. | ||
- name: Install Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.16.x | ||
|
||
# checkout the code. | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
# get tag | ||
- name: Get the tag name | ||
run: echo "GIT_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV | ||
|
||
# configure aws | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: us-east-1 # only us-east-1 for ecr-public | ||
|
||
# build and push | ||
- name: Build and Push to ECR public | ||
id: build-and-push | ||
uses: pahud/ecr-public-action@8cd826db40befb59b0cd0b60b22a7ba72d06a7f7 | ||
with: | ||
tags: | | ||
public.ecr.aws/g5o6g6l0/polarbearblog:latest | ||
public.ecr.aws/g5o6g6l0/polarbearblog:${{ env.GIT_TAG }} | ||
release-chart: | ||
needs: [unit-tests] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Configure Git | ||
run: | | ||
git config user.name "$GITHUB_ACTOR" | ||
git config user.email "$GITHUB_ACTOR@users.noreply.github.com" | ||
- name: Install Helm | ||
uses: azure/setup-helm@v1 | ||
with: | ||
version: v3.4.0 | ||
|
||
- name: Run chart-releaser | ||
uses: helm/chart-releaser-action@v1.2.1 | ||
with: | ||
config: ./helm/chart-releaser | ||
env: | ||
CR_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,28 @@ | ||
# Run this workflow every time a new commit or PR pushed to the repository. | ||
on: [pull_request] | ||
# Name of the workflow. If this is blank, it will default to the path of the | ||
# file. | ||
name: Unit Tests | ||
jobs: | ||
# Name of the job. | ||
unit-tests: | ||
# Run the job on these Go versions and operating systems. | ||
strategy: | ||
matrix: | ||
go-version: [1.16.x] | ||
os: [ubuntu-latest, macos-latest] | ||
# Don't cancel all jobs if one fails. | ||
fail-fast: false | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
# Install Go. | ||
- name: Install Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
# Checkout the code. | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
# Run all the unit tests. | ||
- name: Run all unit tests | ||
run: go test -race -covermode atomic -coverprofile=covprofile ./... |
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,23 @@ | ||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
|
||
# Test binary, built with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# Dependency directories (remove the comment below to include it) | ||
# vendor/ | ||
|
||
.DS_Store | ||
/tmp | ||
/bin | ||
.env* | ||
.zip | ||
main | ||
/.cr-release-packages |
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,8 @@ | ||
{ | ||
"recommendations": [ | ||
"golang.go", | ||
"casualjim.gotemplate", | ||
"aeschli.vscode-css-formatter", | ||
"be5invis.toml" | ||
], | ||
} |
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,36 @@ | ||
# Use the offical golang image to create a binary. | ||
# This is based on Debian and sets the GOPATH to /go. | ||
# https://hub.docker.com/_/golang | ||
FROM golang:1.16-buster as builder | ||
|
||
# Create and change to the app directory. | ||
WORKDIR /app | ||
|
||
# Retrieve application dependencies. | ||
# This allows the container build to reuse cached dependencies. | ||
# Expecting to copy go.mod and if present go.sum. | ||
COPY go.* ./ | ||
RUN go mod download | ||
|
||
# Copy local code to the container image. | ||
COPY . ./ | ||
|
||
# Build the binary. | ||
RUN go build -mod=readonly -v -o server | ||
|
||
# Use the official Debian slim image for a lean production container. | ||
# https://hub.docker.com/_/debian | ||
# https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds | ||
FROM debian:buster-slim | ||
RUN set -x && apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ | ||
ca-certificates && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Copy the binary to the production image from the builder stage. | ||
COPY --from=builder /app/server /app/server | ||
|
||
# Create and change to the app directory. | ||
WORKDIR /app | ||
|
||
# Run the web service on container startup. | ||
CMD ["/app/server"] |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 Craig Huber | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
Oops, something went wrong.