From faa2e66aa63e6ce9c2ab6c69d93b2a876d1a7206 Mon Sep 17 00:00:00 2001 From: Antoine Grondin Date: Tue, 29 Oct 2024 00:58:11 +0900 Subject: [PATCH] wip trying crossplatform compilation --- .github/workflows/release-dev.yml | 7 ++- .goreleaser-dev.yaml | 100 +++++++++++++++++++++++++++++- 2 files changed, 102 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release-dev.yml b/.github/workflows/release-dev.yml index e8e359d..20b4b7b 100644 --- a/.github/workflows/release-dev.yml +++ b/.github/workflows/release-dev.yml @@ -13,6 +13,8 @@ jobs: create_a_dev_release: name: create a dev release runs-on: ubuntu-latest + container: + image: ghcr.io/goreleaser/goreleaser-cross:v1.23.2 env: GOPRIVATE: "github.com/humanlogio/humanlog-pro" GH_ACCESS_TOKEN_FOR_HUMANLOGPRO: ${{ secrets.GH_ACCESS_TOKEN_FOR_HUMANLOGPRO }} @@ -20,19 +22,20 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 + - run: git config --global --add safe.directory '*' + - run: git config --global url.https://$GH_ACCESS_TOKEN_FOR_HUMANLOGPRO@github.com/.insteadOf https://github.com/ - run: git fetch --force --tags - uses: actions/setup-go@v3 with: go-version: ">=1.23" cache: true - - run: git config --global url.https://$GH_ACCESS_TOKEN_FOR_HUMANLOGPRO@github.com/.insteadOf https://github.com/ - run: echo "${HOME}/.humanlog/bin" >> $GITHUB_PATH - run: curl https://humanlog.dev/install_apictl.sh | bash - uses: goreleaser/goreleaser-action@v6 with: distribution: goreleaser version: v2 - args: release --clean --draft --skip validate --config .goreleaser-dev.yaml + args: release --verbose --clean --draft --skip validate --config .goreleaser-dev.yaml env: GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }} AWS_ACCESS_KEY_ID: ${{ secrets.S3_BINARIES_BUCKET_KEY_ID }} diff --git a/.goreleaser-dev.yaml b/.goreleaser-dev.yaml index aa96acc..20864a5 100644 --- a/.goreleaser-dev.yaml +++ b/.goreleaser-dev.yaml @@ -6,20 +6,114 @@ before: - go generate ./... - mkdir -p dist-extra - script/write_version_info.sh "{{.Major}}" "{{.Minor}}" "{{.Patch}}" "next.{{ .CommitTimestamp }}" "{{.ShortCommit}}" "https://humanlog-binaries.sfo3.cdn.digitaloceanspaces.com/humanlog-binaries/{{ .ProjectName }}/dev/{{ .CommitTimestamp }}/{{ .ShortCommit }}" +# builds: +# - main: ./cmd/humanlog/ +# binary: humanlog +# env: +# - CGO_ENABLED=1 +# tags: +# - pro +# ldflags: +# - -s -w -X main.versionMajor={{.Major}} -X main.versionMinor={{.Minor}} -X main.versionPatch={{.Patch}} -X main.versionPrerelease=next.{{ .CommitTimestamp }} -X main.versionBuild={{.ShortCommit}} -X main.defaultApiAddr=https://api.humanlog.dev -X main.defaultBaseSiteAddr=https://humanlog.dev +# goos: +# # - windows +# - darwin +# - linux +# goarch: +# - amd64 +# - arm64 + builds: - - main: ./cmd/humanlog/ + - id: humanlog-darwin-amd64 binary: humanlog + main: ./cmd/humanlog + tags: + - pro + goarch: + - amd64 + goos: + - darwin env: - CGO_ENABLED=1 + - CC=o64-clang + - CXX=o64-clang++ + flags: + - -trimpath ldflags: - -s -w -X main.versionMajor={{.Major}} -X main.versionMinor={{.Minor}} -X main.versionPatch={{.Patch}} -X main.versionPrerelease=next.{{ .CommitTimestamp }} -X main.versionBuild={{.ShortCommit}} -X main.defaultApiAddr=https://api.humanlog.dev -X main.defaultBaseSiteAddr=https://humanlog.dev + + - id: humanlog-darwin-arm64 + binary: humanlog + main: ./cmd/humanlog + tags: + - pro + goarch: + - arm64 goos: - # - windows - darwin - - linux + env: + - CGO_ENABLED=1 + - CC=oa64-clang + - CXX=oa64-clang++ + flags: + - -trimpath + ldflags: + - -s -w -X main.versionMajor={{.Major}} -X main.versionMinor={{.Minor}} -X main.versionPatch={{.Patch}} -X main.versionPrerelease=next.{{ .CommitTimestamp }} -X main.versionBuild={{.ShortCommit}} -X main.defaultApiAddr=https://api.humanlog.dev -X main.defaultBaseSiteAddr=https://humanlog.dev + + - id: humanlog-linux-amd64 + binary: humanlog + main: ./cmd/humanlog + tags: + - pro + env: + - CGO_ENABLED=1 + - CC=x86_64-linux-gnu-gcc + - CXX=x86_64-linux-gnu-g++ goarch: - amd64 + goos: + - linux + flags: + - -trimpath + ldflags: + - -extldflags "-lc -lrt -lpthread --static" -s -w -X main.versionMajor={{.Major}} -X main.versionMinor={{.Minor}} -X main.versionPatch={{.Patch}} -X main.versionPrerelease=next.{{ .CommitTimestamp }} -X main.versionBuild={{.ShortCommit}} -X main.defaultApiAddr=https://api.humanlog.dev -X main.defaultBaseSiteAddr=https://humanlog.dev + + - id: humanlog-linux-arm64 + binary: humanlog + main: ./cmd/humanlog + tags: + - pro + goarch: - arm64 + goos: + - linux + env: + - CGO_ENABLED=1 + - CC=aarch64-linux-gnu-gcc + - CXX=aarch64-linux-gnu-g++ + flags: + - -trimpath + ldflags: + - -extldflags "-lc -lrt -lpthread --static" -s -w -X main.versionMajor={{.Major}} -X main.versionMinor={{.Minor}} -X main.versionPatch={{.Patch}} -X main.versionPrerelease=next.{{ .CommitTimestamp }} -X main.versionBuild={{.ShortCommit}} -X main.defaultApiAddr=https://api.humanlog.dev -X main.defaultBaseSiteAddr=https://humanlog.dev + + # - id: humanlog-windows-amd64 + # binary: humanlog + # main: ./cmd/humanlog + # tags: + # - pro + # goarch: + # - amd64 + # goos: + # - windows + # env: + # - CC=x86_64-w64-mingw32-gcc + # - CXX=x86_64-w64-mingw32-g++ + # flags: + # - -trimpath + # - -buildmode=exe + # ldflags: + # - -s -w -X main.versionMajor={{.Major}} -X main.versionMinor={{.Minor}} -X main.versionPatch={{.Patch}} -X main.versionPrerelease=next.{{ .CommitTimestamp }} -X main.versionBuild={{.ShortCommit}} -X main.defaultApiAddr=https://api.humanlog.dev -X main.defaultBaseSiteAddr=https://humanlog.dev + release: disable: true blobs: