Skip to content

Commit

Permalink
Remove nix (#16)
Browse files Browse the repository at this point in the history
* Remove nix

Signed-off-by: joshvanl <me@joshvanl.dev>

* Fix workflow file by separating `uses` and `runs`

Signed-off-by: joshvanl <me@joshvanl.dev>

* Update workflow target branch main -> master

Signed-off-by: joshvanl <me@joshvanl.dev>

* Add Makefile back

Signed-off-by: Artur Souza <asouza.pro@gmail.com>

* Use less strict lint settings.

Signed-off-by: Artur Souza <asouza.pro@gmail.com>

---------

Signed-off-by: joshvanl <me@joshvanl.dev>
Signed-off-by: Artur Souza <asouza.pro@gmail.com>
Co-authored-by: Artur Souza <asouza.pro@gmail.com>
  • Loading branch information
JoshVanL and artursouza authored Jul 22, 2024
1 parent 7d28278 commit a46af5f
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 458 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v26
- uses: actions/setup-go@v5
- uses: golangci/golangci-lint-action@v3.7.0
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- run: nix flake check
- run: nix run .#test
version: v1.55.2
- run: go test -v --race ./...
75 changes: 75 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
################################################################################
# Target: lint #
################################################################################
# Please use golangci-lint with matching version, otherwise you might encounter errors.
# You can download at https://github.com/golangci/golangci-lint/releases/
# Check .github/wortkflows/test.yaml for the version used in GitHub actions.

ifeq ($(GOOS),windows)
GOLANGCI_LINT:=golangci-lint.exe
else
GOLANGCI_LINT:=golangci-lint
endif

.PHONY: lint
lint:
$(GOLANGCI_LINT) run --timeout=20m


################################################################################
# Target: check-linter #
################################################################################
.SILENT: check-linter # Silence output other than the application run
.PHONY: check-linter
check-linter:
$(RUN_BUILD_TOOLS) check-linter


################################################################################
# Target: modtidy #
################################################################################
.PHONY: modtidy
modtidy:
go mod tidy

################################################################################
# Target: gen-proto #
################################################################################
PROTOC ?=protoc
PROTOC_VERSION = 24.4
PROTOBUF_SUITE_VERSION = 24.4
PROTOC_GEN_GO_VERSION = v1.32.0

PROTOC_GEN_GO_GRPC_VERSION = 1.3.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

test:
go test -timeout 300s --race ./...
115 changes: 0 additions & 115 deletions flake.lock

This file was deleted.

54 changes: 0 additions & 54 deletions flake.nix

This file was deleted.

Loading

0 comments on commit a46af5f

Please sign in to comment.