Skip to content

Commit

Permalink
chore: updated template files
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvinJWendt committed Jul 19, 2024
1 parent 48baa3c commit cf0f797
Show file tree
Hide file tree
Showing 9 changed files with 265 additions and 75 deletions.
16 changes: 9 additions & 7 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
##################################################################
# IMPORTANT NOTE #
# #
# This file is synced with https://github.com/atomicgo/template #
# Please make changes there. #
##################################################################
# β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
# β”‚ β”‚
# β”‚ IMPORTANT NOTE β”‚
# β”‚ β”‚
# β”‚ This file is synced with https://github.com/atomicgo/template β”‚
# β”‚ β”‚
# β”‚ Please apply all changes to the template repository β”‚
# β”‚ β”‚
# β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

changelog:
exclude:
Expand All @@ -24,4 +27,3 @@ changelog:
- title: Other Changes
labels:
- "*"

180 changes: 165 additions & 15 deletions .github/workflows/atomicgo.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,174 @@
##################################################################
# IMPORTANT NOTE #
# #
# This file is synced with https://github.com/atomicgo/template #
# Please make changes there. #
##################################################################
# β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
# β”‚ β”‚
# β”‚ IMPORTANT NOTE β”‚
# β”‚ β”‚
# β”‚ This file is synced with https://github.com/atomicgo/template β”‚
# β”‚ β”‚
# β”‚ Please apply all changes to the template repository β”‚
# β”‚ β”‚
# β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

name: AtomicGo

on:
push:
branches: [main]
workflow_dispatch:
branches:
- main

permissions:
contents: write
packages: write

jobs:
docs:
if: "!contains(github.event.head_commit.message, 'autoupdate')"
test:
name: Test Go Code
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: stable

- name: Check out code into the Go module directory
uses: actions/checkout@v3

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

- name: Build
run: go build -v .

- name: Test
run: go test -coverprofile="coverage.txt" -covermode=atomic -v -p 1 .

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3

build:
name: Build AtomicGo Package
runs-on: ubuntu-latest
needs: test

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- name: Update Docs
uses: atomicgo/ci@main
env:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
TERM: xterm-256color
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Download assets
run: |
mkdir -p .templates
wget https://raw.githubusercontent.com/atomicgo/atomicgo/main/templates/example.gotxt -O .templates/example.gotxt
wget https://raw.githubusercontent.com/atomicgo/atomicgo/main/templates/readme.md -O .templates/readme.md
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: stable

- name: Install Go tools
run: |
go install github.com/robertkrimen/godocdown/godocdown@latest
go install github.com/princjef/gomarkdoc/cmd/gomarkdoc@latest
go install github.com/caarlos0/svu@latest
- name: Set up Git configuration
run: |
REPO_FULLNAME="${{ github.repository }}"
echo "::group::Setup git"
git config --global --add safe.directory /github/workspace
echo "::notice::Login into git"
git config --global user.email "git@marvinjwendt.com"
git config --global user.name "MarvinJWendt"
echo "::notice::Ignore workflow files (we may not touch them)"
git update-index --assume-unchanged .github/workflows/*
- name: Generate README.md
run: |
echo "::group::Generate README.md"
FILE=./.github/atomicgo/custom_readme
INCLUDE_UNEXPORTED=./.github/atomicgo/include_unexported
if test -f "$FILE"; then
echo "::notice::.github/custom_readme is present. Not generating a new readme."
else
echo "::notice::Running Godocdown"
$(go env GOPATH)/bin/godocdown -template ./.templates/readme.md >README.md
echo "::notice::Running gomarkdoc"
GOMARKDOC_FLAGS="--template-file example=./.templates/example.gotxt"
if test -f "$INCLUDE_UNEXPORTED"; then
GOMARKDOC_FLAGS+=" -u"
fi
$(go env GOPATH)/bin/gomarkdoc $GOMARKDOC_FLAGS --repository.url "https://github.com/${{ github.repository }}" --repository.default-branch main --repository.path / -e -o README.md .
fi
echo "::endgroup::"
- name: Run custom CI system (bash equivalent of main.go)
run: |
echo "::group::Run custom CI system"
echo "::notice::Counting unit tests"
unittest_count=$(go test -v -p 1 ./... | tee /dev/tty | grep -c "RUN")
echo "::notice::Replacing badge in README.md"
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
echo "::endgroup::"
- name: Run go mod tidy
run: |
echo "::group::Run go mod tidy"
git checkout go.mod # reset go.mod file
git checkout go.sum # reset go.sum file
go mod tidy
echo "::endgroup::"
- name: Stage and commit changes
run: |
echo "::group::Stage and commit changes"
git add .
git commit -m "docs: autoupdate" || true
echo "::endgroup::"
- name: Push changes
run: |
echo "::notice::Pushing changes to origin"
git push -u origin main
- name: Get current version
id: current_version
run: |
echo "current_version=$(svu current)" >> $GITHUB_ENV
echo "::notice::Current version is $(svu current)"
- name: Calculate next version
id: next_version
run: |
echo "next_version=$(svu next)" >> $GITHUB_ENV
echo "::notice::Next version is $(svu next)"
- name: Check if release is needed
id: check_release
run: |
echo "release_needed=$( [ '${{ env.current_version }}' != '${{ env.next_version }}' ] && echo true || echo false )" >> $GITHUB_ENV
- name: Create tag
if: env.release_needed == 'true'
run: |
git tag -a ${{ env.next_version }} -m "Release v${{ env.next_version }}"
git push origin ${{ env.next_version }}
sleep 5 # sleep for 5 seconds to allow GitHub to process the tag
- name: Release
if: env.release_needed == 'true'
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
generate_release_notes: true
tag_name: ${{ env.next_version }}
30 changes: 15 additions & 15 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
##################################################################
# IMPORTANT NOTE #
# #
# This file is synced with https://github.com/atomicgo/template #
# Please make changes there. #
##################################################################
# β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
# β”‚ β”‚
# β”‚ IMPORTANT NOTE β”‚
# β”‚ β”‚
# β”‚ This file is synced with https://github.com/atomicgo/template β”‚
# β”‚ β”‚
# β”‚ Please apply all changes to the template repository β”‚
# β”‚ β”‚
# β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

name: Go

on:
push:
branches: [main]
pull_request:

jobs:
build:
name: Build
test:
name: Test Go code
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ^1
id: go
go-version: stable

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

- name: Get dependencies
run: go get -v -t -d ./...
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
##################################################################
# IMPORTANT NOTE #
# #
# This file is synced with https://github.com/atomicgo/template #
# Please make changes there. #
##################################################################
# β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
# β”‚ β”‚
# β”‚ IMPORTANT NOTE β”‚
# β”‚ β”‚
# β”‚ This file is synced with https://github.com/atomicgo/template β”‚
# β”‚ β”‚
# β”‚ Please apply all changes to the template repository β”‚
# β”‚ β”‚
# β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

name: Code Analysis

Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/tweet-release.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
##################################################################
# IMPORTANT NOTE #
# #
# This file is synced with https://github.com/atomicgo/template #
# Please make changes there. #
##################################################################
# β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
# β”‚ β”‚
# β”‚ IMPORTANT NOTE β”‚
# β”‚ β”‚
# β”‚ This file is synced with https://github.com/atomicgo/template β”‚
# β”‚ β”‚
# β”‚ Please apply all changes to the template repository β”‚
# β”‚ β”‚
# β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

name: Tweet release

Expand Down
42 changes: 30 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,32 +1,50 @@
### Go template
# Binaries for programs and plugins
# β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
# β”‚ β”‚
# β”‚ IMPORTANT NOTE β”‚
# β”‚ β”‚
# β”‚ This file is synced with https://github.com/atomicgo/template β”‚
# β”‚ β”‚
# β”‚ Please apply all changes to the template repository β”‚
# β”‚ β”‚
# β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

# Binaries
*.exe
*.exe~
*.dll
*.so
*.dylib
go.work

# Test binary, built with `go test -c`
# Go specifics

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

# Output of the go coverage tool, specifically when used with LiteIDE
## Output of the go coverage tool
*.out

# Dependency directories (remove the comment below to include it)
## Vendored dependencies
vendor/

### IntelliJ
# IDEs

## IntelliJ
.idea
*.iml
out
gen

### VisualStudioCode
## Visual Studio Code
.vscode
*.code-workspace

### macOS
# General
# Operating System Files

## macOS
.DS_Store

# Other

## Experimenting folder
experimenting

## CI assets
.templates
17 changes: 9 additions & 8 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
##################################################################
# IMPORTANT NOTE #
# #
# This file is synced with https://github.com/atomicgo/template #
# Please make changes there. #
##################################################################
# β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
# β”‚ β”‚
# β”‚ IMPORTANT NOTE β”‚
# β”‚ β”‚
# β”‚ This file is synced with https://github.com/atomicgo/template β”‚
# β”‚ β”‚
# β”‚ Please apply all changes to the template repository β”‚
# β”‚ β”‚
# β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

run:
# Timeout for analysis, e.g. 30s, 5m.
# Default: 1m
timeout: 3m

linters:
Expand Down
Loading

0 comments on commit cf0f797

Please sign in to comment.