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

ISSUE-220: do not use npx for action validator, use binaries #676

Conversation

beto-aveiga
Copy link
Collaborator

@beto-aveiga beto-aveiga commented Sep 2, 2024

Uses binaries instead of NPX. See #220

@github-actions github-actions bot temporarily deployed to pantheon-pr-676 September 2, 2024 15:37 Destroyed
@beto-aveiga beto-aveiga marked this pull request as ready for review September 2, 2024 15:55
@deviantintegral
Copy link
Member

I wonder if we should instead install the binary at the same time as all the other binaries we download. It feels a bit odd to be doing this dynamically in a task?

@deviantintegral
Copy link
Member

Actually, it looks like we already install the binary, so we just have to call vendor/bin/action-validator instead?

@beto-aveiga
Copy link
Collaborator Author

@deviantintegral : for the change I made, we are running the else part of this line

if [ -f ./vendor/bin/action-validator ]; then

So, I think there is no action-validator binary at that moment. Am I right?

tasks/github.yml Outdated
Comment on lines 21 to 28
find $directories -type f \( -iname '*.yaml' -o -iname '*.yml' \) | xargs -n1 npx @action-validator/cli
yamls=$(find $directories -type f \( -iname '*.yaml' -o -iname '*.yml' \))
action_validator_url_base="https://github.com/mpalmer/action-validator/releases/download/v0.6.0/action-validator_"
action_validator_bin_path="/usr/local/bin/action-validator"
[ "$(arch)" = "x86_64" ] && bin_name="linux_amd64"
[ "$(arch)" = "aarch64" ] && bin_name="linux_arm64"
curl -Lo $action_validator_bin_path "$action_validator_url_base$bin_name" || true
chmod +x $action_validator_bin_path
echo $yamls | xargs -n1 $action_validator_bin_path
Copy link
Member

Choose a reason for hiding this comment

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

What do you think about moving the binary install work to https://github.com/Lullabot/drainpipe/blob/main/drainpipe-dev/src/DevBinaryInstallerPlugin.php ? Then it would be available in vendor/bin/action-validator like other apps we download.

@github-actions github-actions bot temporarily deployed to pantheon-pr-676 September 6, 2024 17:54 Destroyed
@beto-aveiga
Copy link
Collaborator Author

These two files are very similar.
Do we need a refactor here?

For instance, if we update the action validator version in one place, it should be the same version in the other binary installer.
We don't need the same binaries, but we need to keep in sync with the versions we are downloading.

@beto-aveiga
Copy link
Collaborator Author

@deviantintegral, this is ready for review again. Thanks!

Copy link
Member

@mrdavidburns mrdavidburns left a comment

Choose a reason for hiding this comment

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

LGTM! Would like us to get a second approval before merging.

@deviantintegral
Copy link
Member

@beto-aveiga the DevBinaryInstaller only triggers if you're installing drainpipe-dev, which should be in require-dev. Those packages don't get installed when you do composer install --no-dev. So, I think we should move the actions validator binary to the DevBinaryInstaller class.

@beto-aveiga
Copy link
Collaborator Author

@deviantintegral, we already have action-validator in that class:

'action-validator' => [
'releases' => [
'linux' => [
'amd64' => ['url' => 'https://github.com/mpalmer/action-validator/releases/download/v0.6.0/action-validator_linux_amd64', 'sha' => 'fa61521913ee4cf5de7e4d5b803741b2c60ebde447ee38e2b71abbd213d3354a'],
'arm64' => ['url' => 'https://github.com/mpalmer/action-validator/releases/download/v0.6.0/action-validator_linux_arm64', 'sha' => '38a582690ab7e64ba33b4c29eaf16979ed116d4daf40fde39ec18992c475c0b1'],
],
'darwin' => [
'amd64' => ['url' => 'https://github.com/mpalmer/action-validator/releases/download/v0.6.0/action-validator_darwin_amd64', 'sha' => '10f453ad4ed011eb3866bd35c25311bd2fe1fbf353cbe64793115de2348f8ddb'],
'arm64' => ['url' => 'https://github.com/mpalmer/action-validator/releases/download/v0.6.0/action-validator_darwin_arm64', 'sha' => '68e09e0793cf958daf0aebe69fb2bf858232fb9c4f74f913dab02db67d32224d'],
],
],

@beto-aveiga
Copy link
Collaborator Author

@deviantintegral removing action-validator from src/BinaryInstallerPlugin.php is causing an error on the first test.

@deviantintegral
Copy link
Member

The failure makes sense - the test job isn't installing drainpipe-dev. Let's see if this fixes it.

@github-actions github-actions bot temporarily deployed to pantheon-pr-676 September 12, 2024 20:06 Destroyed
…px-action-validator-cli-is-really-slow-compared-to-calling-the-binary-directly--2
@github-actions github-actions bot temporarily deployed to pantheon-pr-676 September 12, 2024 20:52 Destroyed
@deviantintegral
Copy link
Member

e20e351 is a great case study in why objects are better than arrays! The actions validator was nested in the wrong section in a way that was not obvious at all.

The tugboat failure looks to be something new, because #688 was passing and then I rebuilt it and got the same failure here. perhaps it has to do with something merged recently, but I think it's more likely that there's a problem due to us doing some trickery to move the .tugboat directory around.

@justafish justafish merged commit fc52958 into main Sep 23, 2024
53 checks passed
@justafish justafish deleted the issue-220-npx-action-validator-cli-is-really-slow-compared-to-calling-the-binary-directly--2 branch September 23, 2024 13:16
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.

npx @action-validator/cli is really slow compared to calling the binary directly
4 participants