Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix linux build with CGO_ENABLED=0 #311

Merged
merged 18 commits into from
May 31, 2024
Merged

Conversation

dbolson
Copy link
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.

- amd64
- arm64
env:
- CGO_ENABLED=0
Copy link
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.

@@ -36,7 +36,7 @@ runs:
uses: goreleaser/goreleaser-action@v5
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
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
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
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.

@@ -3,14 +3,24 @@ on:
workflow_dispatch:
inputs:
dry-run:
default: true
Copy link
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.

type: boolean
dry-run-gh:
Copy link
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
Contributor Author

dbolson commented May 30, 2024

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

@@ -36,7 +36,7 @@ runs:
uses: goreleaser/goreleaser-action@v5
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
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

@@ -36,7 +36,7 @@ runs:
uses: goreleaser/goreleaser-action@v5
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
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.

.github/workflows/manual-publish.yml Show resolved Hide resolved
@dbolson dbolson requested a review from cwaldren-ld May 31, 2024 20:11
@dbolson dbolson merged commit 6de74ca into main May 31, 2024
2 checks passed
@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