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

Persist and partition job #3

Merged
merged 21 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from 11 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
45 changes: 45 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright (c) 2024 Diagrid Inc.
# Licensed under the MIT License.

name: "Build and testing"

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
test:
name: Build and Test
runs-on: ubuntu-latest
timeout-minutes: 30
services:
etcd:
image: quay.io/coreos/etcd:v3.5.5
env:
ETCD_ADVERTISE_CLIENT_URLS: http://0.0.0.0:2379
ETCD_LISTEN_CLIENT_URLS: http://0.0.0.0:2379
ports:
- 2379:2379
env:
GOOS: linux
GOARCH: amd64
GOPROXY: https://proxy.golang.org
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: 'false'
- name: Check mod tidy
run: |
go mod tidy
git diff --exit-code ./go.mod # check no changes
git diff --exit-code ./go.sum # check no changes
- name: Run test
run: go test
17 changes: 0 additions & 17 deletions .github/workflows/dependabot.yml

This file was deleted.

45 changes: 45 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
################################################################################
# Target: modtidy #
################################################################################
.PHONY: modtidy
modtidy:
go mod tidy

################################################################################
# Target: gen-proto #
################################################################################
PROTOC ?=protoc
PROTOC_VERSION = 3.21.12
PROTOBUF_SUITE_VERSION = 21.12
PROTOC_GEN_GO_VERSION = v1.28.1

PROTOC_GEN_GO_GRPC_VERSION = 1.2.0

PROTOS:=$(shell ls proto)
PROTO_PREFIX:=github.com/diagridio/go-etcd-cron

.PHONY: check-proto-version
check-proto-version: ## Checking the version of proto related tools
@test "$(shell protoc --version)" = "libprotoc $(PROTOC_VERSION)" \
|| { echo "please use protoc $(PROTOC_VERSION) (protobuf $(PROTOBUF_SUITE_VERSION)) to generate proto"; exit 1; }

@test "$(shell protoc-gen-go-grpc --version)" = "protoc-gen-go-grpc $(PROTOC_GEN_GO_GRPC_VERSION)" \
|| { echo "please use protoc-gen-go-grpc $(PROTOC_GEN_GO_GRPC_VERSION) to generate proto"; exit 1; }

@test "$(shell protoc-gen-go --version 2>&1)" = "protoc-gen-go $(PROTOC_GEN_GO_VERSION)" \
|| { echo "please use protoc-gen-go $(PROTOC_GEN_GO_VERSION) to generate proto"; exit 1; }

# Generate archive files for each binary
# $(1): the binary name to be archived
define genProtoc
.PHONY: gen-proto-$(1)
gen-proto-$(1):
$(PROTOC) --go_out=. --go_opt=module=$(PROTO_PREFIX) --go-grpc_out=. --go-grpc_opt=require_unimplemented_servers=false,module=$(PROTO_PREFIX) ./proto/$(1)
endef

$(foreach ITEM,$(PROTOS),$(eval $(call genProtoc,$(ITEM))))

GEN_PROTOS:=$(foreach ITEM,$(PROTOS),gen-proto-$(ITEM))

.PHONY: gen-proto
gen-proto: check-proto-version $(GEN_PROTOS) modtidy
Loading