From bfa6b628baeef3ea809d49dde96bcc5457a9b9ba Mon Sep 17 00:00:00 2001 From: Erik Rasmussen Date: Tue, 17 Jun 2025 20:23:18 -0500 Subject: [PATCH 1/9] Setup goreleaser --- .github/workflows/release.yml | 44 ++++++++++++++++++++++++++++++++ .goreleaser.yaml | 48 +++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 .goreleaser.yaml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..cb54ac4 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,44 @@ +name: Release + +on: + pull_request: + branches: [main] + paths: + - .github/workflows/release.yml + - .goreleaser.yaml + push: + tags: ['v*.*.*'] + +jobs: + goreleaser: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: actions/setup-go@v5 + with: + go-version-file: go.mod + cache-dependency-path: go.sum + + - uses: goreleaser/goreleaser-action@v6 + if: github.event_name == 'pull_request' + with: + version: '~> v2' + args: release --snapshot + env: + GITHUB_TOKEN: ${{ github.token }} + # Disable the monorepo feature + GORELEASER_CURRENT_TAG: v0.0.1 + GORELEASER_PREVIOUS_TAG: v0.0.1-alpha + + - uses: goreleaser/goreleaser-action@v6 + if: github.event_name != 'pull_request' + with: + version: '~> v2' + args: release --clean + env: + GITHUB_TOKEN: ${{ github.token }} diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..0fcc103 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,48 @@ +# yaml-language-server: $schema=https://goreleaser.com/static/schema.json +# vim: set ts=2 sw=2 tw=0 fo=cnqoj +version: 2 + +before: + hooks: + - make tidy + +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin + + - goos: + - linux + - darwin + main: ./pkg/make/mk_funcs + binary: mk_funcs.so + buildmode: c-shared + +archives: + - formats: [tar.gz] + # this name template makes the OS and Arch compatible with the results of `uname`. + name_template: >- + {{ .ProjectName }}_ + {{- title .Os }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- else if eq .Arch "386" }}i386 + {{- else }}{{ .Arch }}{{ end }} + {{- if .Arm }}v{{ .Arm }}{{ end }} + # use zip for windows archives + format_overrides: + - goos: windows + formats: [zip] + +changelog: + sort: asc + filters: + exclude: + - "^docs:" + - "^test:" + +release: + draft: false + prerelease: auto From c39167ab96fea70fff1571f60f6cd872e4edb774 Mon Sep 17 00:00:00 2001 From: Erik Rasmussen Date: Tue, 17 Jun 2025 20:24:39 -0500 Subject: [PATCH 2/9] Defines separate build configurations Configures separate build configurations in `.goreleaser.yaml` to allow building `devctl` and `mk_funcs` with distinct settings. This change enhances the build process, providing flexibility for building different components of the project. --- .goreleaser.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 0fcc103..c6a8876 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -7,14 +7,16 @@ before: - make tidy builds: - - env: + - id: devctl + env: - CGO_ENABLED=0 goos: - linux - windows - darwin - - goos: + - id: mk_funcs + goos: - linux - darwin main: ./pkg/make/mk_funcs From d483602da5bc1dcf92ecc7b8a9a0a2855aa815ee Mon Sep 17 00:00:00 2001 From: Erik Rasmussen Date: Tue, 17 Jun 2025 20:29:08 -0500 Subject: [PATCH 3/9] Removes binary name from build config Removes the explicit binary name declaration in the build configuration. This change allows the build process to automatically determine the output binary name based on the project structure and configuration. It simplifies the configuration and reduces the risk of naming conflicts. --- .goreleaser.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index c6a8876..d70aaea 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -20,7 +20,6 @@ builds: - linux - darwin main: ./pkg/make/mk_funcs - binary: mk_funcs.so buildmode: c-shared archives: From 6528471a7daacc9efa618c8c3878b91a2120e690 Mon Sep 17 00:00:00 2001 From: Erik Rasmussen Date: Tue, 17 Jun 2025 20:33:37 -0500 Subject: [PATCH 4/9] Enables CGO for mk_funcs build Sets the CGO_ENABLED environment variable to 1 for the mk_funcs build target. This is required to properly build and link certain C code dependencies used by the mk_funcs build. --- .goreleaser.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index d70aaea..cac8401 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -16,6 +16,8 @@ builds: - darwin - id: mk_funcs + env: + - CGO_ENABLED=1 goos: - linux - darwin From 22dfe9315da71ca04afa74d60a55aa0862f6b994 Mon Sep 17 00:00:00 2001 From: Erik Rasmussen Date: Tue, 17 Jun 2025 20:38:04 -0500 Subject: [PATCH 5/9] Adds ARM64 architecture support Adds ARM64 architecture support to the build process for both standard binaries and C-shared libraries. This allows the application to run on ARM64-based systems. --- .goreleaser.yaml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index cac8401..8a321f9 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -14,15 +14,21 @@ builds: - linux - windows - darwin + goarch: + - amd64 + - arm64 - id: mk_funcs env: - CGO_ENABLED=1 + main: ./pkg/make/mk_funcs + buildmode: c-shared goos: - linux - darwin - main: ./pkg/make/mk_funcs - buildmode: c-shared + goarch: + - amd64 + - arm64 archives: - formats: [tar.gz] From 06bf100860709d3ddf7d075d40f2d91f4c8f49e5 Mon Sep 17 00:00:00 2001 From: Erik Rasmussen Date: Tue, 17 Jun 2025 20:40:31 -0500 Subject: [PATCH 6/9] Excludes arm64 architecture from build targets Excludes the arm64 architecture from the list of build targets. This change reduces build times and artifact size by limiting the number of architectures being built for the darwin platform. --- .goreleaser.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 8a321f9..620c5fa 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -28,7 +28,7 @@ builds: - darwin goarch: - amd64 - - arm64 + # - arm64 archives: - formats: [tar.gz] From ba9448599e87fa7aea0a7aa33335c37018b854be Mon Sep 17 00:00:00 2001 From: Erik Rasmussen Date: Tue, 17 Jun 2025 20:44:26 -0500 Subject: [PATCH 7/9] Removes redundant OS/ARCH definitions Simplifies the build configuration by removing the explicit definitions for operating systems and architectures, allowing the toolchain to determine these automatically. --- .goreleaser.yaml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 620c5fa..2d0eaa7 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -23,12 +23,6 @@ builds: - CGO_ENABLED=1 main: ./pkg/make/mk_funcs buildmode: c-shared - goos: - - linux - - darwin - goarch: - - amd64 - # - arm64 archives: - formats: [tar.gz] From c8971f1b44b1a2dbd56a326c438f7e05e7cf73fa Mon Sep 17 00:00:00 2001 From: Erik Rasmussen Date: Tue, 17 Jun 2025 21:09:13 -0500 Subject: [PATCH 8/9] Just linux then dammit --- .goreleaser.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 2d0eaa7..4bb20e7 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -23,6 +23,8 @@ builds: - CGO_ENABLED=1 main: ./pkg/make/mk_funcs buildmode: c-shared + goos: [linux] + goarch: [amd64] archives: - formats: [tar.gz] From ed0c84a5b73e144bfb08b9413135597169353e2a Mon Sep 17 00:00:00 2001 From: Erik Rasmussen Date: Tue, 17 Jun 2025 21:18:15 -0500 Subject: [PATCH 9/9] Idk anymore man --- .goreleaser.yaml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 4bb20e7..e66ff3c 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -5,6 +5,7 @@ version: 2 before: hooks: - make tidy + - make bin/mk_funcs.so builds: - id: devctl @@ -18,14 +19,6 @@ builds: - amd64 - arm64 - - id: mk_funcs - env: - - CGO_ENABLED=1 - main: ./pkg/make/mk_funcs - buildmode: c-shared - goos: [linux] - goarch: [amd64] - archives: - formats: [tar.gz] # this name template makes the OS and Arch compatible with the results of `uname`. @@ -51,3 +44,6 @@ changelog: release: draft: false prerelease: auto + extra_files: + - glob: ./bin/mk_funcs.so + name_template: mk_funcs.so