Skip to content

fix: Fix linux build with CGO_ENABLED=0#311

Merged
dbolson merged 18 commits into
mainfrom
sc-240122/fix-linux-build
May 31, 2024
Merged

fix: Fix linux build with CGO_ENABLED=0#311
dbolson merged 18 commits into
mainfrom
sc-240122/fix-linux-build

Conversation

@dbolson
Copy link
Copy Markdown
Contributor

@dbolson dbolson commented May 30, 2024

Runs the goreleaser action with the goreleaser.yaml file that has a new builds section.

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions

Related issues

Provide links to any issues in this repository or elsewhere relating to this pull request.

Describe the solution you've provided

Provide a clear and concise description of what you expect to happen.

Describe alternatives you've considered

Provide a clear and concise description of any alternative solutions or features you've considered.

Additional context

Add any other context about the pull request here.

Comment thread .goreleaser.yaml
- amd64
- arm64
env:
- CGO_ENABLED=0
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running the binary in a linux environment would fail if it's built with CGO.

Comment thread .github/actions/publish/action.yml Outdated
with:
version: latest
args: release ${{ inputs.dry-run == 'true' && '--skip=publish' || '' }}
args: release ${{ inputs.dry-run-gh == true && '--skip=publish' || '' }} --config .goreleaser.yaml
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a more granular variable that decides to run the action or not and specifies the config file that says how to build the binary.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no dry-run-gh input defined in this (publish) action

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, as far as I know github actions inputs are strings. This change (removing the '..') means you're casting the value to a bool and it'll always evaluate to true (probably?) if any string is present.

I'd recommend leaving it as an explicit comparison to the value 'true'.

Yea, it's really frustrating.

workflow_dispatch:
inputs:
dry-run:
default: true
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorted these values.

Comment thread .github/workflows/manual-publish.yml Outdated
description: 'Skip publishing to DockerHub and Homebrew'
required: false
type: boolean
dry-run-gh:
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added more granular variables for manual publishing.

@dbolson
Copy link
Copy Markdown
Contributor Author

dbolson commented May 30, 2024

I ran the manual publish workflow and got feedback that the generated linux binary works now.

Comment thread .github/actions/publish/action.yml Outdated
with:
version: latest
args: release ${{ inputs.dry-run == 'true' && '--skip=publish' || '' }}
args: release ${{ inputs.dry-run-gh == true && '--skip=publish' || '' }} --config .goreleaser.yaml
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no dry-run-gh input defined in this (publish) action

Comment thread .github/actions/publish/action.yml Outdated
with:
version: latest
args: release ${{ inputs.dry-run == 'true' && '--skip=publish' || '' }}
args: release ${{ inputs.dry-run-gh == true && '--skip=publish' || '' }} --config .goreleaser.yaml
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, as far as I know github actions inputs are strings. This change (removing the '..') means you're casting the value to a bool and it'll always evaluate to true (probably?) if any string is present.

I'd recommend leaving it as an explicit comparison to the value 'true'.

Yea, it's really frustrating.

Comment thread .github/workflows/manual-publish.yml
Comment thread .github/actions/publish/action.yml
@dbolson dbolson requested a review from cwaldren-ld May 31, 2024 20:11
@dbolson dbolson merged commit 6de74ca into main May 31, 2024
@dbolson dbolson deleted the sc-240122/fix-linux-build branch May 31, 2024 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants