Example: Add complete workflow configuration example (multi-platform build: windows darwin linux)

Open
#11 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Stale
Tech stack
github-actions, go

Research direction

Start with the gorelease.yaml configuration in the issue and the ./cmd/desktop/main.go entry point; inspect how the repository's GitHub Actions workflow invokes the GoReleaser action. Add a complete workflow example covering Windows, macOS, and Linux, then verify that the cross-platform build no longer fails because the compiler is missing.

Written by the indexing model from the issue text.

Description

The current example only has the. gorelease.yaml part, and there is no corresponding workflow configuration. When I compile mac, it will prompt that the compiler does not exist.

Here is the build config I'm using:

  - id: desktop
    binary: golang-cross
    env:
      - CGO_ENABLED=1
      - >-
        {{- if eq .Os "darwin" }}
          {{- if eq .Arch "amd64"}}CC=o64-clang{{- end }}
          {{- if eq .Arch "arm64"}}CC=aarch64-apple-darwin20.2-clang{{- end }}
        {{- end }}
        {{- if eq .Os "windows" }}
          {{- if eq .Arch "amd64" }}CC=x86_64-w64-mingw32-gcc{{- end }}
          {{- if eq .Arch "arm64" }}CC=/llvm-mingw/bin/aarch64-w64-mingw32-gcc{{- end }}          
          {{- if eq .Arch "386" }}CC=i686-w64-mingw32-gcc{{- end }}
        {{- end }}
      - >-
        {{- if eq .Os "darwin" }}
          {{- if eq .Arch "amd64"}}CXX=o64-clang++{{- end }}
          {{- if eq .Arch "arm64"}}CX=clang++{{- end }}
        {{- end }}
        {{- if eq .Os "windows" }}
          {{- if eq .Arch "amd64" }}CXX=x86_64-w64-mingw32-g++{{- end }}
          {{- if eq .Arch "arm64" }}CXX=/llvm-mingw/bin/aarch64-w64-mingw32-g++{{- end }}          
          {{- if eq .Arch "386" }}CXX=i686-w64-mingw32-g++{{- end }}
        {{- end }}
    goos:
      - darwin
      - windows
    main: ./cmd/desktop/main.go

The error log is as follows:

  ⨯ release failed after 2m35s              
    error=
    │ build failed: exit status 1: # runtime/cgo
    │ cgo: C compiler "o64-clang" not found: exec: "o64-clang": executable file not found in $PATH
    target=darwin_amd64_v1
Error: The process '/opt/hostedtoolcache/goreleaser-action/2.8.2/x64/goreleaser' failed with exit code 1
Dominant language
Go
Stars
43
Forks
8
Avg merge
1h 29m
Merged PRs (30d)
1

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.