Skip to content

Commit c8e2799

Browse files
committed
chore: updated template files
1 parent 3425449 commit c8e2799

File tree

9 files changed

+253
-71
lines changed

9 files changed

+253
-71
lines changed

.github/release.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
##################################################################
2-
# IMPORTANT NOTE #
3-
# #
4-
# This file is synced with https://github.com/atomicgo/template #
5-
# Please make changes there. #
6-
##################################################################
1+
# ┌───────────────────────────────────────────────────────────────────┐
2+
# │ │
3+
# │ IMPORTANT NOTE │
4+
# │ │
5+
# │ This file is synced with https://github.com/atomicgo/template │
6+
# │ │
7+
# │ Please apply all changes to the template repository │
8+
# │ │
9+
# └───────────────────────────────────────────────────────────────────┘
710

811
changelog:
912
exclude:
@@ -24,4 +27,3 @@ changelog:
2427
- title: Other Changes
2528
labels:
2629
- "*"
27-

.github/workflows/atomicgo.yml

Lines changed: 165 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,174 @@
1-
##################################################################
2-
# IMPORTANT NOTE #
3-
# #
4-
# This file is synced with https://github.com/atomicgo/template #
5-
# Please make changes there. #
6-
##################################################################
1+
# ┌───────────────────────────────────────────────────────────────────┐
2+
# │ │
3+
# │ IMPORTANT NOTE │
4+
# │ │
5+
# │ This file is synced with https://github.com/atomicgo/template │
6+
# │ │
7+
# │ Please apply all changes to the template repository │
8+
# │ │
9+
# └───────────────────────────────────────────────────────────────────┘
710

811
name: AtomicGo
912

1013
on:
1114
push:
12-
branches: [main]
13-
workflow_dispatch:
15+
branches:
16+
- main
17+
18+
permissions:
19+
contents: write
20+
packages: write
1421

1522
jobs:
16-
docs:
17-
if: "!contains(github.event.head_commit.message, 'autoupdate')"
23+
test:
24+
name: Test Go Code
25+
runs-on: ${{ matrix.os }}
26+
strategy:
27+
matrix:
28+
os: [ubuntu-latest, windows-latest, macos-latest]
29+
steps:
30+
- name: Set up Go
31+
uses: actions/setup-go@v4
32+
with:
33+
go-version: stable
34+
35+
- name: Check out code into the Go module directory
36+
uses: actions/checkout@v3
37+
38+
- name: Get dependencies
39+
run: go get -v -t -d ./...
40+
41+
- name: Build
42+
run: go build -v .
43+
44+
- name: Test
45+
run: go test -coverprofile="coverage.txt" -covermode=atomic -v -p 1 .
46+
47+
- name: Upload coverage to Codecov
48+
uses: codecov/codecov-action@v3
49+
50+
build:
51+
name: Build AtomicGo Package
1852
runs-on: ubuntu-latest
53+
needs: test
54+
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
1958
steps:
20-
- name: Update Docs
21-
uses: atomicgo/ci@main
22-
env:
23-
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
24-
TERM: xterm-256color
59+
- name: Checkout repository
60+
uses: actions/checkout@v3
61+
with:
62+
fetch-depth: 0
63+
64+
- name: Download assets
65+
run: |
66+
mkdir -p .templates
67+
wget https://raw.githubusercontent.com/atomicgo/atomicgo/main/templates/example.gotxt -O .templates/example.gotxt
68+
wget https://raw.githubusercontent.com/atomicgo/atomicgo/main/templates/readme.md -O .templates/readme.md
69+
70+
- name: Set up Go
71+
uses: actions/setup-go@v4
72+
with:
73+
go-version: stable
74+
75+
- name: Install Go tools
76+
run: |
77+
go install github.com/robertkrimen/godocdown/godocdown@latest
78+
go install github.com/princjef/gomarkdoc/cmd/gomarkdoc@latest
79+
go install github.com/caarlos0/svu@latest
80+
81+
- name: Set up Git configuration
82+
run: |
83+
REPO_FULLNAME="${{ github.repository }}"
84+
echo "::group::Setup git"
85+
git config --global --add safe.directory /github/workspace
86+
87+
echo "::notice::Login into git"
88+
git config --global user.email "git@marvinjwendt.com"
89+
git config --global user.name "MarvinJWendt"
90+
91+
echo "::notice::Ignore workflow files (we may not touch them)"
92+
git update-index --assume-unchanged .github/workflows/*
93+
94+
- name: Generate README.md
95+
run: |
96+
echo "::group::Generate README.md"
97+
FILE=./.github/atomicgo/custom_readme
98+
INCLUDE_UNEXPORTED=./.github/atomicgo/include_unexported
99+
if test -f "$FILE"; then
100+
echo "::notice::.github/custom_readme is present. Not generating a new readme."
101+
else
102+
echo "::notice::Running Godocdown"
103+
$(go env GOPATH)/bin/godocdown -template ./.templates/readme.md >README.md
104+
echo "::notice::Running gomarkdoc"
105+
GOMARKDOC_FLAGS="--template-file example=./.templates/example.gotxt"
106+
if test -f "$INCLUDE_UNEXPORTED"; then
107+
GOMARKDOC_FLAGS+=" -u"
108+
fi
109+
110+
$(go env GOPATH)/bin/gomarkdoc $GOMARKDOC_FLAGS --repository.url "https://github.com/${{ github.repository }}" --repository.default-branch main --repository.path / -e -o README.md .
111+
fi
112+
echo "::endgroup::"
113+
114+
- name: Run custom CI system (bash equivalent of main.go)
115+
run: |
116+
echo "::group::Run custom CI system"
117+
echo "::notice::Counting unit tests"
118+
unittest_count=$(go test -v -p 1 ./... | tee /dev/tty | grep -c "RUN")
119+
120+
echo "::notice::Replacing badge in README.md"
121+
sed -i 's|<img src="https://img.shields.io/badge/Unit_Tests-[^"]*-magenta?style=flat-square"|<img src="https://img.shields.io/badge/Unit_Tests-'$unittest_count'-magenta?style=flat-square"|g' README.md
122+
echo "::endgroup::"
123+
124+
- name: Run go mod tidy
125+
run: |
126+
echo "::group::Run go mod tidy"
127+
git checkout go.mod # reset go.mod file
128+
git checkout go.sum # reset go.sum file
129+
go mod tidy
130+
echo "::endgroup::"
131+
132+
- name: Stage and commit changes
133+
run: |
134+
echo "::group::Stage and commit changes"
135+
git add .
136+
git commit -m "docs: autoupdate" || true
137+
echo "::endgroup::"
138+
139+
- name: Push changes
140+
run: |
141+
echo "::notice::Pushing changes to origin"
142+
git push -u origin main
143+
144+
- name: Get current version
145+
id: current_version
146+
run: |
147+
echo "current_version=$(svu current)" >> $GITHUB_ENV
148+
echo "::notice::Current version is $(svu current)"
149+
150+
- name: Calculate next version
151+
id: next_version
152+
run: |
153+
echo "next_version=$(svu next)" >> $GITHUB_ENV
154+
echo "::notice::Next version is $(svu next)"
155+
156+
- name: Check if release is needed
157+
id: check_release
158+
run: |
159+
echo "release_needed=$( [ '${{ env.current_version }}' != '${{ env.next_version }}' ] && echo true || echo false )" >> $GITHUB_ENV
160+
161+
- name: Create tag
162+
if: env.release_needed == 'true'
163+
run: |
164+
git tag -a ${{ env.next_version }} -m "Release v${{ env.next_version }}"
165+
git push origin ${{ env.next_version }}
166+
sleep 5 # sleep for 5 seconds to allow GitHub to process the tag
167+
168+
- name: Release
169+
if: env.release_needed == 'true'
170+
uses: softprops/action-gh-release@v2
171+
with:
172+
token: ${{ secrets.GITHUB_TOKEN }}
173+
generate_release_notes: true
174+
tag_name: ${{ env.next_version }}

.github/workflows/go.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
##################################################################
2-
# IMPORTANT NOTE #
3-
# #
4-
# This file is synced with https://github.com/atomicgo/template #
5-
# Please make changes there. #
6-
##################################################################
1+
# ┌───────────────────────────────────────────────────────────────────┐
2+
# │ │
3+
# │ IMPORTANT NOTE │
4+
# │ │
5+
# │ This file is synced with https://github.com/atomicgo/template │
6+
# │ │
7+
# │ Please apply all changes to the template repository │
8+
# │ │
9+
# └───────────────────────────────────────────────────────────────────┘
710

811
name: Go
912

1013
on:
11-
push:
12-
branches: [main]
1314
pull_request:
1415

1516
jobs:
16-
build:
17-
name: Build
17+
test:
18+
name: Test Go code
1819
runs-on: ${{ matrix.os }}
1920
strategy:
2021
matrix:
2122
os: [ubuntu-latest, windows-latest, macos-latest]
2223
steps:
23-
- name: Set up Go 1.x
24-
uses: actions/setup-go@v2
24+
- name: Set up Go
25+
uses: actions/setup-go@v4
2526
with:
26-
go-version: ^1
27-
id: go
27+
go-version: stable
2828

2929
- name: Check out code into the Go module directory
30-
uses: actions/checkout@v2
30+
uses: actions/checkout@v3
3131

3232
- name: Get dependencies
3333
run: go get -v -t -d ./...

.github/workflows/lint.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
##################################################################
2-
# IMPORTANT NOTE #
3-
# #
4-
# This file is synced with https://github.com/atomicgo/template #
5-
# Please make changes there. #
6-
##################################################################
1+
# ┌───────────────────────────────────────────────────────────────────┐
2+
# │ │
3+
# │ IMPORTANT NOTE │
4+
# │ │
5+
# │ This file is synced with https://github.com/atomicgo/template │
6+
# │ │
7+
# │ Please apply all changes to the template repository │
8+
# │ │
9+
# └───────────────────────────────────────────────────────────────────┘
710

811
name: Code Analysis
912

.github/workflows/tweet-release.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
##################################################################
2-
# IMPORTANT NOTE #
3-
# #
4-
# This file is synced with https://github.com/atomicgo/template #
5-
# Please make changes there. #
6-
##################################################################
1+
# ┌───────────────────────────────────────────────────────────────────┐
2+
# │ │
3+
# │ IMPORTANT NOTE │
4+
# │ │
5+
# │ This file is synced with https://github.com/atomicgo/template │
6+
# │ │
7+
# │ Please apply all changes to the template repository │
8+
# │ │
9+
# └───────────────────────────────────────────────────────────────────┘
710

811
name: Tweet release
912

.gitignore

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,27 @@
1-
# Go template
2-
3-
## Binaries for programs and plugins
1+
# ┌───────────────────────────────────────────────────────────────────┐
2+
# │ │
3+
# │ IMPORTANT NOTE │
4+
# │ │
5+
# │ This file is synced with https://github.com/atomicgo/template │
6+
# │ │
7+
# │ Please apply all changes to the template repository │
8+
# │ │
9+
# └───────────────────────────────────────────────────────────────────┘
10+
11+
# Binaries
412
*.exe
513
*.exe~
6-
*.dll
714
*.so
8-
*.dylib
15+
16+
# Go specifics
917

1018
## Test binary, built with `go test -c`
1119
*.test
1220

13-
## Output of the go coverage tool, specifically when used with LiteIDE
21+
## Output of the go coverage tool
1422
*.out
1523

16-
## Dependency directories (remove the comment below to include it)
24+
## Vendored dependencies
1725
vendor/
1826

1927
# IDEs
@@ -31,10 +39,12 @@ gen
3139
# Operating System Files
3240

3341
## macOS
34-
### General
3542
.DS_Store
3643

3744
# Other
3845

3946
## Experimenting folder
4047
experimenting
48+
49+
## CI assets
50+
.templates

.golangci.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
##################################################################
2-
# IMPORTANT NOTE #
3-
# #
4-
# This file is synced with https://github.com/atomicgo/template #
5-
# Please make changes there. #
6-
##################################################################
1+
# ┌───────────────────────────────────────────────────────────────────┐
2+
# │ │
3+
# │ IMPORTANT NOTE │
4+
# │ │
5+
# │ This file is synced with https://github.com/atomicgo/template │
6+
# │ │
7+
# │ Please apply all changes to the template repository │
8+
# │ │
9+
# └───────────────────────────────────────────────────────────────────┘
710

811
run:
9-
# Timeout for analysis, e.g. 30s, 5m.
10-
# Default: 1m
1112
timeout: 3m
1213

1314
linters:

Makefile

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
##################################################################
2-
# IMPORTANT NOTE #
3-
# #
4-
# This file is synced with https://github.com/atomicgo/template #
5-
# Please make changes there. #
6-
##################################################################
1+
# ┌───────────────────────────────────────────────────────────────────┐
2+
# │ │
3+
# │ IMPORTANT NOTE │
4+
# │ │
5+
# │ This file is synced with https://github.com/atomicgo/template │
6+
# │ │
7+
# │ Please apply all changes to the template repository │
8+
# │ │
9+
# └───────────────────────────────────────────────────────────────────┘
710

811
test:
912
@echo "# Running tests..."

0 commit comments

Comments
 (0)