Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CIを設定した #2

Merged
merged 1 commit into from
Dec 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: CI

on:
push:
branches:
- main
- develop
pull_request:

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: test
run: |
make test

code-check:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- uses: actions/cache@v4
id: cache-makefile
with:
path: ~/go/bin
key: ${{ runner.os }}-makefile-${{ hashFiles('Makefile') }}-${{ hashFiles('cmd') }}-${{ hashFiles('go.mod') }}

- name: dependencies
if: steps.cache-makefile.outputs.cache-hit != 'true'
run: |
make install-tools

- name: lint
run: |
make lint

- name: codegen nodiff
run: |
make codegen
test -z "$(git status --porcelain)" || (git status; git diff; exit 1)

- name: format nodiff
run: |
make format
test -z "$(git status --porcelain)" || (git status; git diff; exit 1)
40 changes: 40 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
run:
timeout: 5m
output:
sort-results: true
linters:
disable-all: true
enable:
- errcheck
- gosimple
- ineffassign
- staticcheck
- typecheck
- govet
- bodyclose
- goimports
- noctx
- prealloc
- misspell
- nolintlint
- asciicheck
- bidichk
- containedctx
- contextcheck
- gocyclo
- makezero
- nakedret
- unconvert
- wastedassign
- whitespace
- nilerr
- forcetypeassert
- exhaustive
- errorlint
issues:
max-issues-per-linter: 0
max-same-issues: 0
exclude-dirs:
- protobuf
- schema
- tmp
26 changes: 26 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.PHONY: install-tools
install-tools:
go install github.com/bufbuild/buf/cmd/buf@v1.47.2
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest

.PHONY: test
test:
go test -v ./...

.PHONY: format
format:
go fmt ./...
golangci-lint run --issues-exit-code=0 --fix ./...
# buf format --write

BREAKING_CHANGE_BASE_BRANCH?=develop
.PHONY: lint
lint:
golangci-lint run --issues-exit-code=1 ./...
# buf lint
# buf breaking --against '.git#branch=$(BREAKING_CHANGE_BASE_BRANCH)'

.PHONY: codegen
codegen:
# find . -type f \( -name '*.pb.go' \) -delete
# buf generate
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# protobq

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

A tool for idempotent schema management in BigQuery using Protocol Buffers.
10 changes: 10 additions & 0 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: v2
managed:
enabled: true
override:
- file_option: go_package_prefix
value: github.com/averak/protobq/protobuf
plugins:
- remote: buf.build/protocolbuffers/go:v1.35.2
out: protobuf
opt: paths=source_relative
6 changes: 6 additions & 0 deletions buf.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Generated by buf. DO NOT EDIT.
version: v2
deps:
- name: buf.build/googleapis/googleapis
commit: acd896313c55464b993332136ded1b6e
digest: b5:025d83e25193feb8dac5e5576113c8737006218b3b09fbc0d0ff652614da5424b336edb15bea139eb90d14eba656774a979d1fbdae81cbab2013932b84b98f53
13 changes: 13 additions & 0 deletions buf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: v2
modules:
- path: schema/protobuf
deps:
- buf.build/googleapis/googleapis
lint:
use:
- STANDARD
except:
- PACKAGE_VERSION_SUFFIX
breaking:
use:
- FILE
7 changes: 7 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main

import "log"

func main() {
log.Println("Hello, World!")
}
Loading