generated from rog-golang-buddies/golang-template-repository
-
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.
Merge pull request #2 from rog-golang-buddies/update-from-template
Update from template
- Loading branch information
Showing
23 changed files
with
687 additions
and
38 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,11 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: gomod | ||
directory: "/" | ||
schedule: | ||
interval: weekly | ||
open-pull-requests-limit: 5 | ||
- package-ecosystem: "docker" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" |
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,45 @@ | ||
## Description | ||
|
||
_Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change_ | ||
|
||
Fixes # (issue) | ||
Dependent # (issue) | ||
## Current status | ||
|
||
- [ ] Waiting for review | ||
- [ ] Waiting for comment resolution | ||
- [ ] Waiting for merge | ||
- [ ] Draft | ||
- [ ] Trivial PR (nominal cosmetic/typo/whitespace changes) | ||
|
||
## Semantic Versioning | ||
Please delete options that are not relevant. Ensure same has been covered in the commit message as well. | ||
|
||
- This is a `fix` change | ||
- This is a `feat` change | ||
- This is a `BREAKING CHANGE` | ||
|
||
## Type of change | ||
|
||
Please delete options that are not relevant. | ||
|
||
- Bug fix (non-breaking change which fixes an issue) | ||
- New feature (non-breaking change which adds functionality) | ||
- Breaking change (fix or feature that would cause existing functionality to not work as expected) | ||
- This change requires a documentation update | ||
|
||
## How Has This Been Tested? | ||
|
||
_Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration_ | ||
|
||
### Automated | ||
|
||
### Manual | ||
|
||
## Checklist: | ||
- [ ] My commit message mentions fix, feat, BREAKING CHANGE accordingly to increase the semantic versioning | ||
- [ ] My code follows the style guidelines of this project | ||
- [ ] I have performed a self-review of my own code | ||
- [ ] I have commented my code, particularly in hard-to-understand areas | ||
- [ ] I have made corresponding changes to the documentation | ||
- [ ] I have checked my code/docs and corrected any misspellings |
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
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,19 @@ | ||
name: mkdocs | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Setup Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.x | ||
- name: Install mkdocs-material | ||
run: pip install mkdocs-material | ||
- name: Publish to gh-pages | ||
run: mkdocs gh-deploy --force |
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,21 +1,49 @@ | ||
name: Release Package | ||
name: release | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
build: | ||
semantic-release: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: | ||
- 16.x | ||
steps: | ||
- name: Checkout | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Release | ||
- | ||
name: Release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: npx semantic-release | ||
goreleaser: | ||
runs-on: ubuntu-latest | ||
needs: semantic-release | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- | ||
name: Setup Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: "1.18.0" | ||
- | ||
name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v3 | ||
with: | ||
# either 'goreleaser' (default) or 'goreleaser-pro' | ||
distribution: goreleaser | ||
version: latest | ||
args: release -f .goreleaser.yaml --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution | ||
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} |
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 @@ | ||
name: tests | ||
on: [push] | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Setup Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.18 | ||
- name: Go Test | ||
run: go test -v ./... |
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,47 @@ | ||
# This is an example .goreleaser.yml file with some sensible defaults. | ||
# Make sure to check the documentation at https://goreleaser.com | ||
|
||
# The project name is used in the name of the Brew formula, archives, etc. If none is given, it will be inferred | ||
# from the name of the GitHub, GitLab, or Gitea release. | ||
# project_name: golang-template-repository | ||
before: | ||
hooks: | ||
# You may remove this if you don't use go modules. | ||
- go mod tidy | ||
# you may remove this if you don't need go generate | ||
- go generate ./... | ||
builds: | ||
- env: [CGO_ENABLED=0] | ||
goos: | ||
- linux | ||
- windows | ||
- darwin | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
# ID of the build. | ||
# Defaults to the binary name, uncomment line below if needed | ||
# id: "golang-template-repository" | ||
dir: . | ||
main: ./cmd | ||
# uncomment this line to build binary at specific location# Binary name. | ||
# Can be a path (e.g. `bin/app`) to wrap the binary in a directory. | ||
# Default is the name of the project directory. | ||
# binary: ./bin/app | ||
archives: | ||
- replacements: | ||
darwin: Darwin | ||
linux: Linux | ||
windows: Windows | ||
386: i386 | ||
amd64: x86_64 | ||
checksum: | ||
name_template: 'checksums.txt' | ||
snapshot: | ||
name_template: "{{ incpatch .Version }}-next" | ||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- '^docs:' | ||
- '^test:' |
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,12 +1,22 @@ | ||
FROM golang:1.18 as build | ||
WORKDIR /go/src/app | ||
FROM golang:1.18-alpine as builder | ||
|
||
RUN apk update && apk upgrade && \ | ||
apk add --no-cache make bash | ||
|
||
WORKDIR /src | ||
COPY . . | ||
RUN mkdir -p /go/bin && go build -ldflags="-w -s" -o /go/bin/app ./... | ||
|
||
# Build executable | ||
RUN make build | ||
|
||
# Using a distroless image from https://github.com/GoogleContainerTools/distroless | ||
# Image sourced from https://console.cloud.google.com/gcr/images/distroless/global/static | ||
FROM gcr.io/distroless/static:nonroot | ||
COPY --from=build /go/bin/app / | ||
# numeric version of user nonroot:nonroot provided in image | ||
|
||
# Copy executable from builder image | ||
COPY --from=builder /src/bin/app / | ||
|
||
# Numeric version of user nonroot:nonroot provided in image | ||
USER 65532:65532 | ||
|
||
# Run the executable | ||
CMD ["/app"] |
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.