Skip to content

Commit 49c146b

Browse files
authored
Initial commit
0 parents  commit 49c146b

29 files changed

Lines changed: 1202 additions & 0 deletions

.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.env
2+
vendor
3+
dist
4+
work

.github/dependabot.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
version: 2
2+
3+
updates:
4+
- package-ecosystem: github-actions
5+
directory: /
6+
schedule:
7+
interval: daily
8+
time: "00:00"
9+
commit-message:
10+
prefix: "ci:"
11+
cooldown:
12+
default-days: 7
13+
14+
- package-ecosystem: gomod
15+
directory: /
16+
schedule:
17+
interval: daily
18+
time: "00:00"
19+
commit-message:
20+
prefix: "go:"
21+
cooldown:
22+
default-days: 7

.github/release.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
changelog:
2+
exclude:
3+
labels:
4+
- tagpr

.github/workflows/daily.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Daily Integration Test
2+
on:
3+
schedule:
4+
- cron: '30 23 * * *'
5+
workflow_dispatch:
6+
env:
7+
GOPROXY: https://proxy.golang.org
8+
jobs:
9+
test:
10+
name: test
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
os: [macos-latest, windows-latest, ubuntu-latest, ubuntu-24.04, ubuntu-22.04]
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
18+
19+
- name: Unshallow
20+
run: git fetch --prune --unshallow
21+
22+
- name: Set up Go
23+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
24+
with:
25+
go-version-file: 'go.mod'
26+
27+
- name: Setup tools
28+
run: |
29+
make tools
30+
31+
- name: make test
32+
run: |
33+
make test
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# from https://docs.github.com/en/free-pro-team@latest/actions/guides/publishing-docker-images#publishing-images-to-github-packages
2+
name: Publish Docker image(dev)
3+
on:
4+
push:
5+
branches:
6+
- main
7+
jobs:
8+
push_to_registry:
9+
name: Push Docker image to GitHub Container Registry(dev)
10+
runs-on: ubuntu-latest
11+
steps:
12+
-
13+
name: Check out the repo
14+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
15+
-
16+
name: Set up QEMU
17+
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
18+
-
19+
name: Set up Docker Buildx
20+
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
21+
-
22+
name: Login to GitHub Container Registry
23+
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
24+
with:
25+
registry: ghcr.io
26+
username: ${{ github.repository_owner }}
27+
password: ${{ secrets.CR_PAT }}
28+
-
29+
name: Build and push to GitHub Container Registry
30+
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
31+
with:
32+
context: .
33+
platforms: linux/amd64,linux/arm64
34+
tags: ghcr.io/sacloud/go-template:dev
35+
push: true
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# from https://docs.github.com/en/free-pro-team@latest/actions/guides/publishing-docker-images#publishing-images-to-github-packages
2+
name: Publish Docker image
3+
on:
4+
push:
5+
tags: 'v[0-9]+.[0-9]+.[0-9]+*'
6+
jobs:
7+
push_to_registry:
8+
name: Push Docker image to GitHub Container Registry(latest)
9+
runs-on: ubuntu-latest
10+
steps:
11+
-
12+
name: Check out the repo
13+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
14+
-
15+
name: Docker meta
16+
id: meta
17+
uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f # v5.8.0
18+
with:
19+
images: ghcr.io/sacloud/go-template
20+
-
21+
name: Set up QEMU
22+
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
23+
-
24+
name: Set up Docker Buildx
25+
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
26+
-
27+
name: Login to GitHub Container Registry
28+
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
29+
with:
30+
registry: ghcr.io
31+
username: ${{ github.repository_owner }}
32+
password: ${{ secrets.CR_PAT }}
33+
-
34+
name: Build and push to GitHub Container Registry
35+
uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 # v5.4.0
36+
with:
37+
context: .
38+
platforms: linux/amd64,linux/arm64
39+
tags: ${{ steps.meta.outputs.tags }},ghcr.io/sacloud/go-template:latest
40+
push: true

.github/workflows/tagpr.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# .github/workflows/tagpr.yml
2+
name: tagpr
3+
on:
4+
push:
5+
branches: ["main"]
6+
7+
jobs:
8+
tagpr:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: write
12+
pull-requests: write
13+
issues: write
14+
steps:
15+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
16+
- uses: Songmu/tagpr@9c294c8b7b1815a5f3b7c61d6ee6aa50ac25b030 # v1.8.4
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/tests.yaml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Tests
2+
on: [push, pull_request]
3+
env:
4+
GOPROXY: https://proxy.golang.org
5+
jobs:
6+
lint-text:
7+
name: lint-text
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
12+
13+
- name: Unshallow
14+
run: git fetch --prune --unshallow
15+
16+
- name: Set up Go
17+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
18+
with:
19+
go-version-file: 'go.mod'
20+
21+
- name: Setup tools
22+
run: |
23+
make tools
24+
25+
- name: make lint-text
26+
run: |
27+
make lint-text
28+
lint-go:
29+
name: lint-go
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
34+
35+
- name: Unshallow
36+
run: git fetch --prune --unshallow
37+
38+
- name: Set up Go
39+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
40+
with:
41+
go-version-file: 'go.mod'
42+
43+
- name: Setup tools
44+
run: |
45+
make tools
46+
47+
- name: make lint-go
48+
run: |
49+
# Explicitly set GOROOT to avoid golangci-lint/issues/3107
50+
GOROOT=$(go env GOROOT)
51+
export GOROOT
52+
make lint-go
53+
54+
- name: make vulncheck
55+
run: |
56+
make vulncheck
57+
58+
test:
59+
name: test
60+
runs-on: ubuntu-latest
61+
steps:
62+
- name: Checkout
63+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
64+
65+
- name: Unshallow
66+
run: git fetch --prune --unshallow
67+
68+
- name: Set up Go
69+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
70+
with:
71+
go-version-file: 'go.mod'
72+
73+
- name: Setup tools
74+
run: |
75+
make tools
76+
77+
- name: make test
78+
run: |
79+
make test

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.env
2+
vendor/
3+
dist/
4+
work/
5+
go-template

.golangci.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
version: "2"
2+
run:
3+
timeout: 10m10s
4+
5+
issues:
6+
max-issues-per-linter: 0
7+
max-same-issues: 0
8+
9+
linters:
10+
default: none
11+
enable:
12+
- errcheck
13+
- gocritic
14+
- goprintffuncname
15+
- gosec
16+
- govet
17+
- ineffassign
18+
- misspell
19+
- nakedret
20+
- nolintlint
21+
- unconvert
22+
- unused
23+
- whitespace
24+
25+
formatters:
26+
enable:
27+
- gofmt
28+
- goimports
29+
30+
# don't enable:
31+
# - asciicheck
32+
# - depguard
33+
# - dogsled
34+
# - dupl
35+
# - funlen
36+
# - gochecknoinits
37+
# - gochecknoglobals
38+
# - gocognit
39+
# - goconst
40+
# - gocyclo
41+
# - gomnd
42+
# - godot
43+
# - godox
44+
# - goerr113
45+
# - lll
46+
# - prealloc
47+
# - revive
48+
# - stylecheck
49+
# - staticcheck
50+
# - structcheck
51+
# - testpackage
52+
# - unparam
53+
# - wsl

0 commit comments

Comments
 (0)