Skip to content

Commit aba4918

Browse files
authored
Merge pull request #2 from averak/feature/1-ci-settings
CIを設定した
2 parents eb5138d + 4505350 commit aba4918

File tree

8 files changed

+162
-1
lines changed

8 files changed

+162
-1
lines changed

.github/workflows/ci.yml

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- develop
8+
pull_request:
9+
10+
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-go@v5
17+
with:
18+
go-version-file: go.mod
19+
20+
- name: test
21+
run: |
22+
make test
23+
24+
code-check:
25+
runs-on: ubuntu-latest
26+
27+
steps:
28+
- uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 0
31+
- uses: actions/setup-go@v5
32+
with:
33+
go-version-file: go.mod
34+
- uses: actions/cache@v4
35+
id: cache-makefile
36+
with:
37+
path: ~/go/bin
38+
key: ${{ runner.os }}-makefile-${{ hashFiles('Makefile') }}-${{ hashFiles('cmd') }}-${{ hashFiles('go.mod') }}
39+
40+
- name: dependencies
41+
if: steps.cache-makefile.outputs.cache-hit != 'true'
42+
run: |
43+
make install-tools
44+
45+
- name: lint
46+
run: |
47+
make lint
48+
49+
- name: codegen nodiff
50+
run: |
51+
make codegen
52+
test -z "$(git status --porcelain)" || (git status; git diff; exit 1)
53+
54+
- name: format nodiff
55+
run: |
56+
make format
57+
test -z "$(git status --porcelain)" || (git status; git diff; exit 1)

.golangci.yml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
run:
2+
timeout: 5m
3+
output:
4+
sort-results: true
5+
linters:
6+
disable-all: true
7+
enable:
8+
- errcheck
9+
- gosimple
10+
- ineffassign
11+
- staticcheck
12+
- typecheck
13+
- govet
14+
- bodyclose
15+
- goimports
16+
- noctx
17+
- prealloc
18+
- misspell
19+
- nolintlint
20+
- asciicheck
21+
- bidichk
22+
- containedctx
23+
- contextcheck
24+
- gocyclo
25+
- makezero
26+
- nakedret
27+
- unconvert
28+
- wastedassign
29+
- whitespace
30+
- nilerr
31+
- forcetypeassert
32+
- exhaustive
33+
- errorlint
34+
issues:
35+
max-issues-per-linter: 0
36+
max-same-issues: 0
37+
exclude-dirs:
38+
- protobuf
39+
- schema
40+
- tmp

Makefile

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
.PHONY: install-tools
2+
install-tools:
3+
go install github.com/bufbuild/buf/cmd/buf@v1.47.2
4+
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
5+
6+
.PHONY: test
7+
test:
8+
go test -v ./...
9+
10+
.PHONY: format
11+
format:
12+
go fmt ./...
13+
golangci-lint run --issues-exit-code=0 --fix ./...
14+
# buf format --write
15+
16+
BREAKING_CHANGE_BASE_BRANCH?=develop
17+
.PHONY: lint
18+
lint:
19+
golangci-lint run --issues-exit-code=1 ./...
20+
# buf lint
21+
# buf breaking --against '.git#branch=$(BREAKING_CHANGE_BASE_BRANCH)'
22+
23+
.PHONY: codegen
24+
codegen:
25+
# find . -type f \( -name '*.pb.go' \) -delete
26+
# buf generate

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
# protobq
22

3-
A tool for schema-driven development in BigQuery using Protocol Buffers.
3+
![CI](https://github.com/averak/protobq/workflows/CI/badge.svg)
4+
5+
A tool for idempotent schema management in BigQuery using Protocol Buffers.

buf.gen.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: v2
2+
managed:
3+
enabled: true
4+
override:
5+
- file_option: go_package_prefix
6+
value: github.com/averak/protobq/protobuf
7+
plugins:
8+
- remote: buf.build/protocolbuffers/go:v1.35.2
9+
out: protobuf
10+
opt: paths=source_relative

buf.lock

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Generated by buf. DO NOT EDIT.
2+
version: v2
3+
deps:
4+
- name: buf.build/googleapis/googleapis
5+
commit: acd896313c55464b993332136ded1b6e
6+
digest: b5:025d83e25193feb8dac5e5576113c8737006218b3b09fbc0d0ff652614da5424b336edb15bea139eb90d14eba656774a979d1fbdae81cbab2013932b84b98f53

buf.yaml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: v2
2+
modules:
3+
- path: schema/protobuf
4+
deps:
5+
- buf.build/googleapis/googleapis
6+
lint:
7+
use:
8+
- STANDARD
9+
except:
10+
- PACKAGE_VERSION_SUFFIX
11+
breaking:
12+
use:
13+
- FILE

main.go

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package main
2+
3+
import "log"
4+
5+
func main() {
6+
log.Println("Hello, World!")
7+
}

0 commit comments

Comments
 (0)