From c00707a66f960bf42c4afd53a53983ad6daab15d Mon Sep 17 00:00:00 2001 From: Rosy-Glorious Miki Date: Wed, 28 Jan 2026 12:22:08 -0500 Subject: [PATCH 1/2] Update Makefile, and include dependecies for ubuntu-latest and fedora build in CI Signed-off-by: Rosy-Glorious Miki --- .github/workflows/ci.yml | 27 +++++++++++++++++++++------ .gitignore | 1 + Makefile | 30 ++++++++---------------------- 3 files changed, 30 insertions(+), 28 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4901bce..93734aa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,15 +2,11 @@ name: Continuous Integration on: push: branches: - - main + - main pull_request: jobs: - test-job: - runs-on: ubuntu-latest - steps: - - name: Successful test - run: echo "The job was automatically triggered by a ${{ github.event_name }} event." + test-makefile: name: build and test makefile runs-on: ubuntu-latest @@ -19,6 +15,25 @@ jobs: - uses: actions/setup-go@v6 with: go-version: "1.23" + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y make tar diffutils bzip2 gzip curl git - name: run make run: make + test-fedora: + name: build and test on Fedora latest + runs-on: ubuntu-latest + container: + image: quay.io/fedora/fedora:latest + options: --user root + steps: + - name: Install dependencies + run: | + dnf update -y + dnf install -y golang make tar diffutils bzip2 gzip curl git which + - name: Check out repository + uses: actions/checkout@v6 + - name: Build and test + run: make diff --git a/.gitignore b/.gitignore index b7cfcc3..3ac0386 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ cmd/tar-diff/tar-diff cmd/tar-patch/tar-patch +.secrets diff --git a/Makefile b/Makefile index 64aa746..c2407c5 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,11 @@ -.PHONY: all build clean fmt install lint test tools unit-test integration-test validate .install.gitvalidation .install.golangci-lint .gitvalidation +.PHONY: all build clean fmt install lint test tools unit-test integration-test validate .install.golangci-lint export GOPROXY=https://proxy.golang.org -GOBIN := $(shell go env GOBIN) -ifeq ($(GOBIN),) -GOBIN := $(GOPATH)/bin -endif + +GOBIN ?= $(shell echo $$HOME)/go/bin + +export GOFLAGS := -buildvcs=false BUILDFLAGS := @@ -17,7 +17,7 @@ INSTALLDIR=${PREFIX}/bin export PATH := $(PATH):${GOBIN} -all: tools tar-diff tar-patch test validate .gitvalidation +all: tools tar-diff tar-patch test validate build: go build $(BUILDFLAGS) ./... @@ -33,16 +33,11 @@ install: tar-diff tar-patch install -m 755 tar-diff ${INSTALLDIR}/tar-diff install -m 755 tar-patch ${INSTALLDIR}/tar-patch -tools: .install.gitvalidation .install.golangci-lint - -.install.gitvalidation: - if [ ! -x "$(GOBIN)/git-validation" ]; then \ - go install github.com/vbatts/git-validation@latest; \ - fi +tools: .install.golangci-lint .install.golangci-lint: if [ ! -x "$(GOBIN)/golangci-lint" ]; then \ - curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(GOBIN) latest; \ + curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/main/install.sh | sh -s -- -b $(GOBIN) v1.62.2; \ fi clean: @@ -66,12 +61,3 @@ validate: lint lint: $(GOBIN)/golangci-lint run -.gitvalidation: - @which $(GOBIN)/git-validation > /dev/null 2>/dev/null || (echo "ERROR: git-validation not found. Consider 'make clean && make tools'" && false) -ifeq ($(GITHUB_ACTIONS),true) - $(GOBIN)/git-validation -q -run DCO,short-subject,dangling-whitespace -else - git fetch -q "https://github.com/containers/tar-diff.git" "refs/heads/master" - upstream="$$(git rev-parse --verify FETCH_HEAD)" ; \ - $(GOBIN)/git-validation -q -run DCO,short-subject,dangling-whitespace -range $$upstream..HEAD -endif From 3c28c3339968665c4c89b5f8929885dffecb07b1 Mon Sep 17 00:00:00 2001 From: Rosy-Glorious Miki Date: Tue, 3 Feb 2026 10:09:03 -0500 Subject: [PATCH 2/2] fix: reconfigure GOBIN and GOPATH Signed-off-by: Rosy-Glorious Miki --- Makefile | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index c2407c5..f357a38 100644 --- a/Makefile +++ b/Makefile @@ -3,13 +3,18 @@ export GOPROXY=https://proxy.golang.org -GOBIN ?= $(shell echo $$HOME)/go/bin - -export GOFLAGS := -buildvcs=false - -BUILDFLAGS := - -PACKAGES := $(shell go list $(BUILDFLAGS) ./...) +GOBIN := $(shell go env GOBIN) +ifeq ($(GOBIN),) +GOPATH := $(shell go env GOPATH) +GOBIN := $(GOPATH)/bin +endif + +GOFLAGS:= +ifeq ($(GOFLAGS),) +GOFLAGS := -buildvcs=false +endif + +PACKAGES := $(shell go list $(GOFLAGS) ./...) SOURCE_DIRS = $(shell echo $(PACKAGES) | awk 'BEGIN{FS="/"; RS=" "}{print $$4}' | uniq) PREFIX ?= ${DESTDIR}/usr @@ -20,13 +25,13 @@ export PATH := $(PATH):${GOBIN} all: tools tar-diff tar-patch test validate build: - go build $(BUILDFLAGS) ./... + go build $(GOFLAGS) ./... tar-diff: - go build $(BUILDFLAGS) ./cmd/tar-diff + go build $(GOFLAGS) ./cmd/tar-diff tar-patch: - go build $(BUILDFLAGS) ./cmd/tar-patch + go build $(GOFLAGS) ./cmd/tar-patch install: tar-diff tar-patch install -d -m 755 ${INSTALLDIR} @@ -47,7 +52,7 @@ integration-test: tar-diff tar-patch tests/test.sh unit-test: - go test $(BUILDFLAGS) -cover ./... + go test $(GOFLAGS) -cover ./... test: unit-test integration-test @@ -55,9 +60,8 @@ fmt: @gofmt -l -s -w $(SOURCE_DIRS) validate: lint - @go vet ./... + @go vet $(GOFLAGS) ./... @test -z "$$(gofmt -s -l . | tee /dev/stderr)" lint: - $(GOBIN)/golangci-lint run - + GOFLAGS=$(GOFLAGS) $(GOBIN)/golangci-lint run