Skip to content

Commit

Permalink
add boilerplate
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredallard committed Oct 2, 2023
0 parents commit c8e92df
Show file tree
Hide file tree
Showing 12 changed files with 227 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/golangci-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: golangci-lint
on:
push:
branches:
- main
pull_request:

permissions:
contents: read

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "1.21.1"
cache: false # golangci-lint does it's own caching of this.
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.54.2
37 changes: 37 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: goreleaser

on:
push:
# Run only on tags
tags:
- "*"

permissions:
contents: write
packages: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git fetch --force --tags
- name: Install Tool Versions
uses: jdxcode/rtx-action@v1
env:
GH_TOKEN: ${{ github.token }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
vendor/
bin/
testdata/
output/
.DS_Store
*.out
.task
70 changes: 70 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
project_name: minecraft-preempt
before:
hooks:
- go mod download
builds:
- main: ./cmd/minecraft-preempt
env:
- CGO_ENABLED=0
goarch:
- amd64
- arm64
goos:
- linux
- windows
- darwin

archives:
- format: tar.gz
# use zip for windows archives
format_overrides:
- goos: windows
format: zip
dockers:
# amd64
- use: buildx
build_flag_templates:
- --platform=linux/amd64
- --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.description={{ .ProjectName }}
- --label=org.opencontainers.image.url=https://github.com/jaredallard/{{ .ProjectName }}
- --label=org.opencontainers.image.source=https://github.com/jaredallard/{{ .ProjectName }}
- --label=org.opencontainers.image.version={{ .Version }}
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.licenses=GPL-3.0
image_templates:
- "ghcr.io/jaredallard/{{.ProjectName}}:{{ .Version }}-amd64"
# arm64
- use: buildx
goos: linux
goarch: arm64
build_flag_templates:
- --platform=linux/arm64
- --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.description={{ .ProjectName }}
- --label=org.opencontainers.image.url=https://github.com/jaredallard/{{ .ProjectName }}
- --label=org.opencontainers.image.source=https://github.com/jaredallard/{{ .ProjectName }}
- --label=org.opencontainers.image.version={{ .Version }}
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.licenses=GPL-3.0
image_templates:
- "ghcr.io/jaredallard/{{.ProjectName}}:{{ .Version }}-arm64"
docker_manifests:
- name_template: "ghcr.io/jaredallard/{{.ProjectName}}:{{ .Version }}"
image_templates:
- "ghcr.io/jaredallard/{{.ProjectName}}:{{ .Version }}-arm64"
- "ghcr.io/jaredallard/{{.ProjectName}}:{{ .Version }}-amd64"
checksum:
name_template: "checksums.txt"
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
3 changes: 3 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
golang 1.21.1
goreleaser 1.18.2
golangci-lint 1.54.2
23 changes: 23 additions & 0 deletions .vscode/common.code-snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"Copyright": {
"description": "Inserts a GNU GPLv3 license header",
"prefix": ["license", "copy", "copyright"],
"body": [
"// Copyright (C) ${CURRENT_YEAR} Jared Allard <jaredallard@users.noreply.github.com>",
"//",
"// This program is free software: you can redistribute it and/or modify",
"// it under the terms of the GNU General Public License as published by",
"// the Free Software Foundation, either version 3 of the License, or",
"// (at your option) any later version.",
"//",
"// This program is distributed in the hope that it will be useful,",
"// but WITHOUT ANY WARRANTY; without even the implied warranty of",
"// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the",
"// GNU General Public License for more details.",
"//",
"// You should have received a copy of the GNU General Public License",
"// along with this program. If not, see <https://www.gnu.org/licenses/>.",
""
]
}
}
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
SHELL := /bin/bash

.PHONY: build
build:
@command -v task >/dev/null || (echo "task not found, please install it. https://taskfile.dev/installation/" && exit 1)
@task
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# miku

A Discord bot to convert media links (e.g., Spotify, Apple Music)
between each other.

## Usage

TODO

## License

GPL-2.0-only
16 changes: 16 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: "3"

tasks:
default:
cmds:
- task: build
test:
cmds:
- go test -v ./...
build:
generates:
- bin/miku
sources:
- "./**/*.go"
cmds:
- go build -trimpath -ldflags="-w -s" -o ./bin/ -v ./cmd/miku
22 changes: 22 additions & 0 deletions cmd/miku/miku.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (C) 2023 Jared Allard <jaredallard@users.noreply.github.com>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

// Package main implements the CLI wrapper for the miku discord bot.
package main

// main implements the miku CLI.
func main() {
return

Check failure on line 21 in cmd/miku/miku.go

View workflow job for this annotation

GitHub Actions / lint

S1023: redundant `return` statement (gosimple)
}
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/jaredallard/miku

go 1.21.1
4 changes: 4 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:base"]
}

0 comments on commit c8e92df

Please sign in to comment.