Skip to content

feat: implement postgres for segment APIs #7185

feat: implement postgres for segment APIs

feat: implement postgres for segment APIs #7185

Workflow file for this run

name: pr-go
on:
workflow_dispatch:
pull_request:
branches:
- main
paths-ignore:
- "ui/**"
- "**/**.md"
- "evaluation/typescript/**"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
PROTOC_VERSION: 23.4
PROTOLOCK_VERSION: v0.16.0
PROTOC_GEN_GO_VERSION: v1.5.2
PROTOC_GEN_OPENAPI_V2: v2.20.0
PROTOC_GEN_GO_GRPC_VERSION: v2.20.0
MOCKGEN_VERSION: v0.4.0
GOIMPORTS_VERSION: v0.40.0
GOLANGCI_LINT_VERSION: v2.7.2
jobs:
unit-test:
runs-on: ubuntu-latest
services:
# setup httpstan container used to run unit test in experiment service
httpstan:
image: ghcr.io/bucketeer-io/bucketeer-httpstan:0.0.1
ports:
- 8080:8080
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: 'go.mod'
cache: true
- name: Download vendor
run: make vendor
- name: Run unit test
run: make test-go
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: 'go.mod'
cache: true
- name: Download vendor
run: make vendor
- name: Build
run: make build-go
gofmt-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: 'go.mod'
cache: true
- name: Install goimports
run: go install golang.org/x/tools/cmd/goimports@${{ env.GOIMPORTS_VERSION }}
- name: Check Go formatting
run: make gofmt-check
mockgen-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: 'go.mod'
cache: true
- name: Install Protoc
uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0
with:
version: ${{ env.PROTOC_VERSION }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install protoc-gen-go
run: go install github.com/golang/protobuf/protoc-gen-go@${{ env.PROTOC_GEN_GO_VERSION }}
- name: Install protoc-gen-go-grpc
run: go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway@${{ env.PROTOC_GEN_GO_GRPC_VERSION }}
- name: Install goimports
run: go install golang.org/x/tools/cmd/goimports
- name: Install mockgen
run: go install go.uber.org/mock/mockgen@${{ env.MOCKGEN_VERSION}}
- name: Check mockgen
run: make mockgen-check
proto-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
- name: Install protolock
run: go install github.com/nilslice/protolock/cmd/protolock@${{ env.PROTOLOCK_VERSION }}
- name: Install Protoc
uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0
with:
version: ${{ env.PROTOC_VERSION }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install protoc-gen-go-grpc
run: go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway@${{ env.PROTOC_GEN_GO_GRPC_VERSION }}
- name: Install clang-format
run: sudo apt-get update && sudo apt-get install -y clang-format-14
- name: Check proto format
run: |
cd proto
failed=0
for f in $(find . -name '*.proto' -not -path './external/*'); do
if ! clang-format-14 --dry-run --Werror --style=file --fallback-style=llvm "$f"; then
echo "Failed: $f"
failed=1
fi
done
exit $failed
- name: Check proto lock
run: make proto-lock-check
proto-go-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: 'go.mod'
cache: true
- name: Install Protoc
uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0
with:
version: ${{ env.PROTOC_VERSION }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install protoc-gen-go
run: go install github.com/golang/protobuf/protoc-gen-go@${{ env.PROTOC_GEN_GO_VERSION }}
- name: Install protoc-gen-go-grpc
run: go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway@${{ env.PROTOC_GEN_GO_GRPC_VERSION }}
- name: Check proto go files
run: make proto-go-check
proto-openapi-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: 'go.mod'
cache: true
- name: Install Protoc
uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0
with:
version: ${{ env.PROTOC_VERSION }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install protoc-gen-go
run: go install github.com/golang/protobuf/protoc-gen-go@${{ env.PROTOC_GEN_GO_VERSION }}
- name: Install protoc-gen-openapi
run: go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@${{ env.PROTOC_GEN_OPENAPI_V2 }}
- name: Generate proto go files
run: make proto-openapi-gen
- name: Check diff
run: make diff-check
update-repos-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: 'go.mod'
cache: true
- name: Check repository updates
run: make update-repos-check
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: 'go.mod'
cache: true
- name: Install golangci-lint
run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@${{ env.GOLANGCI_LINT_VERSION }}
- name: Lint
run: make lint