From 77f74907a310a05e68753db3b05856fc8dd36dad Mon Sep 17 00:00:00 2001 From: Cameron Cooper Date: Thu, 5 Mar 2026 12:28:35 -0600 Subject: [PATCH 1/4] add SKILL.md --- .github/workflows/build-pr.yml | 2 +- .github/workflows/release.yml | 2 +- .goreleaser.darwin.yaml | 2 ++ .goreleaser.linux.yaml | 2 ++ .goreleaser.windows.yaml | 2 ++ .goreleaser.yaml | 2 ++ 6 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml index d30f518..753602d 100644 --- a/.github/workflows/build-pr.yml +++ b/.github/workflows/build-pr.yml @@ -15,7 +15,7 @@ jobs: matrix: include: - name: linux-amd64 - os: ubuntu-latest + os: ubuntu-20.04 rust_target: x86_64-unknown-linux-gnu goreleaser_config: .goreleaser.linux.yaml cgo_lib_dir: cgo-lib/x86_64-unknown-linux-gnu diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 910ab16..1b625fa 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -74,7 +74,7 @@ jobs: release_linux: needs: tag - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 environment: goreleaser steps: - name: Checkout tag diff --git a/.goreleaser.darwin.yaml b/.goreleaser.darwin.yaml index 2dd5f15..ab18a61 100644 --- a/.goreleaser.darwin.yaml +++ b/.goreleaser.darwin.yaml @@ -31,6 +31,8 @@ archives: {{- else if eq .Arch "386" }}i386 {{- else }}{{ .Arch }}{{ end }} {{- if .Arm }}v{{ .Arm }}{{ end }} + files: + - SKILL.md checksum: name_template: >- diff --git a/.goreleaser.linux.yaml b/.goreleaser.linux.yaml index b774a91..14661c2 100644 --- a/.goreleaser.linux.yaml +++ b/.goreleaser.linux.yaml @@ -28,6 +28,8 @@ archives: {{- else if eq .Arch "386" }}i386 {{- else }}{{ .Arch }}{{ end }} {{- if .Arm }}v{{ .Arm }}{{ end }} + files: + - SKILL.md checksum: name_template: >- diff --git a/.goreleaser.windows.yaml b/.goreleaser.windows.yaml index 0515940..f7a0a9b 100644 --- a/.goreleaser.windows.yaml +++ b/.goreleaser.windows.yaml @@ -28,6 +28,8 @@ archives: {{- else if eq .Arch "386" }}i386 {{- else }}{{ .Arch }}{{ end }} {{- if .Arm }}v{{ .Arm }}{{ end }} + files: + - SKILL.md checksum: name_template: >- diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 24b2a73..068a79a 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -37,6 +37,8 @@ archives: {{- else if eq .Arch "386" }}i386 {{- else }}{{ .Arch }}{{ end }} {{- if .Arm }}v{{ .Arm }}{{ end }} + files: + - SKILL.md checksum: name_template: >- From c3d9a99f5e0b61f5737a62974774c1ca9879c8ac Mon Sep 17 00:00:00 2001 From: Cameron Cooper Date: Thu, 5 Mar 2026 12:29:29 -0600 Subject: [PATCH 2/4] remove repair-release.yml --- .github/workflows/repair-release.yml | 128 --------------------------- 1 file changed, 128 deletions(-) delete mode 100644 .github/workflows/repair-release.yml diff --git a/.github/workflows/repair-release.yml b/.github/workflows/repair-release.yml deleted file mode 100644 index 880873b..0000000 --- a/.github/workflows/repair-release.yml +++ /dev/null @@ -1,128 +0,0 @@ -name: Repair Release Assets - -on: - workflow_dispatch: - inputs: - tag: - description: "Existing tag to repair (e.g. v1.0.21)" - required: true - type: string - upload_windows: - description: "Build + upload Windows asset" - required: true - default: true - type: boolean - recompute_checksums: - description: "Recompute and clobber checksums asset" - required: true - default: true - type: boolean - -permissions: - contents: write - -jobs: - upload_windows: - runs-on: windows-latest - steps: - - name: Checkout tag - if: ${{ inputs.upload_windows }} - uses: actions/checkout@v4 - with: - fetch-depth: 0 - ref: ${{ inputs.tag }} - - - name: Set up Go - if: ${{ inputs.upload_windows }} - uses: actions/setup-go@v5 - with: - go-version: stable - - - name: Setup MSYS2 (mingw64) - if: ${{ inputs.upload_windows }} - uses: msys2/setup-msys2@v2 - with: - msystem: MINGW64 - update: true - install: >- - mingw-w64-x86_64-gcc - - - name: Add MinGW to PATH - if: ${{ inputs.upload_windows }} - shell: pwsh - run: | - "C:\msys64\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - - - name: Setup Rust - if: ${{ inputs.upload_windows }} - uses: dtolnay/rust-toolchain@stable - with: - targets: x86_64-pc-windows-gnu - - - name: Build libcoinset staticlib - if: ${{ inputs.upload_windows }} - shell: msys2 {0} - run: | - cargo build --release -p coinset-ffi --target x86_64-pc-windows-gnu - mkdir -p cgo-lib/x86_64-pc-windows-gnu - cp "target/x86_64-pc-windows-gnu/release/libcoinset.a" cgo-lib/x86_64-pc-windows-gnu/ - - - name: Build artifacts (windows) - if: ${{ inputs.upload_windows }} - uses: goreleaser/goreleaser-action@v5 - with: - distribution: goreleaser - version: ~> v1 - args: build --clean --skip=validate -f .goreleaser.windows.yaml - env: - CGO_LDFLAGS: -L${{ github.workspace }}/cgo-lib/x86_64-pc-windows-gnu - CC: gcc - - - name: Upload windows archives to existing release - if: ${{ inputs.upload_windows }} - shell: bash - env: - GH_TOKEN: ${{ secrets.ACTIONS_GITHUB_TOKEN }} - TAG: ${{ inputs.tag }} - run: | - set -euo pipefail - ls -la dist || true - # GoReleaser may place archives in dist/ subdirectories. - zips="$(ls -1 dist/*.zip dist/*/*.zip dist/*/*/*.zip 2>/dev/null || true)" - if [ -z "$zips" ]; then - echo "no zip archives found under dist/" - exit 1 - fi - echo "$zips" - gh release upload "$TAG" $zips --clobber - - recompute_checksums: - if: ${{ inputs.recompute_checksums }} - needs: [upload_windows] - runs-on: ubuntu-latest - steps: - - name: Download release assets - env: - GH_TOKEN: ${{ secrets.ACTIONS_GITHUB_TOKEN }} - TAG: ${{ inputs.tag }} - run: | - set -euo pipefail - mkdir -p assets - cd assets - gh release download "$TAG" - ls -la - - - name: Recompute and upload checksums (clobber) - env: - GH_TOKEN: ${{ secrets.ACTIONS_GITHUB_TOKEN }} - TAG: ${{ inputs.tag }} - run: | - set -euo pipefail - ver="${TAG#v}" - cd assets - # Only checksum the packaged archives, not the checksum file itself. - rm -f "coinset_${ver}_checksums.txt" - sha256sum *.tar.gz *.zip > "coinset_${ver}_checksums.txt" - cat "coinset_${ver}_checksums.txt" - gh release upload "$TAG" "coinset_${ver}_checksums.txt" --clobber - From 5ef1a8a25d3d469f656812f3a7dc17f5b808e123 Mon Sep 17 00:00:00 2001 From: Cameron Cooper Date: Thu, 5 Mar 2026 18:52:57 -0600 Subject: [PATCH 3/4] add arm64 linux build --- .github/workflows/build-pr.yml | 29 +++++++++++++++--- .github/workflows/release.yml | 45 +++++++++++++++++++++++++++- .goreleaser.linux.arm64.yaml | 50 +++++++++++++++++++++++++++++++ internal/coinsetffi/coinsetffi.go | 1 + 4 files changed, 120 insertions(+), 5 deletions(-) create mode 100644 .goreleaser.linux.arm64.yaml diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml index 753602d..873f656 100644 --- a/.github/workflows/build-pr.yml +++ b/.github/workflows/build-pr.yml @@ -19,6 +19,11 @@ jobs: rust_target: x86_64-unknown-linux-gnu goreleaser_config: .goreleaser.linux.yaml cgo_lib_dir: cgo-lib/x86_64-unknown-linux-gnu + - name: linux-arm64 + os: ubuntu-20.04 + rust_target: aarch64-unknown-linux-gnu + goreleaser_config: .goreleaser.linux.arm64.yaml + cgo_lib_dir: cgo-lib/aarch64-unknown-linux-gnu - name: macos-arm64 os: macos-latest rust_target: aarch64-apple-darwin @@ -61,11 +66,21 @@ jobs: with: targets: ${{ matrix.rust_target }} + - name: Install Linux arm64 cross toolchain + if: runner.os == 'Linux' && matrix.name == 'linux-arm64' + shell: bash + run: | + sudo apt-get update + sudo apt-get install -y gcc-aarch64-linux-gnu + - name: Build libcoinset staticlib shell: bash if: runner.os != 'Windows' run: | if [ "${{ runner.os }}" = "macOS" ]; then export MACOSX_DEPLOYMENT_TARGET=12.0; fi + if [ "${{ matrix.rust_target }}" = "aarch64-unknown-linux-gnu" ]; then + export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc + fi cargo build --release -p coinset-ffi --target "${{ matrix.rust_target }}" mkdir -p "${{ matrix.cgo_lib_dir }}" cp "target/${{ matrix.rust_target }}/release/libcoinset.a" "${{ matrix.cgo_lib_dir }}/" @@ -78,15 +93,21 @@ jobs: New-Item -ItemType Directory -Force -Path "${{ matrix.cgo_lib_dir }}" | Out-Null Copy-Item "target\\${{ matrix.rust_target }}\\release\\libcoinset.a" "${{ matrix.cgo_lib_dir }}\\" - - name: Run GoReleaser (Build linux) - if: runner.os == 'Linux' + - name: Run GoReleaser (Build linux amd64) + if: runner.os == 'Linux' && matrix.name == 'linux-amd64' + uses: goreleaser/goreleaser-action@v5 + with: + distribution: goreleaser + version: ~> v1 + args: build --clean --skip=validate -f ${{ matrix.goreleaser_config }} + + - name: Run GoReleaser (Build linux arm64) + if: runner.os == 'Linux' && matrix.name == 'linux-arm64' uses: goreleaser/goreleaser-action@v5 with: distribution: goreleaser version: ~> v1 args: build --clean --skip=validate -f ${{ matrix.goreleaser_config }} - env: - CGO_LDFLAGS: -L${{ github.workspace }}/${{ matrix.cgo_lib_dir }} - name: Run GoReleaser (Build macOS) if: runner.os == 'macOS' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1b625fa..efbb0f7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -110,7 +110,7 @@ jobs: CGO_LDFLAGS: -L${{ github.workspace }}/cgo-lib/x86_64-unknown-linux-gnu release_macos: - needs: [tag, release_linux] + needs: [tag, release_linux_arm64] runs-on: macos-latest environment: goreleaser steps: @@ -198,3 +198,46 @@ jobs: GITHUB_TOKEN: ${{ secrets.ACTIONS_GITHUB_TOKEN }} CGO_LDFLAGS: -L${{ github.workspace }}/cgo-lib/x86_64-pc-windows-gnu CC: gcc + + release_linux_arm64: + needs: [tag, release_linux] + runs-on: ubuntu-20.04 + environment: goreleaser + steps: + - name: Checkout tag + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ needs.tag.outputs.new_version }} + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: stable + + - name: Install Linux arm64 cross toolchain + run: | + sudo apt-get update + sudo apt-get install -y gcc-aarch64-linux-gnu + + - name: Setup Rust + uses: dtolnay/rust-toolchain@stable + with: + targets: aarch64-unknown-linux-gnu + + - name: Build coinset-inspect staticlib (arm64) + run: | + CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \ + cargo build --release -p coinset-ffi --target aarch64-unknown-linux-gnu + mkdir -p cgo-lib/aarch64-unknown-linux-gnu + cp "target/aarch64-unknown-linux-gnu/release/libcoinset.a" cgo-lib/aarch64-unknown-linux-gnu/ + + - name: Run GoReleaser (linux arm64) + uses: goreleaser/goreleaser-action@v5 + with: + distribution: goreleaser + version: ~> v1 + args: release --clean -f .goreleaser.linux.arm64.yaml + env: + GITHUB_TOKEN: ${{ secrets.ACTIONS_GITHUB_TOKEN }} + CC: aarch64-linux-gnu-gcc diff --git a/.goreleaser.linux.arm64.yaml b/.goreleaser.linux.arm64.yaml new file mode 100644 index 0000000..12feba0 --- /dev/null +++ b/.goreleaser.linux.arm64.yaml @@ -0,0 +1,50 @@ +version: 1 + +project_name: coinset + +before: + hooks: + - go mod tidy + - go generate ./... + +builds: + - id: coinset-linux-arm64 + main: ./cmd/coinset + env: + - CGO_ENABLED=1 + - CC=aarch64-linux-gnu-gcc + goos: + - linux + goarch: + - arm64 + ldflags: + - -s -w -X main.version={{ .Version }} + +archives: + - format: tar.gz + 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 }} + files: + - SKILL.md + +checksum: + name_template: >- + {{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}_checksums.txt + +changelog: + sort: asc + filters: + exclude: + - "^docs:" + - "^test:" + +release: + github: + owner: coinset-org + name: cli + diff --git a/internal/coinsetffi/coinsetffi.go b/internal/coinsetffi/coinsetffi.go index f5174f7..2df55e4 100644 --- a/internal/coinsetffi/coinsetffi.go +++ b/internal/coinsetffi/coinsetffi.go @@ -8,6 +8,7 @@ package coinsetffi #cgo darwin,arm64 LDFLAGS: -L${SRCDIR}/../../cgo-lib/aarch64-apple-darwin #cgo linux,amd64 LDFLAGS: -L${SRCDIR}/../../cgo-lib/x86_64-unknown-linux-gnu +#cgo linux,arm64 LDFLAGS: -L${SRCDIR}/../../cgo-lib/aarch64-unknown-linux-gnu #cgo windows,amd64 LDFLAGS: -L${SRCDIR}/../../cgo-lib/x86_64-pc-windows-gnu #cgo LDFLAGS: -lcoinset #cgo linux LDFLAGS: -lm From 0cd8728a75a6cc24379b9378d27145d8c9f40cbc Mon Sep 17 00:00:00 2001 From: Cameron Cooper Date: Thu, 5 Mar 2026 22:12:24 -0600 Subject: [PATCH 4/4] update workflow --- .github/workflows/release.yml | 152 ++++++++++++++++++++++++++++++++++ .goreleaser.darwin.yaml | 18 ---- 2 files changed, 152 insertions(+), 18 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index efbb0f7..0a17473 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -241,3 +241,155 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.ACTIONS_GITHUB_TOKEN }} CC: aarch64-linux-gnu-gcc + + update_homebrew_tap: + name: Update Homebrew tap + needs: [tag, release_linux, release_linux_arm64, release_macos, release_windows] + runs-on: ubuntu-latest + steps: + - name: Download release archives + shell: bash + env: + GH_TOKEN: ${{ secrets.ACTIONS_GITHUB_TOKEN }} + TAG: ${{ needs.tag.outputs.new_version }} + run: | + set -euo pipefail + mkdir -p assets + gh release download "$TAG" --repo coinset-org/cli -p "coinset_*.tar.gz" -D assets + ls -la assets + + - name: Compute sha256 + id: sha + shell: bash + run: | + set -euo pipefail + shopt -s nullglob + mac=(assets/coinset_Darwin_arm64.tar.gz) + lin_amd=(assets/coinset_Linux_x86_64.tar.gz) + lin_arm=(assets/coinset_Linux_arm64.tar.gz) + + if [ ${#mac[@]} -eq 0 ] || [ ${#lin_amd[@]} -eq 0 ]; then + echo "missing required assets (need Darwin_arm64 + Linux_x86_64)" >&2 + exit 1 + fi + + mac_sha=$(sha256sum "${mac[0]}" | awk '{print $1}') + lin_amd_sha=$(sha256sum "${lin_amd[0]}" | awk '{print $1}') + + echo "mac_sha=$mac_sha" >> "$GITHUB_OUTPUT" + echo "lin_amd_sha=$lin_amd_sha" >> "$GITHUB_OUTPUT" + + if [ ${#lin_arm[@]} -ne 0 ]; then + lin_arm_sha=$(sha256sum "${lin_arm[0]}" | awk '{print $1}') + echo "lin_arm_sha=$lin_arm_sha" >> "$GITHUB_OUTPUT" + fi + + - name: Checkout tap repo + shell: bash + env: + GH_TOKEN: ${{ secrets.ACTIONS_GITHUB_TOKEN }} + run: | + set -euo pipefail + gh repo clone coinset-org/homebrew-cli tap + + - name: Update formula + shell: bash + env: + TAG: ${{ needs.tag.outputs.new_version }} + MAC_SHA: ${{ steps.sha.outputs.mac_sha }} + LINUX_AMD_SHA: ${{ steps.sha.outputs.lin_amd_sha }} + LINUX_ARM_SHA: ${{ steps.sha.outputs.lin_arm_sha }} + run: | + set -euo pipefail + ver="${TAG#v}" + + cd tap + git fetch origin main + git checkout -B main origin/main + cd - + + install_block_mac=' def install + bin.install "coinset" => "coinset" + output = Utils.popen_read("SHELL=bash #{bin}/coinset completion bash") + (bash_completion/"coinset").write output + output = Utils.popen_read("SHELL=zsh #{bin}/coinset completion zsh") + (zsh_completion/"_coinset").write output + prefix.install_metafiles + end' + + install_block_linux=' def install + bin.install "coinset" => "coinset" + output = Utils.popen_read("SHELL=bash #{bin}/coinset completion bash") + (bash_completion/"coinset").write output + output = Utils.popen_read("SHELL=zsh #{bin}/coinset completion zsh") + (zsh_completion/"_coinset").write output + prefix.install_metafiles + end' + + linux_arm_block="" + if [ -n "${LINUX_ARM_SHA:-}" ]; then + linux_arm_block=$(cat < tap/coinset.rb < "coinset" - output = Utils.popen_read("SHELL=bash #{bin}/coinset completion bash") - (bash_completion/"coinset").write output - output = Utils.popen_read("SHELL=zsh #{bin}/coinset completion zsh") - (zsh_completion/"_coinset").write output - prefix.install_metafiles