From 52eba13bf5e11c4dc244238025844ea861864795 Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Sat, 10 Feb 2024 10:57:07 -0500 Subject: [PATCH 01/33] chore: updated linter version --- .make/go.mk | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.make/go.mk b/.make/go.mk index 6337991..38e8063 100644 --- a/.make/go.mk +++ b/.make/go.mk @@ -22,7 +22,7 @@ endif .PHONY: bench bench: ## Run all benchmarks in the Go application @echo "running benchmarks..." - @go test ./... -bench=. -benchmem $(TAGS) + @go test -bench=. -benchmem $(TAGS) .PHONY: build-go build-go: ## Build the Go application (locally) @@ -67,15 +67,15 @@ install-go: ## Install the application (Using Native Go) lint: ## Run the golangci-lint application (install if not found) @echo "installing golangci-lint..." @#Travis (has sudo) - @if [ "$(shell command -v golangci-lint)" = "" ] && [ $(TRAVIS) ]; then curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.55.2 && sudo cp ./bin/golangci-lint $(go env GOPATH)/bin/; fi; + @if [ "$(shell command -v golangci-lint)" = "" ] && [ $(TRAVIS) ]; then curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.56.1 && sudo cp ./bin/golangci-lint $(go env GOPATH)/bin/; fi; @#AWS CodePipeline - @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(CODEBUILD_BUILD_ID)" != "" ]; then curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.55.2; fi; + @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(CODEBUILD_BUILD_ID)" != "" ]; then curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.56.1; fi; @#GitHub Actions - @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(GITHUB_WORKFLOW)" != "" ]; then curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sudo sh -s -- -b $(go env GOPATH)/bin v1.55.2; fi; + @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(GITHUB_WORKFLOW)" != "" ]; then curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sudo sh -s -- -b $(go env GOPATH)/bin v1.56.1; fi; @#Brew - MacOS @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(shell command -v brew)" != "" ]; then brew install golangci-lint; fi; @#MacOS Vanilla - @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(shell command -v brew)" != "" ]; then curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- v1.55.2; fi; + @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(shell command -v brew)" != "" ]; then curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- v1.56.1; fi; @echo "running golangci-lint..." @golangci-lint run --verbose From f75a66a9d1cf5b2bfbf33d0a9576c4f51ba49c57 Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Sat, 10 Feb 2024 10:57:24 -0500 Subject: [PATCH 02/33] chore: upgraded deps --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index ed6ac52..107d290 100644 --- a/go.mod +++ b/go.mod @@ -16,8 +16,8 @@ require ( github.com/libsv/go-bn v0.0.2 github.com/libsv/go-bt/v2 v2.2.5 github.com/libsv/go-p2p v0.1.9 - github.com/mrz1836/go-api-router v0.7.1 - github.com/mrz1836/go-datastore v0.5.13 + github.com/mrz1836/go-api-router v0.7.2 + github.com/mrz1836/go-datastore v0.5.14 github.com/mrz1836/go-logger v0.3.3 github.com/multiformats/go-multiaddr v0.12.2 github.com/newrelic/go-agent/v3/integrations/nrhttprouter v1.0.2 diff --git a/go.sum b/go.sum index f2c62bc..63a28ba 100644 --- a/go.sum +++ b/go.sum @@ -328,10 +328,10 @@ github.com/montanaflynn/stats v0.7.1/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/mrz1836/go-api-router v0.7.1 h1:CD5eRWtpI6uAFTTS6ilostM9GlI0YXg7YJdJQiY8wpo= -github.com/mrz1836/go-api-router v0.7.1/go.mod h1:x9W150CQr7BmHZmDUls1GaNVcarec29HlhQ3dbSmKO4= -github.com/mrz1836/go-datastore v0.5.13 h1:oJrm7lJg0LtaR7HO1BvyeFB4cpJic3YcRu4XDm8CtVs= -github.com/mrz1836/go-datastore v0.5.13/go.mod h1:sRbHLRKhKdC0IR3hRnu2Qgn+OlB2wKYfl+jsiUT8cPo= +github.com/mrz1836/go-api-router v0.7.2 h1:/BXAAzbhYsjsMACITfR58RH1agK+JraDsT9VWjaKVqo= +github.com/mrz1836/go-api-router v0.7.2/go.mod h1:Q1uiOk+f76Yw19mI10VfaedqnyHrl05x7/Nwz+QOs5Q= +github.com/mrz1836/go-datastore v0.5.14 h1:ebj2FWrY491xtKI7UUO5RG+4RjhT0DLxVKMJkPB8Zik= +github.com/mrz1836/go-datastore v0.5.14/go.mod h1:TGHKk0UKklxrZJx4jQW/bWsEeil85TVq472Kgm/jErY= github.com/mrz1836/go-logger v0.3.3 h1:L/u+So5yrsYi7KhkFWlZ8v28cmoHt6aB7X8uVEIEHu8= github.com/mrz1836/go-logger v0.3.3/go.mod h1:hlP6K2fnTcisDbcYw9u3eV+1TW5jCsYUfoujA4+38NY= github.com/mrz1836/go-parameters v0.4.1 h1:8ElvGs8hzk0/hz2t5an2FmS9SPfWozGn2nXUvYwI+Uk= From b868401cce19c455ab6573cee196d2d0fc85e618 Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Sat, 10 Feb 2024 10:57:37 -0500 Subject: [PATCH 03/33] fix: linter issues after upgrading --- app/config/mock_test.go | 6 +++--- app/models/model/model_metadata_test.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/config/mock_test.go b/app/config/mock_test.go index b9fd154..182f7d8 100644 --- a/app/config/mock_test.go +++ b/app/config/mock_test.go @@ -12,7 +12,7 @@ import ( // TestBanPeer tests the BanPeer method func TestBanPeer(t *testing.T) { mockNode := &mocks.Node{ - BanPeerFunc: func(ctx context.Context, peer string) error { + BanPeerFunc: func(_ context.Context, peer string) error { // Mock behavior here if peer == "expected_peer_address" { return nil @@ -29,7 +29,7 @@ func TestBanPeer(t *testing.T) { // TestUnBanPeer tests the UnBanPeer method func TestUnBanPeer(t *testing.T) { mockNode := &mocks.Node{ - UnbanPeerFunc: func(ctx context.Context, peer string) error { + UnbanPeerFunc: func(_ context.Context, peer string) error { // Mock behavior here if peer == "expected_peer_address" { return nil @@ -46,7 +46,7 @@ func TestUnBanPeer(t *testing.T) { // TestInvalidateBlock tests the InvalidateBlock method func TestInvalidateBlock(t *testing.T) { mockNode := &mocks.Node{ - InvalidateBlockFunc: func(ctx context.Context, hash string) error { + InvalidateBlockFunc: func(_ context.Context, hash string) error { // Mock behavior here if hash == "expected_hash" { return nil diff --git a/app/models/model/model_metadata_test.go b/app/models/model/model_metadata_test.go index 55b0874..3e76c55 100644 --- a/app/models/model/model_metadata_test.go +++ b/app/models/model/model_metadata_test.go @@ -234,7 +234,7 @@ func TestMetadata_GormDBDataType(t *testing.T) { assert.Equal(t, datastore.JSON, m.GormDBDataType(db, nil)) }) - t.Run("postgres dialector", func(t *testing.T) { + t.Run("postgres dialector", func(_ *testing.T) { /*dsn := "host=localhost user=postgres password=gorm dbname=gorm port=9920 sslmode=disable TimeZone=Asia/Shanghai" db, err := gorm.Open(postgres.Open(dsn), &gorm.Config{}) require.NotNil(t, db) From e8f8ff00df3dd9c02dc0cb2df57c6ed37533c3b3 Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Sat, 10 Feb 2024 10:57:56 -0500 Subject: [PATCH 04/33] feat: build binaries on release, adding tag --- .github/workflows/release.yml | 4 ++++ .goreleaser.yml | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 73276ce..1582b38 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,6 +24,10 @@ jobs: uses: actions/setup-go@v5 with: go-version: 1.21 + - name: Install Dependencies + run: | + sudo apt-get update + sudo apt-get install -y libsqlite3-dev # Replace with the actual dependencies your project needs - name: Run GoReleaser uses: goreleaser/goreleaser-action@v5.0.0 with: diff --git a/.goreleaser.yml b/.goreleaser.yml index 3d3f9b9..65de1a2 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -20,7 +20,7 @@ changelog: # --------------------------- builds: - env: - - CGO_ENABLED=0 # Required for SQLite + - CGO_ENABLED=1 # Required for SQLite - GO111MODULE=on #- CGO_CFLAGS=-Wno-error=unused-command-line-argument main: ./cmd/ @@ -29,11 +29,11 @@ builds: - amd64 - arm64 goos: - - darwin + #- darwin - linux goarm: - - 6 - - 7 + - "6" + - "7" goamd64: - v2 - v3 From 93415a016ee36dabea920632a870c807af52059b Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Sat, 10 Feb 2024 11:17:16 -0500 Subject: [PATCH 05/33] fix: install cross compilation for ARM64 --- .github/workflows/release.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1582b38..4981ef6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,6 +28,9 @@ jobs: run: | sudo apt-get update sudo apt-get install -y libsqlite3-dev # Replace with the actual dependencies your project needs + - name: Install ARM64 cross-compilation tools + run: | + sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu - name: Run GoReleaser uses: goreleaser/goreleaser-action@v5.0.0 with: From 9fdaa57246a07fc17adb021250ae21d9eae07fc7 Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Sat, 10 Feb 2024 11:18:06 -0500 Subject: [PATCH 06/33] fix: add new flags for compilation --- .goreleaser.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 65de1a2..f4f7689 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -20,9 +20,10 @@ changelog: # --------------------------- builds: - env: - - CGO_ENABLED=1 # Required for SQLite + - CGO_ENABLED=1 - GO111MODULE=on - #- CGO_CFLAGS=-Wno-error=unused-command-line-argument + - CC=aarch64-linux-gnu-gcc + - CXX=aarch64-linux-gnu-g++ main: ./cmd/ binary: "alert_system" goarch: From bec1c430aec5a50de285dcc8d0693b6c12b24fe2 Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Sat, 10 Feb 2024 11:30:07 -0500 Subject: [PATCH 07/33] fix: turn off arm64 for testing --- .goreleaser.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index f4f7689..4468f3a 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -28,7 +28,7 @@ builds: binary: "alert_system" goarch: - amd64 - - arm64 + #- arm64 goos: #- darwin - linux From c2a712fc4b68a4535bef08e207904ee6e6c8112d Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Sat, 10 Feb 2024 11:56:59 -0500 Subject: [PATCH 08/33] fix: trying another version of build configurations --- .github/workflows/release.yml | 2 +- .goreleaser.yml | 88 ++++++++++++++++++++++++++++------- 2 files changed, 71 insertions(+), 19 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4981ef6..1637c3e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,7 +27,7 @@ jobs: - name: Install Dependencies run: | sudo apt-get update - sudo apt-get install -y libsqlite3-dev # Replace with the actual dependencies your project needs + sudo apt-get install -y libsqlite3-dev - name: Install ARM64 cross-compilation tools run: | sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu diff --git a/.goreleaser.yml b/.goreleaser.yml index 4468f3a..eaabc42 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -19,36 +19,88 @@ changelog: # Builder # --------------------------- builds: - - env: - - CGO_ENABLED=1 - - GO111MODULE=on - - CC=aarch64-linux-gnu-gcc - - CXX=aarch64-linux-gnu-g++ + - id: darwin-amd64 main: ./cmd/ - binary: "alert_system" + binary: alert_system + goos: + - darwin goarch: - amd64 - #- arm64 + env: + - PKG_CONFIG_SYSROOT_DIR=/sysroot/macos/amd64 + - PKG_CONFIG_PATH=/sysroot/macos/amd64/usr/local/lib/pkgconfig + - CC=o64-clang + - CXX=o64-clang++ + flags: + - -mod=readonly + ldflags: + - -s -w -X main.version={{.Version}} + + - id: linux-armhf + main: ./cmd/ + binary: alert_system goos: - #- darwin - linux + goarch: + - arm goarm: - - "6" - - "7" - goamd64: - - v2 - - v3 - mod_timestamp: "{{ .CommitTimestamp }}" + - 7 + env: + - CC=arm-linux-gnueabihf-gcc + - CXX=arm-linux-gnueabihf-g++ + - CGO_CFLAGS=--sysroot=/sysroot/linux/armhf + - CGO_LDFLAGS=--sysroot=/sysroot/linux/armhf + - PKG_CONFIG_SYSROOT_DIR=/sysroot/linux/armhf + - PKG_CONFIG_PATH=/sysroot/linux/armhf/opt/vc/lib/pkgconfig:/sysroot/linux/armhf/usr/lib/arm-linux-gnueabihf/pkgconfig:/sysroot/linux/armhf/usr/lib/pkgconfig:/sysroot/linux/armhf/usr/local/lib/pkgconfig + flags: + - -mod=readonly ldflags: - - -s -w -X github.com/bitcoin-sv/{{ .ProjectName }}/cmd.Version={{ .Version }} + - -s -w -X main.version={{.Version}} + +# - id: "amd64-build" +# main: ./cmd/ +# env: +# - CGO_ENABLED=1 +# - GO111MODULE=on +# goarch: +# - amd64 +# goos: +# - linux +# mod_timestamp: "{{ .CommitTimestamp }}" +# ldflags: +# - -s -w -X github.com/bitcoin-sv/{{ .ProjectName }}/cmd.Version={{ .Version }} + +# - id: "arm64-build" +# main: ./cmd/ +# env: +# - CGO_ENABLED=1 +# - GO111MODULE=on +# - CC=aarch64-linux-gnu-gcc +# - CXX=aarch64-linux-gnu-g++ +# goarch: +# - arm64 +# goos: +# - linux +# mod_timestamp: "{{ .CommitTimestamp }}" +# ldflags: +# - -s -w -X github.com/bitcoin-sv/{{ .ProjectName }}/cmd.Version={{ .Version }} # --------------------------- # Archives + Checksums # --------------------------- archives: - - wrap_in_directory: true - format: tar.gz - name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}_{{ .Version }}' + - id: alert_system + builds: + - darwin-amd64 + - linux-armhf + name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" + format: zip + wrap_in_directory: true + +#archives: +# - wrap_in_directory: true +# format: tar.gz +# name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}_{{ .Version }}' checksum: name_template: "{{ .ProjectName }}_checksums.txt" From b4b667892df3e6a549afe93493c8088c2bde14e6 Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Sat, 10 Feb 2024 12:09:41 -0500 Subject: [PATCH 09/33] fix: replaced name, need to test --- README.md | 62 +++++++++++++++++++++++++++---------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index bf84d47..f472eca 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ Configuration files can be found in the [config](app/config/envs) directory. **Note:** to use a custom settings file, it needs to be mounted and the appropriate environment variables set. Running it as below will run an ephemeral database but the container should sync up from the peers on the network on startup. ### podman ``` -$ podman run -u root -e P2P_PORT=9908 -e P2P_IP=0.0.0.0 --expose 9908 docker.io/galtbv/alert-system:0.0.2 +$ podman run -u root -e P2P_PORT=9908 -e P2P_IP=0.0.0.0 --expose 9908 docker.io/bsvb/alert-system:0.0.2 ``` ## Documentation @@ -65,36 +65,36 @@ make help List of all current commands: ```text -all Runs multiple commands -clean Remove previous builds and any cached data -clean-mods Remove all the Go mod cache -coverage Shows the test coverage -diff Show the git diff -generate Runs the go generate command in the base of the repo -godocs Sync the latest tag with GoDocs -help Show this help message -install Install the application -install-go Install the application (Using Native Go) -install-releaser Install the GoReleaser application -lint Run the golangci-lint application (install if not found) -release Full production release (creates release in GitHub) -release Runs common.release then runs godocs -release-snap Test the full release (build binaries) -release-test Full production test release (everything except deploy) -replace-version Replaces the version in HTML/JS (pre-deploy) -tag Generate a new tag and push (tag version=0.0.0) -tag-remove Remove a tag if found (tag-remove version=0.0.0) -tag-update Update an existing tag to current commit (tag-update version=0.0.0) -test Runs lint and ALL tests -test-ci Runs all tests via CI (exports coverage) -test-ci-no-race Runs all tests via CI (no race) (exports coverage) -test-ci-short Runs unit tests via CI (exports coverage) -test-no-lint Runs just tests -test-short Runs vet, lint and tests (excludes integration tests) -test-unit Runs tests and outputs coverage -uninstall Uninstall the application (and remove files) -update-linter Update the golangci-lint package (macOS only) -vet Run the Go vet application +all Runs multiple commands +clean Remove previous builds and any cached data +clean-mods Remove all the Go mod cache +coverage Shows the test coverage +diff Show the git diff +generate Runs the go generate command in the base of the repo +godocs Sync the latest tag with GoDocs +help Show this help message +install Install the application +install-go Install the application (Using Native Go) +install-releaser Install the GoReleaser application +lint Run the golangci-lint application (install if not found) +release Full production release (creates release in GitHub) +release Runs common.release then runs godocs +release-snap Test the full release (build binaries) +release-test Full production test release (everything except deploy) +replace-version Replaces the version in HTML/JS (pre-deploy) +tag Generate a new tag and push (tag version=0.0.0) +tag-remove Remove a tag if found (tag-remove version=0.0.0) +tag-update Update an existing tag to current commit (tag-update version=0.0.0) +test Runs lint and ALL tests +test-ci Runs all tests via CI (exports coverage) +test-ci-no-race Runs all tests via CI (no race) (exports coverage) +test-ci-short Runs unit tests via CI (exports coverage) +test-no-lint Runs just tests +test-short Runs vet, lint and tests (excludes integration tests) +test-unit Runs tests and outputs coverage +uninstall Uninstall the application (and remove files) +update-linter Update the golangci-lint package (macOS only) +vet Run the Go vet application ``` From ee4ee571b604e4b684cb13895e6d920415eaad57 Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Sat, 10 Feb 2024 12:09:55 -0500 Subject: [PATCH 10/33] chore: minor formatting and spelling fix --- docs/config.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/config.md b/docs/config.md index 2038b99..71ca374 100644 --- a/docs/config.md +++ b/docs/config.md @@ -19,7 +19,7 @@ | datastore.table_prefix | "alert_system" | Prefix for database table names | | **datastore.sqlite** | `` | SQLite specific configuration | | datastore.sqlite.database_path | "alert_system_datastore.db" | Path to the SQLite database file | -| datstore.sqlite.shared | false | Use a shared SQLite database | +| datastore.sqlite.shared | false | Use a shared SQLite database | | **sql_read** | `` | Configuration for the read SQL database connection | | **sql_write** | `` | Configuration for the write SQL database connection | | sql_read/write.driver | "postgresql" | Database driver (e.g., postgresql) | @@ -30,7 +30,7 @@ | p2p.port | "9906" | Port for P2P communication | | p2p.alert_system_protocol_id | "/bitcoin-testnet/alert-system/0.0.1" | Protocol ID for the alert system on the P2P network | | ... | | (Additional P2P parameters) | -| **rpc_connections** | `[]` | List of RPC connections | -| rpc_connections[0].user | "galt" | RPC username | -| rpc_connections[0].password | "galt" | RPC password | +| **rpc_connections** | `[]` | List of RPC connections | +| rpc_connections[0].user | "testUser" | RPC username | +| rpc_connections[0].password | "testPw" | RPC password | | rpc_connections[0].host | "http://localhost:8333" | RPC host | From 8e51c7db0b68fc2aaf9bd18cd18310a1b6ce585d Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Sat, 10 Feb 2024 12:17:13 -0500 Subject: [PATCH 11/33] fix: for windows path, suggestion from copilot --- .github/workflows/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index f513a82..70b16eb 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -57,7 +57,7 @@ jobs: ~/go/pkg/mod # Module download cache ~/.cache/go-build # Build cache (Linux) ~/Library/Caches/go-build # Build cache (Mac) - '%LocalAppData%\go-build' # Build cache (Windows) + "%LocalAppData%\\go-build" # Build cache (Windows) key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-go- From 49f0b5dafc2895a0e3c52438c1f0f651e7ef5c85 Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Sat, 10 Feb 2024 13:11:06 -0500 Subject: [PATCH 12/33] fix: attempt to build with cgo enabled --- .goreleaser.yml | 57 ++++++++++++++++++++++--------------------------- 1 file changed, 25 insertions(+), 32 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index eaabc42..a7cf815 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -17,6 +17,10 @@ changelog: # --------------------------- # Builder +# +# CGO is enabled and inspiration came from: +# https://github.com/goreleaser/goreleaser-cross-example +# https://github.com/goreleaser/goreleaser-cross-example-sysroot # --------------------------- builds: - id: darwin-amd64 @@ -27,14 +31,24 @@ builds: goarch: - amd64 env: + - CGO_ENABLED=1 - PKG_CONFIG_SYSROOT_DIR=/sysroot/macos/amd64 - PKG_CONFIG_PATH=/sysroot/macos/amd64/usr/local/lib/pkgconfig - - CC=o64-clang - - CXX=o64-clang++ + #- CC=o64-clang + #- CXX=o64-clang++ + - CC=clang # Changed from o64-clang + - CXX=clang++ # Changed from o64-clang++ + #mod_timestamp: "{{ .CommitTimestamp }}" flags: - -mod=readonly ldflags: - -s -w -X main.version={{.Version}} + #- -s -w -X github.com/bitcoin-sv/{{ .ProjectName }}/cmd.Version={{ .Version }} + overrides: + - goos: linux + goarch: arm64 + env: + - CC=aarch64-linux-gnu-gcc - id: linux-armhf main: ./cmd/ @@ -46,45 +60,24 @@ builds: goarm: - 7 env: - - CC=arm-linux-gnueabihf-gcc + - CGO_ENABLED=1 + - CC=arm-linux-gnueabihf-gcc # Make sure this points to the correct executable - CXX=arm-linux-gnueabihf-g++ - CGO_CFLAGS=--sysroot=/sysroot/linux/armhf - CGO_LDFLAGS=--sysroot=/sysroot/linux/armhf - PKG_CONFIG_SYSROOT_DIR=/sysroot/linux/armhf - PKG_CONFIG_PATH=/sysroot/linux/armhf/opt/vc/lib/pkgconfig:/sysroot/linux/armhf/usr/lib/arm-linux-gnueabihf/pkgconfig:/sysroot/linux/armhf/usr/lib/pkgconfig:/sysroot/linux/armhf/usr/local/lib/pkgconfig + #mod_timestamp: "{{ .CommitTimestamp }}" flags: - -mod=readonly ldflags: - -s -w -X main.version={{.Version}} - -# - id: "amd64-build" -# main: ./cmd/ -# env: -# - CGO_ENABLED=1 -# - GO111MODULE=on -# goarch: -# - amd64 -# goos: -# - linux -# mod_timestamp: "{{ .CommitTimestamp }}" -# ldflags: -# - -s -w -X github.com/bitcoin-sv/{{ .ProjectName }}/cmd.Version={{ .Version }} - -# - id: "arm64-build" -# main: ./cmd/ -# env: -# - CGO_ENABLED=1 -# - GO111MODULE=on -# - CC=aarch64-linux-gnu-gcc -# - CXX=aarch64-linux-gnu-g++ -# goarch: -# - arm64 -# goos: -# - linux -# mod_timestamp: "{{ .CommitTimestamp }}" -# ldflags: -# - -s -w -X github.com/bitcoin-sv/{{ .ProjectName }}/cmd.Version={{ .Version }} - + #- -s -w -X github.com/bitcoin-sv/{{ .ProjectName }}/cmd.Version={{ .Version }} + overrides: + - goos: linux + goarch: arm64 + env: + - CC=aarch64-linux-gnu-gcc # --------------------------- # Archives + Checksums # --------------------------- From 553706d68febc4f2a190b3917945db0468c49fd4 Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Sat, 10 Feb 2024 13:27:40 -0500 Subject: [PATCH 13/33] fix: adding cache to speed up runs --- .github/workflows/release.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1637c3e..2f91fc9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,13 +24,22 @@ jobs: uses: actions/setup-go@v5 with: go-version: 1.21 - - name: Install Dependencies + - name: Cache code + uses: actions/cache@v4 + with: + path: | + ~/go/pkg/mod # Module download cache + ~/.cache/go-build # Build cache (Linux) + ~/Library/Caches/go-build # Build cache (Mac) + "%LocalAppData%\\go-build" # Build cache (Windows) + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - name: Install ARM64 cross-compilation tools run: | sudo apt-get update sudo apt-get install -y libsqlite3-dev - - name: Install ARM64 cross-compilation tools - run: | - sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu + sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu - name: Run GoReleaser uses: goreleaser/goreleaser-action@v5.0.0 with: From 14a65c83017feb1ea8710cfb85cfa90335501221 Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Sat, 10 Feb 2024 13:27:51 -0500 Subject: [PATCH 14/33] fix: removing additional vars --- .goreleaser.yml | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index a7cf815..5648442 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -34,21 +34,16 @@ builds: - CGO_ENABLED=1 - PKG_CONFIG_SYSROOT_DIR=/sysroot/macos/amd64 - PKG_CONFIG_PATH=/sysroot/macos/amd64/usr/local/lib/pkgconfig - #- CC=o64-clang - #- CXX=o64-clang++ - - CC=clang # Changed from o64-clang - - CXX=clang++ # Changed from o64-clang++ + - CC=o64-clang # (GitHub action) + - CXX=o64-clang++ # (GitHub action) + #- CC=clang # Changed from o64-clang (works for mac) + #- CXX=clang++ # Changed from o64-clang++ (works for mac) #mod_timestamp: "{{ .CommitTimestamp }}" flags: - -mod=readonly ldflags: - -s -w -X main.version={{.Version}} #- -s -w -X github.com/bitcoin-sv/{{ .ProjectName }}/cmd.Version={{ .Version }} - overrides: - - goos: linux - goarch: arm64 - env: - - CC=aarch64-linux-gnu-gcc - id: linux-armhf main: ./cmd/ @@ -73,11 +68,12 @@ builds: ldflags: - -s -w -X main.version={{.Version}} #- -s -w -X github.com/bitcoin-sv/{{ .ProjectName }}/cmd.Version={{ .Version }} - overrides: - - goos: linux - goarch: arm64 - env: - - CC=aarch64-linux-gnu-gcc +# overrides: +# - goos: linux +# goarch: arm64 +# env: +# - CC=aarch64-linux-gnu-gcc + # --------------------------- # Archives + Checksums # --------------------------- From 7b99a4ef08d0d249017577d419f4b12fe8ee3986 Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Sat, 10 Feb 2024 13:58:28 -0500 Subject: [PATCH 15/33] test: working on linux only release --- .github/workflows/release.yml | 80 ++++++++++++++++++++++---- .goreleaser-for-linux.yml | 71 +++++++++++++++++++++++ .goreleaser.yml => .old-goreleaser.yml | 0 3 files changed, 139 insertions(+), 12 deletions(-) create mode 100644 .goreleaser-for-linux.yml rename .goreleaser.yml => .old-goreleaser.yml (100%) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2f91fc9..b47bca9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,6 +3,7 @@ name: release env: GO111MODULE: on + GO_VERSION: 1.21 on: push: @@ -13,17 +14,22 @@ permissions: contents: write jobs: - goreleaser: + build-linux-binary: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 + - name: gcc install + run: sudo apt-get update; sudo apt install gcc-aarch64-linux-gnu + - name: Get tag + uses: little-core-labs/get-git-tag@v3.0.2 + id: tag - name: Set up Go uses: actions/setup-go@v5 with: - go-version: 1.21 + go-version: ${{ env.GO_VERSION }} - name: Cache code uses: actions/cache@v4 with: @@ -35,18 +41,68 @@ jobs: key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-go- - - name: Install ARM64 cross-compilation tools - run: | - sudo apt-get update - sudo apt-get install -y libsqlite3-dev - sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v5.0.0 + uses: goreleaser/goreleaser-action@v3 with: - distribution: goreleaser version: latest - args: release --clean --debug + args: release --skip-publish --config .goreleaser-for-linux.yaml env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - #- name: Syndicate to GoDocs - # run: make godocs + GORELEASER_PREVIOUS_TAG: ${{steps.latest_version.outputs.release}} + - name: Upload + uses: actions/upload-artifact@v4 + with: + name: alert-system-linux + path: | + dist/alert-system_*.zip + dist/checksums.txt + + create-release: + #needs: [build-linux-binary, build-darwin-binary, build-windows-binary] + needs: [build-linux-binary] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Make directories + run: | + mkdir -p ./dist/linux + mkdir -p ./dist/darwin + mkdir -p ./dist/windows + - name: Download linux binaries + uses: actions/download-artifact@v4 + with: + name: alert-system-linux + path: ./tmp-build/linux + #- name: Download darwin binaries + # uses: actions/download-artifact@v3 + # with: + # name: kubectl-eds-darwin + # path: ./tmp-build/darwin + #- name: Download windows binaries + # uses: actions/download-artifact@v3 + # with: + # name: kubectl-eds-windows + # path: ./tmp-build/windows + - name: Get tag + uses: little-core-labs/get-git-tag@v3.0.2 + id: tag + - name: Prepare ./dist folder + run: | + mkdir -p ./dist + mv ./tmp-build/linux/*.zip ./dist + #- name: Generate Plugin manifest + # run: ./hack/release/generate-plugin-manifest.sh ${{steps.tag.outputs.tag}} + - name: Release + uses: softprops/action-gh-release@v1 + with: + body_path: dist/CHANGELOG.md + prerelease: ${{ contains(github.ref, '-rc.') }} + files: | + dist/*.zip + dist/*.tar.gz + env: + COMMIT_TAG: ${{steps.tag.outputs.tag}} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.goreleaser-for-linux.yml b/.goreleaser-for-linux.yml new file mode 100644 index 0000000..8613e40 --- /dev/null +++ b/.goreleaser-for-linux.yml @@ -0,0 +1,71 @@ +# Make sure to check the documentation at http://goreleaser.com +# --------------------------- +# General +# --------------------------- +before: + hooks: + - make all +snapshot: + name_template: "{{ .Tag }}" +changelog: + sort: asc + filters: + exclude: + - '^.github:' + - '^.vscode:' + - '^docs:' + - '^test:' + +# --------------------------- +# Builder +# +# CGO is enabled and inspiration came from: +# https://github.com/goreleaser/goreleaser-cross-example +# https://github.com/goreleaser/goreleaser-cross-example-sysroot +# https://github.com/DataDog/extendeddaemonset/blob/main/.goreleaser-for-linux.yaml +# --------------------------- +builds: + - id: linux-build + main: ./cmd/ + binary: alert_system + goos: + - linux + goarch: + - amd64 + - arm64 + env: + - CGO_ENABLED=1 + #- PKG_CONFIG_SYSROOT_DIR=/sysroot/macos/amd64 + #- PKG_CONFIG_PATH=/sysroot/macos/amd64/usr/local/lib/pkgconfig + #- CC=o64-clang # (GitHub action) + #- CXX=o64-clang++ # (GitHub action) + #- CC=clang # Changed from o64-clang (works for mac) + #- CXX=clang++ # Changed from o64-clang++ (works for mac) + #mod_timestamp: "{{ .CommitTimestamp }}" + #flags: + # - -mod=readonly + ldflags: + - -s -w -X main.version={{.Version}} + #- -s -w -X github.com/bitcoin-sv/{{ .ProjectName }}/cmd.Version={{ .Version }} + overrides: + - goos: linux + goarch: arm64 + env: + - CC=aarch64-linux-gnu-gcc + +# --------------------------- +# Archives + Checksums +# --------------------------- +archives: + - id: alert_system + builds: + - linux-build + name_template: "kubectl-eds_{{ .Version }}_{{ .Os }}_{{ .Arch }}" + wrap_in_directory: false + format: zip + files: + - LICENSE +checksum: + name_template: "{{ .ProjectName }}_checksums.txt" + algorithm: sha256 + diff --git a/.goreleaser.yml b/.old-goreleaser.yml similarity index 100% rename from .goreleaser.yml rename to .old-goreleaser.yml From 20540753e6dd62699116d60d8fe29e200cb5eaf9 Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Sat, 10 Feb 2024 14:00:24 -0500 Subject: [PATCH 16/33] fix: for yaml linter --- .goreleaser-for-linux.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.goreleaser-for-linux.yml b/.goreleaser-for-linux.yml index 8613e40..c98e29f 100644 --- a/.goreleaser-for-linux.yml +++ b/.goreleaser-for-linux.yml @@ -67,5 +67,4 @@ archives: - LICENSE checksum: name_template: "{{ .ProjectName }}_checksums.txt" - algorithm: sha256 - + algorithm: sha256 \ No newline at end of file From 897cb3548ce459363398026f331d7434cd1b5f10 Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Sat, 10 Feb 2024 14:03:08 -0500 Subject: [PATCH 17/33] fix: file extension does not match --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b47bca9..ca5d7d7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -45,7 +45,7 @@ jobs: uses: goreleaser/goreleaser-action@v3 with: version: latest - args: release --skip-publish --config .goreleaser-for-linux.yaml + args: release --skip-publish --config .goreleaser-for-linux.yml env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GORELEASER_PREVIOUS_TAG: ${{steps.latest_version.outputs.release}} From 67e448969e3f3917b50402d6829b8f90e9a0cfec Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Sat, 10 Feb 2024 14:14:20 -0500 Subject: [PATCH 18/33] fix: names, tags, deprecated fields --- .github/workflows/release.yml | 9 +++++---- .goreleaser-for-linux.yml | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ca5d7d7..d9e4297 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -45,17 +45,18 @@ jobs: uses: goreleaser/goreleaser-action@v3 with: version: latest - args: release --skip-publish --config .goreleaser-for-linux.yml + args: release --skip=publish --config .goreleaser-for-linux.yml env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GORELEASER_PREVIOUS_TAG: ${{steps.latest_version.outputs.release}} - name: Upload uses: actions/upload-artifact@v4 with: - name: alert-system-linux + name: alert_system_linux path: | - dist/alert-system_*.zip + dist/alert_system_*.zip dist/checksums.txt + dist/CHANGELOG.md create-release: #needs: [build-linux-binary, build-darwin-binary, build-windows-binary] @@ -74,7 +75,7 @@ jobs: - name: Download linux binaries uses: actions/download-artifact@v4 with: - name: alert-system-linux + name: alert_system_linux path: ./tmp-build/linux #- name: Download darwin binaries # uses: actions/download-artifact@v3 diff --git a/.goreleaser-for-linux.yml b/.goreleaser-for-linux.yml index c98e29f..ab7715e 100644 --- a/.goreleaser-for-linux.yml +++ b/.goreleaser-for-linux.yml @@ -60,11 +60,11 @@ archives: - id: alert_system builds: - linux-build - name_template: "kubectl-eds_{{ .Version }}_{{ .Os }}_{{ .Arch }}" + name_template: "alert_system_{{ .Version }}_{{ .Os }}_{{ .Arch }}" wrap_in_directory: false format: zip files: - LICENSE checksum: - name_template: "{{ .ProjectName }}_checksums.txt" + name_template: "checksums.txt" algorithm: sha256 \ No newline at end of file From b6d153b2e47ddc42569eb3d88bfe6a89aa22184d Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Sat, 10 Feb 2024 14:29:30 -0500 Subject: [PATCH 19/33] fix: add changelog and checksums --- .github/workflows/release.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d9e4297..b9cc664 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,9 +23,9 @@ jobs: fetch-depth: 0 - name: gcc install run: sudo apt-get update; sudo apt install gcc-aarch64-linux-gnu - - name: Get tag - uses: little-core-labs/get-git-tag@v3.0.2 - id: tag + #- name: Get tag + # uses: little-core-labs/get-git-tag@v3.0.2 + # id: tag - name: Set up Go uses: actions/setup-go@v5 with: @@ -45,10 +45,9 @@ jobs: uses: goreleaser/goreleaser-action@v3 with: version: latest - args: release --skip=publish --config .goreleaser-for-linux.yml + args: release --skip=publish --verbose --config .goreleaser-for-linux.yml env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GORELEASER_PREVIOUS_TAG: ${{steps.latest_version.outputs.release}} - name: Upload uses: actions/upload-artifact@v4 with: @@ -94,6 +93,8 @@ jobs: run: | mkdir -p ./dist mv ./tmp-build/linux/*.zip ./dist + cat ./tmp-build/linux/checksums.txt >> ./dist/checksums.txt + cat ./tmp-build/linux/CHANGELOG.md >> ./dist/CHANGELOG.md #- name: Generate Plugin manifest # run: ./hack/release/generate-plugin-manifest.sh ${{steps.tag.outputs.tag}} - name: Release @@ -103,7 +104,6 @@ jobs: prerelease: ${{ contains(github.ref, '-rc.') }} files: | dist/*.zip - dist/*.tar.gz env: COMMIT_TAG: ${{steps.tag.outputs.tag}} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From 8dbc2555069130bd80a7148294f44902aacd9cae Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Sat, 10 Feb 2024 14:46:01 -0500 Subject: [PATCH 20/33] feat: added darwin binary --- .github/workflows/release.yml | 60 ++++++++++++++++++++++++++------ .goreleaser-for-darwin.yml | 65 +++++++++++++++++++++++++++++++++++ 2 files changed, 114 insertions(+), 11 deletions(-) create mode 100644 .goreleaser-for-darwin.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b9cc664..315bbd5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,9 +23,6 @@ jobs: fetch-depth: 0 - name: gcc install run: sudo apt-get update; sudo apt install gcc-aarch64-linux-gnu - #- name: Get tag - # uses: little-core-labs/get-git-tag@v3.0.2 - # id: tag - name: Set up Go uses: actions/setup-go@v5 with: @@ -57,9 +54,49 @@ jobs: dist/checksums.txt dist/CHANGELOG.md + build-darwin-binary: + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: gcc install + run: sudo apt-get update; sudo apt install gcc-aarch64-linux-gnu + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: ${{ env.GO_VERSION }} + - name: Cache code + uses: actions/cache@v4 + with: + path: | + ~/go/pkg/mod # Module download cache + ~/.cache/go-build # Build cache (Linux) + ~/Library/Caches/go-build # Build cache (Mac) + "%LocalAppData%\\go-build" # Build cache (Windows) + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v3 + with: + version: latest + args: release --skip=publish --verbose --config .goreleaser-for-darwin.yml + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Upload + uses: actions/upload-artifact@v4 + with: + name: alert_system_darwin + path: | + dist/alert_system_*.zip + dist/checksums.txt + dist/CHANGELOG.md + create-release: #needs: [build-linux-binary, build-darwin-binary, build-windows-binary] - needs: [build-linux-binary] + needs: [build-linux-binary, build-darwin-binary] runs-on: ubuntu-latest steps: - name: Checkout @@ -76,11 +113,11 @@ jobs: with: name: alert_system_linux path: ./tmp-build/linux - #- name: Download darwin binaries - # uses: actions/download-artifact@v3 - # with: - # name: kubectl-eds-darwin - # path: ./tmp-build/darwin + - name: Download darwin binaries + uses: actions/download-artifact@v4 + with: + name: alert_system_darwin + path: ./tmp-build/darwin #- name: Download windows binaries # uses: actions/download-artifact@v3 # with: @@ -93,10 +130,9 @@ jobs: run: | mkdir -p ./dist mv ./tmp-build/linux/*.zip ./dist + mv ./tmp-build/darwin/*.zip ./dist cat ./tmp-build/linux/checksums.txt >> ./dist/checksums.txt cat ./tmp-build/linux/CHANGELOG.md >> ./dist/CHANGELOG.md - #- name: Generate Plugin manifest - # run: ./hack/release/generate-plugin-manifest.sh ${{steps.tag.outputs.tag}} - name: Release uses: softprops/action-gh-release@v1 with: @@ -104,6 +140,8 @@ jobs: prerelease: ${{ contains(github.ref, '-rc.') }} files: | dist/*.zip + dist/checksums.txt + dist/CHANGELOG.md env: COMMIT_TAG: ${{steps.tag.outputs.tag}} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.goreleaser-for-darwin.yml b/.goreleaser-for-darwin.yml new file mode 100644 index 0000000..d7a0cde --- /dev/null +++ b/.goreleaser-for-darwin.yml @@ -0,0 +1,65 @@ +# Make sure to check the documentation at http://goreleaser.com +# --------------------------- +# General +# --------------------------- +before: + hooks: + - make all +snapshot: + name_template: "{{ .Tag }}" +changelog: + sort: asc + filters: + exclude: + - '^.github:' + - '^.vscode:' + - '^docs:' + - '^test:' + +# --------------------------- +# Builder +# +# CGO is enabled and inspiration came from: +# https://github.com/goreleaser/goreleaser-cross-example +# https://github.com/goreleaser/goreleaser-cross-example-sysroot +# https://github.com/DataDog/extendeddaemonset/blob/main/.goreleaser-for-linux.yaml +# --------------------------- +builds: + - id: darwin-build + main: ./cmd/ + binary: alert_system + goos: + - darwin + goarch: + - amd64 + - arm64 + env: + - CGO_ENABLED=1 + #- PKG_CONFIG_SYSROOT_DIR=/sysroot/macos/amd64 + #- PKG_CONFIG_PATH=/sysroot/macos/amd64/usr/local/lib/pkgconfig + #- CC=o64-clang # (GitHub action) + #- CXX=o64-clang++ # (GitHub action) + #- CC=clang # Changed from o64-clang (works for mac) + #- CXX=clang++ # Changed from o64-clang++ (works for mac) + #mod_timestamp: "{{ .CommitTimestamp }}" + #flags: + # - -mod=readonly + ldflags: + - -s -w -X main.version={{.Version}} + #- -s -w -X github.com/bitcoin-sv/{{ .ProjectName }}/cmd.Version={{ .Version }} + +# --------------------------- +# Archives + Checksums +# --------------------------- +archives: + - id: alert_system + builds: + - darwin-build + name_template: "alert_system_{{ .Version }}_{{ .Os }}_{{ .Arch }}" + wrap_in_directory: false + format: zip + files: + - LICENSE +checksum: + name_template: "checksums.txt" + algorithm: sha256 \ No newline at end of file From 8409cc289b113636439e8494aa94da6cf275ae3c Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Sat, 10 Feb 2024 14:48:38 -0500 Subject: [PATCH 21/33] fix: for removing gcc from darwin --- .github/workflows/release.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 315bbd5..319a4cd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -61,8 +61,6 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - - name: gcc install - run: sudo apt-get update; sudo apt install gcc-aarch64-linux-gnu - name: Set up Go uses: actions/setup-go@v5 with: From d80f51eedb3b40951e3b5b7ca89b631c85d27394 Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Sat, 10 Feb 2024 14:57:11 -0500 Subject: [PATCH 22/33] fix: attempt to fix a perm issue on installing golangci --- .make/go.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.make/go.mk b/.make/go.mk index 38e8063..3e98276 100644 --- a/.make/go.mk +++ b/.make/go.mk @@ -71,7 +71,7 @@ lint: ## Run the golangci-lint application (install if not found) @#AWS CodePipeline @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(CODEBUILD_BUILD_ID)" != "" ]; then curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.56.1; fi; @#GitHub Actions - @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(GITHUB_WORKFLOW)" != "" ]; then curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sudo sh -s -- -b $(go env GOPATH)/bin v1.56.1; fi; + @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(GITHUB_WORKFLOW)" != "" ]; then curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.56.1; fi; @#Brew - MacOS @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(shell command -v brew)" != "" ]; then brew install golangci-lint; fi; @#MacOS Vanilla From 49bab17494f313b53861d5c0a16405d9f5739945 Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Sat, 10 Feb 2024 15:07:32 -0500 Subject: [PATCH 23/33] fix: add more logging to lint install --- .make/go.mk | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/.make/go.mk b/.make/go.mk index 3e98276..1417271 100644 --- a/.make/go.mk +++ b/.make/go.mk @@ -66,16 +66,33 @@ install-go: ## Install the application (Using Native Go) .PHONY: lint lint: ## Run the golangci-lint application (install if not found) @echo "installing golangci-lint..." - @#Travis (has sudo) - @if [ "$(shell command -v golangci-lint)" = "" ] && [ $(TRAVIS) ]; then curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.56.1 && sudo cp ./bin/golangci-lint $(go env GOPATH)/bin/; fi; - @#AWS CodePipeline - @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(CODEBUILD_BUILD_ID)" != "" ]; then curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.56.1; fi; - @#GitHub Actions - @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(GITHUB_WORKFLOW)" != "" ]; then curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.56.1; fi; - @#Brew - MacOS - @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(shell command -v brew)" != "" ]; then brew install golangci-lint; fi; - @#MacOS Vanilla - @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(shell command -v brew)" != "" ]; then curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- v1.56.1; fi; + @# Travis (has sudo) + @if [ "$(shell command -v golangci-lint)" = "" ] && [ $(TRAVIS) ]; then \ + echo "travis-detected"; \ + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.56.1 && \ + sudo cp ./bin/golangci-lint $(go env GOPATH)/bin/; \ + fi; + @# AWS CodePipeline + @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(CODEBUILD_BUILD_ID)" != "" ]; then \ + echo "aws-pipeline-detected"; \ + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.56.1; \ + fi; + @# GitHub Actions + @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(GITHUB_WORKFLOW)" != "" ]; then \ + echo "github-action-detected"; \ + echo $(go env GOPATH)/bin; \ + curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.56.1; \ + fi; + @# Brew - MacOS + @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(shell command -v brew)" != "" ]; then \ + echo "brew-detected"; \ + brew install golangci-lint; \ + fi; + @# MacOS Vanilla + @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(shell command -v brew)" = "" ]; then \ + echo "vanilla-mac-detected"; \ + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- v1.56.1; \ + fi; @echo "running golangci-lint..." @golangci-lint run --verbose From 2ccce9f88f3bdd08936410ac0453c54ad8310802 Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Sat, 10 Feb 2024 15:13:28 -0500 Subject: [PATCH 24/33] fix: set the gopath env --- .make/go.mk | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.make/go.mk b/.make/go.mk index 1417271..cee3161 100644 --- a/.make/go.mk +++ b/.make/go.mk @@ -79,10 +79,12 @@ lint: ## Run the golangci-lint application (install if not found) fi; @# GitHub Actions @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(GITHUB_WORKFLOW)" != "" ]; then \ - echo "github-action-detected"; \ - echo $(go env GOPATH)/bin; \ - curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.56.1; \ - fi; + GOPATH=$$(go env GOPATH); \ + if [ -z "$$GOPATH" ]; then GOPATH=$$HOME/go; fi; \ + echo "github-action-detected"; \ + echo $$GOPATH/bin; \ + curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$GOPATH/bin v1.56.1; \ + fi; @# Brew - MacOS @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(shell command -v brew)" != "" ]; then \ echo "brew-detected"; \ From 1d42ad71e2d5f016a8b2686d986d04a818514edf Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Sat, 10 Feb 2024 15:18:28 -0500 Subject: [PATCH 25/33] fix: attempt to overwrite go if detected --- .make/go.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.make/go.mk b/.make/go.mk index cee3161..956936d 100644 --- a/.make/go.mk +++ b/.make/go.mk @@ -88,7 +88,7 @@ lint: ## Run the golangci-lint application (install if not found) @# Brew - MacOS @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(shell command -v brew)" != "" ]; then \ echo "brew-detected"; \ - brew install golangci-lint; \ + brew install golangci-lint --overwrite go; \ fi; @# MacOS Vanilla @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(shell command -v brew)" = "" ]; then \ From 07690ea8256687c9c389c2715833d148698717ff Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Sat, 10 Feb 2024 15:23:13 -0500 Subject: [PATCH 26/33] fix: working on safer brew execution --- .make/go.mk | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.make/go.mk b/.make/go.mk index 956936d..17d4608 100644 --- a/.make/go.mk +++ b/.make/go.mk @@ -65,34 +65,38 @@ install-go: ## Install the application (Using Native Go) .PHONY: lint lint: ## Run the golangci-lint application (install if not found) - @echo "installing golangci-lint..." @# Travis (has sudo) @if [ "$(shell command -v golangci-lint)" = "" ] && [ $(TRAVIS) ]; then \ - echo "travis-detected"; \ + echo "travis-detected, installing..."; \ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.56.1 && \ sudo cp ./bin/golangci-lint $(go env GOPATH)/bin/; \ fi; @# AWS CodePipeline @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(CODEBUILD_BUILD_ID)" != "" ]; then \ - echo "aws-pipeline-detected"; \ + echo "aws-pipeline-detected, installing..."; \ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.56.1; \ fi; @# GitHub Actions @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(GITHUB_WORKFLOW)" != "" ]; then \ GOPATH=$$(go env GOPATH); \ if [ -z "$$GOPATH" ]; then GOPATH=$$HOME/go; fi; \ - echo "github-action-detected"; \ + echo "github-action-detected, installing..."; \ echo $$GOPATH/bin; \ curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$GOPATH/bin v1.56.1; \ fi; @# Brew - MacOS @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(shell command -v brew)" != "" ]; then \ - echo "brew-detected"; \ - brew install golangci-lint --overwrite go; \ + echo "brew-detected, installing..."; \ + brew install golangci-lint || true; \ + if [ "$(brew list --versions golangci-lint)" = "" ]; then \ + echo "attempting to overwrite conflicting links..."; \ + brew link --overwrite go; \ + brew install golangci-lint; \ + fi; \ fi; @# MacOS Vanilla @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(shell command -v brew)" = "" ]; then \ - echo "vanilla-mac-detected"; \ + echo "vanilla-mac-detected, installing..."; \ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- v1.56.1; \ fi; @echo "running golangci-lint..." From 5023bd6ff1564e87c07d725b1ca89f1a2fbcdc7e Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Sat, 10 Feb 2024 15:34:42 -0500 Subject: [PATCH 27/33] fix: only run one install --- .make/go.mk | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.make/go.mk b/.make/go.mk index 17d4608..e498780 100644 --- a/.make/go.mk +++ b/.make/go.mk @@ -67,26 +67,26 @@ install-go: ## Install the application (Using Native Go) lint: ## Run the golangci-lint application (install if not found) @# Travis (has sudo) @if [ "$(shell command -v golangci-lint)" = "" ] && [ $(TRAVIS) ]; then \ - echo "travis-detected, installing..."; \ + echo "travis detected, installing..."; \ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.56.1 && \ sudo cp ./bin/golangci-lint $(go env GOPATH)/bin/; \ fi; @# AWS CodePipeline @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(CODEBUILD_BUILD_ID)" != "" ]; then \ - echo "aws-pipeline-detected, installing..."; \ + echo "aws pipeline detected, installing..."; \ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.56.1; \ fi; - @# GitHub Actions - @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(GITHUB_WORKFLOW)" != "" ]; then \ + @# GitHub Action (linux - no brew) + @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(GITHUB_WORKFLOW)" != "" ] && [ "$(shell command -v brew)" = "" ] ; then \ GOPATH=$$(go env GOPATH); \ if [ -z "$$GOPATH" ]; then GOPATH=$$HOME/go; fi; \ - echo "github-action-detected, installing..."; \ + echo "github linux action detected, installing..."; \ echo $$GOPATH/bin; \ curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$GOPATH/bin v1.56.1; \ fi; @# Brew - MacOS @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(shell command -v brew)" != "" ]; then \ - echo "brew-detected, installing..."; \ + echo "brew detected, installing..."; \ brew install golangci-lint || true; \ if [ "$(brew list --versions golangci-lint)" = "" ]; then \ echo "attempting to overwrite conflicting links..."; \ @@ -96,7 +96,7 @@ lint: ## Run the golangci-lint application (install if not found) fi; @# MacOS Vanilla @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(shell command -v brew)" = "" ]; then \ - echo "vanilla-mac-detected, installing..."; \ + echo "vanilla mac detected, installing..."; \ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- v1.56.1; \ fi; @echo "running golangci-lint..." From 4db9168295d636bdc1a06c914bfcb118a8e5e798 Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Sat, 10 Feb 2024 15:34:52 -0500 Subject: [PATCH 28/33] chore: cleanup of files --- .goreleaser-for-darwin.yml | 13 +--- .goreleaser-for-linux.yml | 11 +-- .old-goreleaser.yml | 145 ------------------------------------- 3 files changed, 3 insertions(+), 166 deletions(-) delete mode 100644 .old-goreleaser.yml diff --git a/.goreleaser-for-darwin.yml b/.goreleaser-for-darwin.yml index d7a0cde..14737d3 100644 --- a/.goreleaser-for-darwin.yml +++ b/.goreleaser-for-darwin.yml @@ -22,7 +22,7 @@ changelog: # CGO is enabled and inspiration came from: # https://github.com/goreleaser/goreleaser-cross-example # https://github.com/goreleaser/goreleaser-cross-example-sysroot -# https://github.com/DataDog/extendeddaemonset/blob/main/.goreleaser-for-linux.yaml +# https://github.com/DataDog/extendeddaemonset/blob/main/.goreleaser-for-darwin.yaml # --------------------------- builds: - id: darwin-build @@ -35,18 +35,9 @@ builds: - arm64 env: - CGO_ENABLED=1 - #- PKG_CONFIG_SYSROOT_DIR=/sysroot/macos/amd64 - #- PKG_CONFIG_PATH=/sysroot/macos/amd64/usr/local/lib/pkgconfig - #- CC=o64-clang # (GitHub action) - #- CXX=o64-clang++ # (GitHub action) - #- CC=clang # Changed from o64-clang (works for mac) - #- CXX=clang++ # Changed from o64-clang++ (works for mac) - #mod_timestamp: "{{ .CommitTimestamp }}" - #flags: - # - -mod=readonly + mod_timestamp: "{{ .CommitTimestamp }}" ldflags: - -s -w -X main.version={{.Version}} - #- -s -w -X github.com/bitcoin-sv/{{ .ProjectName }}/cmd.Version={{ .Version }} # --------------------------- # Archives + Checksums diff --git a/.goreleaser-for-linux.yml b/.goreleaser-for-linux.yml index ab7715e..a8bcda6 100644 --- a/.goreleaser-for-linux.yml +++ b/.goreleaser-for-linux.yml @@ -35,18 +35,9 @@ builds: - arm64 env: - CGO_ENABLED=1 - #- PKG_CONFIG_SYSROOT_DIR=/sysroot/macos/amd64 - #- PKG_CONFIG_PATH=/sysroot/macos/amd64/usr/local/lib/pkgconfig - #- CC=o64-clang # (GitHub action) - #- CXX=o64-clang++ # (GitHub action) - #- CC=clang # Changed from o64-clang (works for mac) - #- CXX=clang++ # Changed from o64-clang++ (works for mac) - #mod_timestamp: "{{ .CommitTimestamp }}" - #flags: - # - -mod=readonly + mod_timestamp: "{{ .CommitTimestamp }}" ldflags: - -s -w -X main.version={{.Version}} - #- -s -w -X github.com/bitcoin-sv/{{ .ProjectName }}/cmd.Version={{ .Version }} overrides: - goos: linux goarch: arm64 diff --git a/.old-goreleaser.yml b/.old-goreleaser.yml deleted file mode 100644 index 5648442..0000000 --- a/.old-goreleaser.yml +++ /dev/null @@ -1,145 +0,0 @@ -# Make sure to check the documentation at http://goreleaser.com -# --------------------------- -# General -# --------------------------- -before: - hooks: - - make all -snapshot: - name_template: "{{ .Tag }}" -changelog: - sort: asc - filters: - exclude: - - '^.github:' - - '^.vscode:' - - '^test:' - -# --------------------------- -# Builder -# -# CGO is enabled and inspiration came from: -# https://github.com/goreleaser/goreleaser-cross-example -# https://github.com/goreleaser/goreleaser-cross-example-sysroot -# --------------------------- -builds: - - id: darwin-amd64 - main: ./cmd/ - binary: alert_system - goos: - - darwin - goarch: - - amd64 - env: - - CGO_ENABLED=1 - - PKG_CONFIG_SYSROOT_DIR=/sysroot/macos/amd64 - - PKG_CONFIG_PATH=/sysroot/macos/amd64/usr/local/lib/pkgconfig - - CC=o64-clang # (GitHub action) - - CXX=o64-clang++ # (GitHub action) - #- CC=clang # Changed from o64-clang (works for mac) - #- CXX=clang++ # Changed from o64-clang++ (works for mac) - #mod_timestamp: "{{ .CommitTimestamp }}" - flags: - - -mod=readonly - ldflags: - - -s -w -X main.version={{.Version}} - #- -s -w -X github.com/bitcoin-sv/{{ .ProjectName }}/cmd.Version={{ .Version }} - - - id: linux-armhf - main: ./cmd/ - binary: alert_system - goos: - - linux - goarch: - - arm - goarm: - - 7 - env: - - CGO_ENABLED=1 - - CC=arm-linux-gnueabihf-gcc # Make sure this points to the correct executable - - CXX=arm-linux-gnueabihf-g++ - - CGO_CFLAGS=--sysroot=/sysroot/linux/armhf - - CGO_LDFLAGS=--sysroot=/sysroot/linux/armhf - - PKG_CONFIG_SYSROOT_DIR=/sysroot/linux/armhf - - PKG_CONFIG_PATH=/sysroot/linux/armhf/opt/vc/lib/pkgconfig:/sysroot/linux/armhf/usr/lib/arm-linux-gnueabihf/pkgconfig:/sysroot/linux/armhf/usr/lib/pkgconfig:/sysroot/linux/armhf/usr/local/lib/pkgconfig - #mod_timestamp: "{{ .CommitTimestamp }}" - flags: - - -mod=readonly - ldflags: - - -s -w -X main.version={{.Version}} - #- -s -w -X github.com/bitcoin-sv/{{ .ProjectName }}/cmd.Version={{ .Version }} -# overrides: -# - goos: linux -# goarch: arm64 -# env: -# - CC=aarch64-linux-gnu-gcc - -# --------------------------- -# Archives + Checksums -# --------------------------- -archives: - - id: alert_system - builds: - - darwin-amd64 - - linux-armhf - name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" - format: zip - wrap_in_directory: true - -#archives: -# - wrap_in_directory: true -# format: tar.gz -# name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}_{{ .Version }}' - -checksum: - name_template: "{{ .ProjectName }}_checksums.txt" - algorithm: sha256 - -# --------------------------- -# GitHub Release -# --------------------------- -release: - prerelease: true - name_template: "Release v{{.Version}}" - -# --------------------------- -# Announce -# --------------------------- -announce: - - # See more at: https://goreleaser.com/customization/announce/#slack - slack: - enabled: false - message_template: '{{ .ProjectName }} {{ .Tag }} is out! Changelog: https://github.com/bitcoin-sv/{{ .ProjectName }}/releases/tag/{{ .Tag }}' - channel: '#test_slack' - # username: '' - # icon_emoji: '' - # icon_url: '' - - # See more at: https://goreleaser.com/customization/announce/#twitter - twitter: - enabled: false - message_template: '{{ .ProjectName }} {{ .Tag }} is out!' - - # See more at: https://goreleaser.com/customization/announce/#discord - discord: - enabled: false - message_template: '{{ .ProjectName }} {{ .Tag }} is out!' - # Defaults to `GoReleaser` - author: '' - # Defaults to `3888754` - the grey-ish from goreleaser - color: '' - # Defaults to `https://goreleaser.com/static/avatar.png` - icon_url: '' - - # See more at: https://goreleaser.com/customization/announce/#reddit - reddit: - enabled: false - # Application ID for Reddit Application - application_id: "" - # Username for your Reddit account - username: "" - # Defaults to `{{ .GitURL }}/releases/tag/{{ .Tag }}` - # url_template: 'https://github.com/bitcoin-sv/{{ .ProjectName }}/releases/tag/{{ .Tag }}' - # Defaults to `{{ .ProjectName }} {{ .Tag }} is out!` - title_template: '{{ .ProjectName }} {{ .Tag }} is out!' \ No newline at end of file From cb0b47145f373ca3f22f3c59d7311702e4713a90 Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Sat, 10 Feb 2024 15:35:03 -0500 Subject: [PATCH 29/33] chore: cleanup old code --- .github/workflows/release.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 319a4cd..e4b0098 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -93,7 +93,6 @@ jobs: dist/CHANGELOG.md create-release: - #needs: [build-linux-binary, build-darwin-binary, build-windows-binary] needs: [build-linux-binary, build-darwin-binary] runs-on: ubuntu-latest steps: @@ -116,11 +115,6 @@ jobs: with: name: alert_system_darwin path: ./tmp-build/darwin - #- name: Download windows binaries - # uses: actions/download-artifact@v3 - # with: - # name: kubectl-eds-windows - # path: ./tmp-build/windows - name: Get tag uses: little-core-labs/get-git-tag@v3.0.2 id: tag @@ -138,7 +132,6 @@ jobs: prerelease: ${{ contains(github.ref, '-rc.') }} files: | dist/*.zip - dist/checksums.txt dist/CHANGELOG.md env: COMMIT_TAG: ${{steps.tag.outputs.tag}} From 96051bdcec1454930a2106aafbf0c63854c1812e Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Sat, 10 Feb 2024 15:45:45 -0500 Subject: [PATCH 30/33] fix: added more timeout to linting --- .golangci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index bd9b026..256af2f 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -7,7 +7,7 @@ run: concurrency: 4 # timeout for analysis, e.g. 30s, 5m, default is 1m - timeout: 6m + timeout: 10m # exit code when at least one issue was found, default is 1 issues-exit-code: 1 From b2e70b9c83cc3d56de7625d4e9b8c9f6169f284c Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Sat, 10 Feb 2024 15:45:55 -0500 Subject: [PATCH 31/33] fix: only install if needed --- .make/go.mk | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/.make/go.mk b/.make/go.mk index e498780..c5a0adc 100644 --- a/.make/go.mk +++ b/.make/go.mk @@ -85,13 +85,20 @@ lint: ## Run the golangci-lint application (install if not found) curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$GOPATH/bin v1.56.1; \ fi; @# Brew - MacOS - @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(shell command -v brew)" != "" ]; then \ - echo "brew detected, installing..."; \ - brew install golangci-lint || true; \ - if [ "$(brew list --versions golangci-lint)" = "" ]; then \ - echo "attempting to overwrite conflicting links..."; \ - brew link --overwrite go; \ - brew install golangci-lint; \ + @if [ "$(shell command -v golangci-lint)" = "" ]; then \ + if [ "$(shell command -v brew)" != "" ]; then \ + echo "brew detected, checking golangci-lint installation..."; \ + if brew list golangci-lint &>/dev/null; then \ + echo "golangci-lint is already installed."; \ + else \ + echo "installing golangci-lint..."; \ + brew install golangci-lint || true; \ + if [ "$(brew list --versions golangci-lint)" = "" ]; then \ + echo "attempting to overwrite conflicting links..."; \ + brew link --overwrite go; \ + brew install golangci-lint; \ + fi; \ + fi; \ fi; \ fi; @# MacOS Vanilla From 6fa8eae819505d396bb17b7df87ad8190cf68ab9 Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Sat, 10 Feb 2024 16:01:11 -0500 Subject: [PATCH 32/33] fix: improved lint function --- .make/go.mk | 68 ++++++++++++++++++++--------------------------------- Makefile | 4 ---- 2 files changed, 25 insertions(+), 47 deletions(-) diff --git a/.make/go.mk b/.make/go.mk index c5a0adc..29ef69b 100644 --- a/.make/go.mk +++ b/.make/go.mk @@ -65,49 +65,31 @@ install-go: ## Install the application (Using Native Go) .PHONY: lint lint: ## Run the golangci-lint application (install if not found) - @# Travis (has sudo) - @if [ "$(shell command -v golangci-lint)" = "" ] && [ $(TRAVIS) ]; then \ - echo "travis detected, installing..."; \ - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.56.1 && \ - sudo cp ./bin/golangci-lint $(go env GOPATH)/bin/; \ - fi; - @# AWS CodePipeline - @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(CODEBUILD_BUILD_ID)" != "" ]; then \ - echo "aws pipeline detected, installing..."; \ - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.56.1; \ - fi; - @# GitHub Action (linux - no brew) - @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(GITHUB_WORKFLOW)" != "" ] && [ "$(shell command -v brew)" = "" ] ; then \ - GOPATH=$$(go env GOPATH); \ - if [ -z "$$GOPATH" ]; then GOPATH=$$HOME/go; fi; \ - echo "github linux action detected, installing..."; \ - echo $$GOPATH/bin; \ - curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$GOPATH/bin v1.56.1; \ - fi; - @# Brew - MacOS - @if [ "$(shell command -v golangci-lint)" = "" ]; then \ - if [ "$(shell command -v brew)" != "" ]; then \ - echo "brew detected, checking golangci-lint installation..."; \ - if brew list golangci-lint &>/dev/null; then \ - echo "golangci-lint is already installed."; \ - else \ - echo "installing golangci-lint..."; \ - brew install golangci-lint || true; \ - if [ "$(brew list --versions golangci-lint)" = "" ]; then \ - echo "attempting to overwrite conflicting links..."; \ - brew link --overwrite go; \ - brew install golangci-lint; \ - fi; \ - fi; \ - fi; \ - fi; - @# MacOS Vanilla - @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(shell command -v brew)" = "" ]; then \ - echo "vanilla mac detected, installing..."; \ - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- v1.56.1; \ - fi; - @echo "running golangci-lint..." - @golangci-lint run --verbose + @if [ "$(shell which golangci-lint)" = "" ]; then \ + if [ "$(shell command -v brew)" != "" ]; then \ + echo "Brew detected, attempting to install golangci-lint..."; \ + if ! brew list golangci-lint &>/dev/null; then \ + brew install golangci-lint; \ + else \ + echo "golangci-lint is already installed via brew."; \ + fi; \ + else \ + echo "Installing golangci-lint via curl..."; \ + GOPATH=$$(go env GOPATH); \ + if [ -z "$$GOPATH" ]; then GOPATH=$$HOME/go; fi; \ + echo "Installation path: $$GOPATH/bin"; \ + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$GOPATH/bin v1.56.1; \ + fi; \ + fi; \ + if [ "$(TRAVIS)" != "" ]; then \ + echo "Travis CI environment detected."; \ + elif [ "$(CODEBUILD_BUILD_ID)" != "" ]; then \ + echo "AWS CodePipeline environment detected."; \ + elif [ "$(GITHUB_WORKFLOW)" != "" ]; then \ + echo "GitHub Actions environment detected."; \ + fi; \ + echo "Running golangci-lint..."; \ + golangci-lint run --verbose .PHONY: test test: ## Runs lint and ALL tests diff --git a/Makefile b/Makefile index 0c02dcb..30dfbf3 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,3 @@ clean: ## Remove previous builds and any cached data @$(MAKE) clean-mods @test $(DISTRIBUTIONS_DIR) @if [ -d $(DISTRIBUTIONS_DIR) ]; then rm -r $(DISTRIBUTIONS_DIR); fi - -.PHONY: release -release:: ## Runs common.release then runs godocs - @$(MAKE) godocs From d7852eae5c4fab48b0cab551fe7583edbd14c05f Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Sat, 10 Feb 2024 16:10:07 -0500 Subject: [PATCH 33/33] fix: make the ids unique --- .goreleaser-for-darwin.yml | 2 +- .goreleaser-for-linux.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.goreleaser-for-darwin.yml b/.goreleaser-for-darwin.yml index 14737d3..2a012f4 100644 --- a/.goreleaser-for-darwin.yml +++ b/.goreleaser-for-darwin.yml @@ -43,7 +43,7 @@ builds: # Archives + Checksums # --------------------------- archives: - - id: alert_system + - id: alert_system_darwin builds: - darwin-build name_template: "alert_system_{{ .Version }}_{{ .Os }}_{{ .Arch }}" diff --git a/.goreleaser-for-linux.yml b/.goreleaser-for-linux.yml index a8bcda6..2026d8e 100644 --- a/.goreleaser-for-linux.yml +++ b/.goreleaser-for-linux.yml @@ -48,7 +48,7 @@ builds: # Archives + Checksums # --------------------------- archives: - - id: alert_system + - id: alert_system_linux builds: - linux-build name_template: "alert_system_{{ .Version }}_{{ .Os }}_{{ .Arch }}"