From 6562eb92606622cd184923f116092753c1f6fa09 Mon Sep 17 00:00:00 2001 From: Odd Stranne Date: Mon, 15 Apr 2024 09:39:24 +0200 Subject: [PATCH 1/2] Complement makefile --- Makefile | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index fb5a42f..3bfd56c 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,16 @@ -BIN = mullvad-upgrade-tunnel -GO_LDFLAGS = -buildid= -s -w -X main.VERSION=${VERSION} export CGO_ENABLED = 0 export VERSION = ${shell git describe --tags 2>/dev/null} -.PHONY: mullvad-upgrade-tunnel -mullvad-upgrade-tunnel: +BIN = mullvad-upgrade-tunnel +GO_LDFLAGS = -buildid= -s -w -X main.VERSION=${VERSION} + +.PHONY: all +all: ${BIN} + +.PHONY: ${BIN} +${BIN}: go build -a -trimpath -buildvcs=false -ldflags "${GO_LDFLAGS}" \ - -o ${BIN} ./cmd/mullvad-upgrade-tunnel + -o ${BIN} ./cmd/${BIN} .PHONY: install install: @@ -17,10 +21,25 @@ grpc: protoc --go_out=. --go_opt=paths=source_relative \ --go-grpc_out=. --go-grpc_opt=paths=source_relative internal/grpc/ephemeralpeer.proto +.PHONY: upgrade +upgrade: + go get -u + go mod vendor + go mod tidy + .PHONY: clean clean: rm -f ${BIN}* +.PHONY: fmt +fmt: + go fmt ./... + +.PHONY: vet +vet: + go vet ./... + staticcheck ./... + .PHONY: build-container build-container: podman build -t wgephemeralpeer . From 5c47a4872af3e67e42810d037a8bc40cd02b3fe0 Mon Sep 17 00:00:00 2001 From: Odd Stranne Date: Mon, 15 Apr 2024 09:42:47 +0200 Subject: [PATCH 2/2] Add GitHub CI --- .github/workflows/ci.yaml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..4e423f8 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,25 @@ +name: Continuous Integration + +on: push + +jobs: + build: + runs-on: ubuntu-latest + steps: + - run: env + - name: Checkout code + uses: actions/checkout@v2 + - name: Setup go + uses: actions/setup-go@v4 + with: + go-version: '1.19.13' + - name: Install staticcheck + run: go install honnef.co/go/tools/cmd/staticcheck@release.2023.1 + - name: Print staticcheck version + run: staticcheck -version + - name: Run go build + run: make mullvad-upgrade-tunnel + - name: Run go vet + run: make vet + - name: Run go fmt + run: if [ "$(go fmt | wc -l)" -ne 0 ]; then exit 1; fi