From 829e282f53ff7a0f830d65d461bccedf447de348 Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Mon, 20 May 2024 11:31:15 +0200 Subject: [PATCH] add GitHub workflows Signed-off-by: Valentin Rothberg --- .cirrus.yml | 19 ------------------- .github/workflows/ci.yml | 37 +++++++++++++++++++++++++++++++++++++ Makefile | 4 ++-- 3 files changed, 39 insertions(+), 21 deletions(-) delete mode 100644 .cirrus.yml create mode 100644 .github/workflows/ci.yml diff --git a/.cirrus.yml b/.cirrus.yml deleted file mode 100644 index 4f87907..0000000 --- a/.cirrus.yml +++ /dev/null @@ -1,19 +0,0 @@ -container: - image: fedora:39 - -env: - GOPROXY: https://proxy.golang.org - CODECOV_TOKEN: ENCRYPTED[64481ea00b08c4703bf350a2ad3d5a6fd7a00269576784b2943cce62604798e88f532e19fb66859fa68f43dbd4a0df15] - -build_and_test_task: - build_and_test_script: - - dnf install -y make golang git vim less bats ripgrep - - make .install.tools - - make check - - make vendor - - ./hack/tree_status.sh - - make build - - make test - - make build.coverage - - make test-integration.coverage - - make codecov diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..72e721d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,37 @@ +name: validate + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build_and_test: + runs-on: ubuntu-latest + container: + image: golang:1.22 + options: --user root + env: + CODECOV_TOKEN: ENCRYPTED[64481ea00b08c4703bf350a2ad3d5a6fd7a00269576784b2943cce62604798e88f532e19fb66859fa68f43dbd4a0df15] + steps: + - uses: actions/checkout@v2 + - name: vendor + run: | + make vendor + ./hack/tree_status.sh + - name: lint + run: | + make .install.tools + make check + - name: build + run: | + apt-get -qq update + apt-get -qq install vim bats ripgrep less + make build + make test + make build.coverage + make test-integration.coverage + make codecov \ No newline at end of file diff --git a/Makefile b/Makefile index c024afc..f447d2a 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ PATH := $(CURDIR)/test/bin:$(PATH) GO_SRC=$(shell find . -name \*.go) -GO_BUILD=$(GO) build +GO_BUILD=$(GO) build $(GO_BUILD_EXTRA_FLAGS) # Go module support: set `-mod=vendor` to use the vendored sources ifeq ($(shell go help mod >/dev/null 2>&1 && echo true), true) GO_BUILD=GO111MODULE=on $(GO) build -mod=vendor @@ -42,7 +42,7 @@ all: check build .PHONY: build build: $(GO_SRC) - $(GO_BUILD) -buildmode=pie -o $(BUILD_DIR)/$(NAME) -ldflags "-s -w -X main.version=${VERSION}-$(COMMIT)" + $(GO_BUILD) -o $(BUILD_DIR)/$(NAME) -ldflags "-s -w -X main.version=${VERSION}-$(COMMIT)" .PHONY: build.coverage build.coverage: $(GO_SRC)