-
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 4e064b6
Showing
22 changed files
with
641 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,22 @@ | ||
ARG VARIANT="1.19" | ||
|
||
FROM mcr.microsoft.com/vscode/devcontainers/go:${VARIANT} | ||
|
||
ARG GOLANGCI_LINT_VERSION="1.49.0" | ||
|
||
RUN echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' \ | ||
| tee /etc/apt/sources.list.d/goreleaser.list | ||
RUN apt-get update \ | ||
&& export DEBIAN_FRONTEND=noninteractive \ | ||
&& apt-get -y install --no-install-recommends goreleaser | ||
|
||
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh \ | ||
| sh -s -- -b $(go env GOPATH)/bin v$GOLANGCI_LINT_VERSION | ||
|
||
USER vscode | ||
WORKDIR /home/vscode | ||
|
||
RUN mkdir -p .config/git \ | ||
&& echo ".vscode/*" >> .config/git/ignore \ | ||
&& echo "*.code-workspace" >> .config/git/ignore \ | ||
&& echo ".history/" >> .config/git/ignore |
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 @@ | ||
{ | ||
"name": "Go Module", | ||
"build": { | ||
"dockerfile": "Dockerfile", | ||
"args": { | ||
"VARIANT": "1.19", | ||
"GOLANGCI_LINT_VERSION": "1.49.0" | ||
} | ||
}, | ||
"extensions": [ | ||
"golang.Go", | ||
"ms-vsliveshare.vsliveshare", | ||
"EditorConfig.EditorConfig" | ||
], | ||
"postCreateCommand": "go mod download", | ||
"remoteUser": "vscode" | ||
} |
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,15 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.go] | ||
indent_style = tab | ||
|
||
[Makefile] | ||
indent_style = tab |
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,22 @@ | ||
--- | ||
name: Setup Go. | ||
description: Setup Go. | ||
|
||
inputs: | ||
go_version: | ||
description: The Go version. | ||
required: false | ||
default: '1.19' | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Setup Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ inputs.go_version }} | ||
cache: true | ||
- name: Setup GoReleaser | ||
uses: goreleaser/goreleaser-action@v3 | ||
with: | ||
install-only: 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,45 @@ | ||
--- | ||
name: format | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
workflow_dispatch: {} | ||
repository_dispatch: | ||
types: | ||
- format | ||
|
||
jobs: | ||
fix: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
token: ${{ secrets.GH_TOKEN }} | ||
- name: Import GPG key | ||
uses: crazy-max/ghaction-import-gpg@v5 | ||
with: | ||
git_user_signingkey: true | ||
git_commit_gpgsign: true | ||
git_committer_name: ${{ secrets.GIT_USER_NAME }} | ||
git_committer_email: ${{ secrets.GIT_USER_EMAIL }} | ||
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | ||
passphrase: ${{ secrets.GPG_PASSPHRASE }} | ||
- name: Setup | ||
uses: ./.github/actions/setup | ||
- name: Format | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: v1.49 | ||
args: --fix --timeout 30m | ||
- name: Commit | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: Run format | ||
commit_user_name: ${{ secrets.GIT_USER_NAME }} | ||
commit_user_email: ${{ secrets.GIT_USER_EMAIL }} | ||
commit_author: ${{ secrets.GIT_USER_NAME }} <${{ secrets.GIT_USER_EMAIL }}> |
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,44 @@ | ||
--- | ||
name: main | ||
|
||
on: | ||
push: | ||
branches: | ||
- '**' | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup | ||
uses: ./.github/actions/setup | ||
- name: Test | ||
run: make test | ||
lint: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup | ||
uses: ./.github/actions/setup | ||
- name: Lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: v1.49 | ||
args: --timeout 30m | ||
build: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 60 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup | ||
uses: ./.github/actions/setup | ||
- name: Build | ||
uses: goreleaser/goreleaser-action@v3 | ||
with: | ||
args: release --skip-publish --skip-sign --snapshot --timeout=60m |
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,33 @@ | ||
--- | ||
name: publish | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
github: | ||
runs-on: ubuntu-20.04 | ||
timeout-minutes: 60 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Import GPG key | ||
uses: crazy-max/ghaction-import-gpg@v5 | ||
with: | ||
git_user_signingkey: true | ||
git_commit_gpgsign: true | ||
git_committer_name: ${{ secrets.GIT_USER_NAME }} | ||
git_committer_email: ${{ secrets.GIT_USER_EMAIL }} | ||
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | ||
passphrase: ${{ secrets.GPG_PASSPHRASE }} | ||
- name: Setup | ||
uses: ./.github/actions/setup | ||
- name: Release | ||
uses: goreleaser/goreleaser-action@v3 | ||
with: | ||
args: release --timeout=60m | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} |
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 @@ | ||
--- | ||
name: version | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: Version to cut | ||
repository_dispatch: | ||
types: | ||
- version | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
persist-credentials: false | ||
- name: Setup Git config | ||
env: | ||
GH_USER: ${{ secrets.GH_USER }} | ||
GH_TOKEN: ${{ secrets.GH_TOKEN }} | ||
GIT_USER_NAME: ${{ secrets.GIT_USER_NAME }} | ||
GIT_USER_EMAIL: ${{ secrets.GIT_USER_EMAIL }} | ||
GIT_COMMITTER_EMAIL: ${{ secrets.GIT_USER_EMAIL }} | ||
run: | | ||
git remote set-url --push origin "https://${GH_USER}:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" | ||
git config user.name "$GIT_USER_NAME" | ||
git config user.email "$GIT_USER_EMAIL" | ||
- name: Import GPG key | ||
uses: crazy-max/ghaction-import-gpg@v5 | ||
with: | ||
git_user_signingkey: true | ||
git_commit_gpgsign: true | ||
git_committer_name: ${{ secrets.GIT_USER_NAME }} | ||
git_committer_email: ${{ secrets.GIT_USER_EMAIL }} | ||
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | ||
passphrase: ${{ secrets.GPG_PASSPHRASE }} | ||
- name: Cut ${{ github.event.inputs.version }}${{ github.event.client_payload.version }} version | ||
run: | | ||
git tag --sign "v${VERSION}" -m "${VERSION}" | ||
git push --tags | ||
env: | ||
VERSION: ${{ github.event.inputs.version }}${{ github.event.client_payload.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,36 @@ | ||
# Parts of this file were adapted from | ||
# GitHub’s collection of .gitignore file templates | ||
# which are Copyright (c) 2022 GitHub, Inc. | ||
# and released under the MIT License. | ||
# For more details, visit the project page: | ||
# https://github.com/github/gitignore | ||
|
||
# Build directories | ||
dist | ||
package | ||
target | ||
|
||
# Temporary development files | ||
tmp | ||
|
||
# If you prefer the allow list template instead of the deny list, see community template: | ||
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore | ||
# | ||
# 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/ | ||
|
||
# Go workspace file | ||
go.work |
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 @@ | ||
--- | ||
timeout: 30m | ||
|
||
skip-dirs: | ||
- dist | ||
- tmp | ||
|
||
linters: | ||
enable: | ||
- gofmt |
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 @@ | ||
--- | ||
release: | ||
prerelease: auto | ||
|
||
changelog: | ||
skip: true | ||
|
||
signs: | ||
- artifacts: checksum | ||
|
||
builds: | ||
- main: cmd/main.go | ||
env: | ||
- CGO_ENABLED=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,8 @@ | ||
# Change Log | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/) | ||
and this project adheres to [Semantic Versioning](https://semver.org/). | ||
|
||
## Unreleased |
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,20 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2022 Evan Sosenko | ||
|
||
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. |
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,18 @@ | ||
all: clean dist | ||
|
||
clean: | ||
@rm -rf dist | ||
|
||
dist: | ||
@goreleaser build --single-target --snapshot | ||
|
||
test: | ||
@go test ./... | ||
|
||
lint: | ||
@golangci-lint run | ||
|
||
format: | ||
@golangci-lint run --fix | ||
|
||
.PHONY: clean format lint test |
Oops, something went wrong.