shivammathur / setup-php

GitHub action to set up PHP with extensions, php.ini configuration, coverage drivers, and various tools.
https://setup-php.com
MIT License
2.93k stars 345 forks source link

Add support for arm64 Linux and Windows GitHub hosted runners #848

Open LorenzoRogai opened 5 months ago

LorenzoRogai commented 5 months ago

Github released arm64 hosted runners

https://github.blog/changelog/2024-06-03-actions-arm-based-linux-and-windows-runners-are-now-in-public-beta

The install process goes slow then fails with this error

/home/runner/work/_actions/shivammathur/setup-php/v2/src/scripts/../scripts/tools/add_tools.sh: line 31: /usr/bin/php: cannot execute binary file: Exec format error
shivammathur commented 5 months ago

Those are not supported by the action currently.

I will try to add support in future, but no promises until it only supports large runners.

LorenzoRogai commented 5 months ago

Thank you for your response. They are configurable inside large runners section instead of a fixed default GitHub runs-on tag but already available to all customers on Team/Enterprise plans. Considering that these runners also cost 0.005€ instead of 0.008€ i think that many ppl will switch to them

LorenzoRogai commented 3 months ago

@shivammathur are there any guide on how to implement a new runs-on platform? so i can help by submitting a PR

shivammathur commented 3 months ago

@LorenzoRogai It would require adding support for arm builds here https://github.com/shivammathur/php-builder for linux. On Windows php does not support arm as of now as there are no arm builds, so I'm not sure, will have to test if existing x64 builds work on Windows.

EionRobb commented 2 months ago

arm64 images have come out of public beta and are now in general availability https://github.blog/changelog/2024-09-03-github-actions-arm64-linux-and-windows-runners-are-now-generally-available/

We get a little further on our arm64 build (adding for googleibility):

Run shivammathur/setup-php@v2
/usr/bin/bash /home/runner/work/_actions/shivammathur/setup-php/v2/src/scripts/run.sh
==> Setup PHP
✓ PHP Installed PHP 8.2.21
==> Setup Extensions
/home/runner/work/_actions/shivammathur/setup-php/v2/src/scripts/../scripts/extensions/add_extensions.sh: line 13: /usr/bin/php: cannot execute binary file: Exec format error
/home/runner/work/_actions/shivammathur/setup-php/v2/src/scripts/../scripts/extensions/add_extensions.sh: line 16: /usr/bin/php: cannot execute binary file: Exec format error
/home/runner/work/_actions/shivammathur/setup-php/v2/src/scripts/../scripts/extensions/add_extensions.sh: line 16: /usr/bin/php: cannot execute binary file: Exec format error
Error: The operation was canceled.
j-fulbright commented 2 months ago

Following up here, as we'd like to move to support them as well

LorenzoRogai commented 2 months ago

At the end we just changed the workflow to use ppa:ondrej/php, if you have a simple PHP setup you can do this way. It worked fine anyway

ihor-sviziev commented 1 month ago

@LorenzoRogai, chould you please share an example of how you did it?

LorenzoRogai commented 1 month ago

@ihor-sviziev

Simply

- name: Add PHP PPA
  run: sudo add-apt-repository ppa:ondrej/php
- name: Install PHP
  run: |
    sudo apt install \
    php$(cat .php-version) \
    php$(cat .php-version)-simplexml \
    php$(cat .php-version)-curl \
    php$(cat .php-version)-dom \
    php$(cat .php-version)-xml \
    php$(cat .php-version)-bcmath \
    php$(cat .php-version)-zip \
    php$(cat .php-version)-intl
SanderMuller commented 2 days ago

This issue is also keeping us from using ARM in github actions