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

Move php version default out of action.yml and update inputs #691

Merged

Conversation

stevelacey
Copy link
Contributor

@stevelacey stevelacey commented Jan 29, 2023


name: 🐞 Bug Fix
about: The php version input has a hardcoded default that stops the file input added in #690 from working
labels: bug


A Pull Request should be associated with a Discussion.

If you're fixing a bug, adding a new feature or improving something please provide the details in discussions,
so that the development can be pointed in the intended direction.

Related discussion: #629

Further notes in Contribution Guidelines
Thank you for your contribution.

Description

The php-version input overrides any php-version-file provided, so it can't have a default value anymore, because that means #690 doesn't fallback to the file correctly when no inputs are provided.

Instead of supplying the default via the action.yml I've made it so resolveVersion returns 'latest' instead of raising an error when neither inputs are provided, which maintains backwards compatibility.

In case this PR introduced TypeScript/JavaScript code changes:

  • 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.

In case this PR edits any scripts:

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

@codecov
Copy link

codecov bot commented Jan 29, 2023

Codecov Report

Merging #691 (b46c8e2) into develop (2d47531) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##           develop      #691   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            6         6           
  Lines          554       554           
  Branches        85        85           
=========================================
  Hits           554       554           
Impacted Files Coverage Δ
src/utils.ts 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@stevelacey
Copy link
Contributor Author

stevelacey commented Jan 29, 2023

@shivammathur can this be used in a workflow ahead of you rolling a release? I've tried referencing your develop branch and this branch on my own fork; but I still end up with 8.2 installed (when I have a .php-version specifying 8.1).

I am thinking it's something to do with how run.sh works and that it pulls the code from GitHub releases rather than directly from source? That or my code doesn't work, but I figure it'd at least error now I've removed the default from the yaml.

@shivammathur shivammathur merged commit 686e8df into shivammathur:develop Jan 29, 2023
@shivammathur
Copy link
Owner

@stevelacey Thanks
Merging for now, I will surely test it before I create a release.

@stevelacey stevelacey deleted the php-version-file-inputs branch January 30, 2023 04:10
@stevelacey
Copy link
Contributor Author

@shivammathur I am sure you will 👍🏼 As a separate issue it might be worth documenting how to test/use forks of setup-php, assuming I'm right and it's non-trivial to do so; maybe by adding an input/mechanism for skipping downloading scripts from GitHub releases, which I assume is a performance optimization.

@shivammathur
Copy link
Owner

shivammathur commented Jan 30, 2023

The forks would work the same way as this action with the same input mechanism.

For example, if you update your fork and use the develop branch you can test the changes

- name: Setup PHP
  uses: stevelacey/setup-php@develop
  with:
    php-version-file: phpenv-version # assuming phpenv-version exists.

On ubuntu the following scripts are fetched, they will be fetched when run from the fork also.

  1. PHP 5.3 to 5.5 - These are built in shivammathur/php5-ubuntu
  2. PHP 5.6 to 8.2 - These are cached here in the installed state - shivammathur/php-ubuntu
  3. PHP 8.3 - This is built here - shivammathur/php-builder

These are not performance optimizations, but the source of builds.

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.

None yet

2 participants