Skip to content

Commit 722d91c

Browse files
authored
Initial commit
0 parents  commit 722d91c

29 files changed

Lines changed: 1223 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: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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+
22+
- package-ecosystem: docker
23+
directory: /
24+
schedule:
25+
interval: daily
26+
time: "00:00"
27+
commit-message:
28+
prefix: "docker:"
29+
cooldown:
30+
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: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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+
go-version: [stable, oldstable]
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
19+
20+
- name: Unshallow
21+
run: git fetch --prune --unshallow
22+
23+
- name: Set up Go
24+
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
25+
with:
26+
go-version: ${{ matrix['go-version'] }}
27+
28+
- name: Setup tools
29+
run: |
30+
make tools
31+
32+
- name: make test
33+
run: |
34+
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@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
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@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
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@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.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@7191605433b03e11b313dbbc0efb80185170de4b # v1.9.0
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/tests.yaml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
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@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.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+
29+
lint-go:
30+
name: lint-go
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Checkout
34+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
35+
36+
- name: Unshallow
37+
run: git fetch --prune --unshallow
38+
39+
- name: Set up Go
40+
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
41+
with:
42+
go-version-file: 'go.mod'
43+
44+
- name: Setup tools
45+
run: |
46+
make tools
47+
48+
- name: make lint-go
49+
run: |
50+
# Explicitly set GOROOT to avoid golangci-lint/issues/3107
51+
GOROOT=$(go env GOROOT)
52+
export GOROOT
53+
make lint-go
54+
55+
- name: make vulncheck
56+
run: |
57+
make vulncheck
58+
59+
test:
60+
name: test
61+
runs-on: ubuntu-latest
62+
strategy:
63+
matrix:
64+
go-version:
65+
- stable
66+
- oldstable
67+
68+
steps:
69+
- name: Checkout
70+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
71+
72+
- name: Unshallow
73+
run: git fetch --prune --unshallow
74+
75+
- name: Set up Go
76+
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
77+
with:
78+
go-version: ${{ matrix['go-version'] }}
79+
80+
- name: Setup tools
81+
run: |
82+
make tools
83+
84+
- name: make test
85+
run: |
86+
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)