Skip to content

Commit 0ac0d41

Browse files
authored
Merge pull request #1 from OneFineDev/feat/refactor
ci: add .goreleaser
2 parents cb93880 + e2e06bf commit 0ac0d41

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+2945
-1367
lines changed

.cz.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[tool.commitizen]
2+
name = "cz_conventional_commits"
3+
version = "v0.0.0"
4+
tag_format = "v$major.$minor.$patch$prerelease"
5+
bump_message = "release $current_version -> $new_version [skip ci]"
6+
version_files = [".cz.toml", "VERSION"]
7+
update_changelog_on_bump = true

.github/copilot-instructions.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,16 @@ When testing unexported methods or functions, these tests should be created in a
1111

1212
Wherever the tested method or function uses the afero package, always use a memmap fs as the filesystem in tests (i.e. don't write to disk where this can be avoided.).
1313

14-
When writing assertions in tests, do not abstract assertion/verification logic into functions stores in test cases, explicitly define the assertion or verification logic in the "Assert" portion of the test; use conditional logic if needed here.
14+
When writing assertions in tests, do not abstract assertion/verification logic into functions stores in test cases, explicitly define the assertion or verification logic in the "Assert" portion of the test; use conditional logic if needed here. Use testify require (not testify assert) when checking for the presence or absence of errors. Use assert.Len when asserting the length of objects.
1515

1616
When creating a test file, the package name should always be the package name with "\_test" appended.
1717

18-
When creating or satisfying a slog logger on services, always use the DiscardHandler
18+
When creating or satisfying a slog logger on services, always use the DiscardHandler.
1919

2020
<!-- Style -->
2121

2222
Any comments you include above functions or types should end with a period.
23+
24+
<!-- Code Quality -->
25+
26+
When generating go code, avoid variable name shadowing.

.github/workflows/pr.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# This workflow will build a golang project
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
3+
4+
name: PR
5+
6+
on:
7+
push:
8+
branches: ["main"]
9+
10+
pull_request:
11+
branches: ["main"]
12+
13+
jobs:
14+
entry:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: wagoid/commitlint-github-action@v6
19+
20+
build:
21+
needs: entry
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Install Task
25+
uses: arduino/setup-task@v2
26+
with:
27+
version: 3.x
28+
repo-token: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- uses: actions/checkout@v4
31+
32+
- name: Set up Go
33+
uses: actions/setup-go@v4
34+
with:
35+
go-version: "1.24.x"
36+
37+
- name: Install Test dependencies
38+
run: task get_test_dependencies
39+
40+
- name: Build
41+
run: go build -v ./...
42+
43+
- name: Test
44+
run: task test_coverage
45+
46+
- name: Archive code coverage results
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: code-coverage
50+
path: coverage.txt

.github/workflows/release.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Release
2+
on:
3+
workflow_run:
4+
workflows: ["PR"]
5+
types:
6+
- completed
7+
branches:
8+
- stable
9+
10+
permissions:
11+
contents: write
12+
# packages: write
13+
# issues: write
14+
# id-token: write
15+
16+
jobs:
17+
release:
18+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: write
22+
issues: write
23+
pull-requests: write
24+
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 0
30+
- name: Set up Go
31+
uses: actions/setup-go@v5
32+
with:
33+
go-version: stable
34+
# More assembly might be required: Docker logins, GPG, etc.
35+
# It all depends on your needs.
36+
- name: github-action-svu
37+
uses: charlesthomas/[email protected]+3.2.3
38+
- name: Run GoReleaser
39+
uses: goreleaser/goreleaser-action@v6
40+
with:
41+
# either 'goreleaser' (default) or 'goreleaser-pro'
42+
distribution: goreleaser
43+
# 'latest', 'nightly', or a semver
44+
version: "~> v2"
45+
args: release --clean
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
49+
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}

.gitignore

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
9+
# Diagnostic reports (https://nodejs.org/api/report.html)
10+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11+
12+
# Runtime data
13+
pids
14+
*.pid
15+
*.seed
16+
*.pid.lock
17+
18+
# Directory for instrumented libs generated by jscoverage/JSCover
19+
lib-cov
20+
21+
# Coverage directory used by tools like istanbul
22+
coverage
23+
*.lcov
24+
25+
# nyc test coverage
26+
.nyc_output
27+
28+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29+
.grunt
30+
31+
# Bower dependency directory (https://bower.io/)
32+
bower_components
33+
34+
# node-waf configuration
35+
.lock-wscript
36+
37+
# Compiled binary addons (https://nodejs.org/api/addons.html)
38+
build/Release
39+
40+
bin
41+
42+
#go stuff
43+
44+
tmp
45+
46+
# Dependency directories
47+
node_modules/
48+
jspm_packages/
49+
50+
# Snowpack dependency directory (https://snowpack.dev/)
51+
web_modules/
52+
53+
# TypeScript cache
54+
*.tsbuildinfo
55+
56+
# Optional npm cache directory
57+
.npm
58+
59+
# Optional eslint cache
60+
.eslintcache
61+
62+
# Microbundle cache
63+
.rpt2_cache/
64+
.rts2_cache_cjs/
65+
.rts2_cache_es/
66+
.rts2_cache_umd/
67+
68+
# Optional REPL history
69+
.node_repl_history
70+
71+
# Output of 'npm pack'
72+
*.tgz
73+
74+
# Yarn Integrity file
75+
.yarn-integrity
76+
77+
# dotenv environment variables file
78+
.env
79+
.env.test
80+
81+
# parcel-bundler cache (https://parceljs.org/)
82+
.cache
83+
.parcel-cache
84+
85+
# Next.js build output
86+
.next
87+
out
88+
89+
# Nuxt.js build / generate output
90+
.nuxt
91+
dist
92+
93+
# Gatsby files
94+
.cache/
95+
# Comment in the public line in if your project uses Gatsby and not Next.js
96+
# https://nextjs.org/blog/next-9-1#public-directory-support
97+
# public
98+
99+
# vuepress build output
100+
.vuepress/dist
101+
102+
# Serverless directories
103+
.serverless/
104+
105+
# FuseBox cache
106+
.fusebox/
107+
108+
# DynamoDB Local files
109+
.dynamodb/
110+
111+
# TernJS port file
112+
.tern-port
113+
114+
# Stores VSCode versions used for testing VSCode extensions
115+
.vscode-test
116+
117+
# yarn v2
118+
.yarn/cache
119+
.yarn/unplugged
120+
.yarn/build-state.yml
121+
.yarn/install-state.gz
122+
.pnp.*
123+
124+
# Local .terraform directories
125+
**/.terraform/*
126+
127+
# .tfstate files
128+
*.tfstate
129+
*.tfstate.*
130+
131+
# Crash log files
132+
crash.log
133+
crash.*.log
134+
135+
# Exclude all .tfvars files, which are likely to contain sensitive data, such as
136+
# password, private keys, and other secrets. These should not be part of version
137+
# control as they are data points which are potentially sensitive and subject
138+
# to change depending on the environment.
139+
#*.tfvars
140+
#*.tfvars.json
141+
142+
# Ignore override files as they are usually used to override resources locally and so
143+
# are not checked in
144+
override.tf
145+
override.tf.json
146+
*_override.tf
147+
*_override.tf.json
148+
149+
# Include override files you do wish to add to version control using negated pattern
150+
# !example_override.tf
151+
152+
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
153+
# example: *tfplan*
154+
155+
# Ignore CLI configuration files
156+
.terraformrc
157+
terraform.rc
158+
159+
testing
160+
# Added by goreleaser init:
161+
dist/

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ linters:
289289
captLocal:
290290
# Whether to restrict checker to params only.
291291
# Default: true
292-
paramsOnly: false
292+
paramsOnly: true
293293
underef:
294294
# Whether to skip (*x).method() calls where x is a pointer receiver.
295295
# Default: true

.goreleaser.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
version: 2
2+
3+
before:
4+
hooks:
5+
# You may remove this if you don't use go modules.
6+
- go mod tidy
7+
# you may remove this if you don't need go generate
8+
- go generate ./...
9+
10+
builds:
11+
- env:
12+
- CGO_ENABLED=0
13+
goos:
14+
- linux
15+
# - windows
16+
# - darwin
17+
ldflags:
18+
- -s -w -X github.com/OneFineDev/tmpltr/cmd.version={{.Version}}
19+
archives:
20+
- formats: tar.gz
21+
# this name template makes the OS and Arch compatible with the results of `uname`.
22+
name_template: >-
23+
tmpltr
24+
{{ .Version }}_
25+
{{- title .Os }}_
26+
{{- if eq .Arch "amd64" }}x86_64
27+
{{- else if eq .Arch "386" }}i386
28+
{{- else }}{{ .Arch }}{{ end }}
29+
{{- if .Arm }}v{{ .Arm }}{{ end }}
30+
# use zip for windows archives
31+
format_overrides:
32+
- formats: ["zip"]
33+
34+
changelog:
35+
sort: asc
36+
filters:
37+
exclude:
38+
- "^docs:"
39+
- "^test:"
40+
41+
release:
42+
footer: >-
43+
44+
---
45+
46+
Released by [GoReleaser](https://github.com/goreleaser/goreleaser).

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npm test

.pre-commit-config.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.4.0
4+
hooks:
5+
- id: check-merge-conflict
6+
alias: ci
7+
- id: check-yaml
8+
alias: ci
9+
- id: end-of-file-fixer
10+
alias: ci
11+
- id: check-added-large-files
12+
args: ["--maxkb=1500"]
13+
alias: ci
14+
- id: detect-private-key
15+
alias: ci
16+
- id: trailing-whitespace
17+
alias: ci
18+
19+
- repo: https://github.com/dnephin/pre-commit-golang
20+
rev: v0.5.1
21+
hooks:
22+
- id: go-fmt
23+
alias: ci
24+
- id: golangci-lint
25+
alias: ci
26+
- id: go-unit-tests
27+
alias: ci

0 commit comments

Comments
 (0)