Skip to content

Conversation

@Sn0wCrack
Copy link
Contributor


name: Allow Setting Tool Path Directory
about: Allow providing a custom path for PHP tools to be downloaded and managed from
labels: enhancement


A Pull Request should be associated with a Discussion.

Related discussion: #876

Description

In this PR, I allow passing through the tools_path_dir value into the scripts.

My main motivation for this is self-hosted runners. A big issue I've been running into is the composer binary download lock file never being cleared or the composer binary being overwritten while it is in use by another user.

My real main use case for this is setting the tools directory to $HOME/.local/bin, to allow the binary to be installed per-user, rather than globally to the system and overwritten every time by each runner user.

Additionally I added a .node-version file to match the Node version in the action.yml file.

I was unclear on how to write tests for this particular feature, as I can't see any for the fail-fast option which basically does the same thing here.

If they need to be written for this case, then please let me know how they might actually need to be implemented or some example test cases that are similar I can base it off.

  • I have written test cases for the changes in this pull request

  • I have run npm run format before the commit.

  • I have run npm run lint before the commit.

  • I have run npm run release before the commit.

  • npm test returns with no unit test errors and all code covered.

  • I have checked the edited scripts for syntax.

  • I have tested the changes in an integration test (If yes, provide workflow YAML and link).

Test Workflow and Repository: https://github.com/Sn0wCrack/setup-php-multi-runner-users-reproduction/blob/main/.github/workflows/deployment.yml

also add a .node-version file
@Sn0wCrack Sn0wCrack mentioned this pull request Apr 7, 2025
7 tasks
@codecov
Copy link

codecov bot commented Apr 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (42a9487) to head (e61a03f).
Report is 4 commits behind head on develop.

Additional details and impacted files
@@            Coverage Diff            @@
##           develop      #937   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            7         7           
  Lines          811       811           
  Branches       293       293           
=========================================
  Hits           811       811           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@shivammathur
Copy link
Owner

@Sn0wCrack

I would prefer to keep TOOLS_DIR as an env, and not add it as an input, and then refactor the scripts to use it.

Also, please edit read_env function in unix.sh to export the tools_dir env.

@Sn0wCrack
Copy link
Contributor Author

I've changed this to now read from an environment variable in the read_env function now.

Test run of this change can be seen here: https://github.com/Sn0wCrack/setup-php-multi-runner-users-reproduction/actions/runs/14302395645/job/40078991570

@shivammathur shivammathur merged commit ed16796 into shivammathur:develop Apr 7, 2025
81 checks passed
@shivammathur
Copy link
Owner

@Sn0wCrack Looks like the env name TOOLS_DIR was a mistake as it can lead to regressions in the workflows like #943. I would like to change the env name to SETUP_PHP_TOOLS_DIR in the next release and document this in the README.

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