Skip to content
This repository has been archived by the owner on Oct 30, 2024. It is now read-only.

Commit

Permalink
change: ci
Browse files Browse the repository at this point in the history
  • Loading branch information
iwilltry42 committed May 3, 2024
1 parent 43e9ced commit 22b5c39
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 29 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
runs-on: ubuntu-22.04
steps:
# Setup
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Go environment
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: "${{ env.GO_VERSION }}"
# Tests
Expand All @@ -33,9 +33,9 @@ jobs:
runs-on: ubuntu-22.04
steps:
# Setup
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Go environment
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: "${{ env.GO_VERSION }}"
- name: Setup CI Tools
Expand All @@ -60,7 +60,7 @@ jobs:
with:
allowUpdates: true
artifactErrorsFailBuild: true
artifacts: _dist/*
artifacts: dist/*
discussionCategory: releases
generateReleaseNotes: true
prerelease: ${{ steps.semver.outputs.prerelease != '' }}
Expand Down
34 changes: 12 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,18 @@ tools:


# cross-compilation for all targets
TARGETS ?= darwin/amd64 darwin/arm64 linux/amd64 linux/386 linux/arm linux/arm64 windows/amd64
build-cross: LDFLAGS += -extldflags "-static"
build-cross:
CGO_ENABLED=0 gox -parallel=3 -output="_dist/$(BINARIES)-{{.OS}}-{{.Arch}}" -osarch='$(TARGETS)' $(GOFLAGS) $(if $(TAGS),-tags '$(TAGS)',) -ldflags '$(LDFLAGS)'
CGO_ENABLED=0 gox -parallel=3 -output="dist/$(BINARIES)-{{.OS}}-{{.Arch}}" -osarch='$(TARGETS)' $(GOFLAGS) $(if $(TAGS),-tags '$(TAGS)',) -ldflags '$(LDFLAGS)'
gen-checksum: build-cross
$(eval ARTIFACTS_TO_PUBLISH := $(shell ls _dist/*))
$$(sha256sum $(ARTIFACTS_TO_PUBLISH) > _dist/checksums.txt)

.PHONY: install-tools
install-tools:
ifndef HAS_GOX
($(GO) install $(PKG_GOX))
endif
ifndef HAS_GOLANGCI
(curl -sfL $(PKG_GOLANGCI_LINT_SCRIPT) | sh -s -- -b $(GOENVPATH)/bin v${PKG_GOLANGCI_LINT_VERSION})
endif
ifdef HAS_GOLANGCI
ifeq ($(HAS_GOLANGCI_VERSION),)
ifdef INTERACTIVE
@echo "Warning: Your installed version of golangci-lint (interactive: ${INTERACTIVE}) differs from what we'd like to use. Switch to v${PKG_GOLANGCI_LINT_VERSION}? [Y/n]"
@read line; if [ $$line == "y" ]; then (curl -sfL $(PKG_GOLANGCI_LINT_SCRIPT) | sh -s -- -b $(GOENVPATH)/bin v${PKG_GOLANGCI_LINT_VERSION}); fi
else
@echo "Warning: you're not using the same version of golangci-lint as us (v${PKG_GOLANGCI_LINT_VERSION})"
endif
endif
endif
$(eval ARTIFACTS_TO_PUBLISH := $(shell ls dist/*))
$$(sha256sum $(ARTIFACTS_TO_PUBLISH) > dist/checksums.txt)

ci-setup:
@echo "### Installing Go tools..."
@echo "### -> Installing golangci-lint..."
curl -sfL $(PKG_GOLANGCI_LINT_SCRIPT) | sh -s -- -b $(GOENVPATH)/bin v$(PKG_GOLANGCI_LINT_VERSION)

@echo "### -> Installing gox..."
./scripts/install-tools.sh gox
5 changes: 3 additions & 2 deletions scripts/install-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,15 @@ initOS() {

install_golangci_lint() {
echo "Installing golangci-lint..."
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.49.0
GOLANGCI_LINT_VERSION=v1.57.2
curl -sSfL "https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh" | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCI_LINT_VERSION}
}

install_gox() {
echo "Installing gox for $OS/$ARCH..."
GOX_REPO=iwilltry42/gox
GOX_VERSION=0.1.0
curl -sSfL https://github.com/${GOX_REPO}/releases/download/v${GOX_VERSION}/gox_${GOX_VERSION}_${OS}_${ARCH}.tar.gz | tar -xz -C /tmp
curl -sSfL "https://github.com/${GOX_REPO}/releases/download/v${GOX_VERSION}/gox_${GOX_VERSION}_${OS}_${ARCH}.tar.gz" | tar -xz -C /tmp
chmod +x /tmp/gox
mv /tmp/gox /usr/local/bin/gox
}
Expand Down

0 comments on commit 22b5c39

Please sign in to comment.