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

Add Linux support #3

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 39 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Release
on: push

jobs:
build:
build-macos:
runs-on: macos-latest
steps:
- name: Checkout
Expand All @@ -20,21 +20,48 @@ jobs:

- name: Build
run: |
curl -OL "https://github.com/box-project/box/releases/latest/download/box.phar"
mv box.phar box

php box compile
mkdir -p ./build
mv index.phar ./build/

cd build || exit
curl -OL https://dl.static-php.dev/static-php-cli/common/php-8.3.6-micro-macos-aarch64.tar.gz -C -
tar -xvf php-8.3.6-micro-macos-aarch64.tar.gz
cat ./micro.sfx ./index.phar > ./phpup && chmod 0755 ./phpup
brew tap box-project/box
brew install box
./build.sh

- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
build/phpup

build-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
tools: composer:v2

- name: Install PHP deps
uses: ramsey/composer-install@v2
run:
wget -O phive.phar "https://phar.io/releases/phive.phar"
wget -O phive.phar.asc "https://phar.io/releases/phive.phar.asc"
gpg --keyserver hkps://keys.openpgp.org --recv-keys 0x6AF725270AB81E04D79442549D8A98B29B2D5D79
gpg --verify phive.phar.asc phive.phar
rm phive.phar.asc
chmod +x phive.phar
mv phive.phar /usr/local/bin/phive
phive install humbug/box

- name: Build
run: |
./build.sh

- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
build/phpup
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ You don't need to have PHP or anything at all on your system to run it.

> [!WARNING]
> **Under heavy development**
> Currently, this is an MVP, and only macOS aarch64 is supported.
> Currently, this is an MVP, and only macOS and linux are supported.

## Installation

Expand All @@ -29,6 +29,13 @@ sudo mv phpup /usr/local/bin/phpup
- `phpup rector` – Rector that does not require PHP. 🚧
- `phpup locus` – Installs PHP binary under your project's `vendor/bin/php` based on the requirements in _composer.json_.

## Building
### Build requirements

* https://github.com/box-project/box
* PHP 8.3
* Composer

## Contributing

Contributions are very welcome! However, it's recommended to first create an issue describing the idea — let's find the best approach together.
Expand All @@ -54,7 +61,7 @@ See some ideas in the todo list below.
- [ ] Bypass cli SAPI name checks
- [ ] static_opcache
- [ ] Support parallel run for Rector
- [ ] Support Linux
- [ ] Support Linux 🚧

## Credits

Expand Down
18 changes: 16 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@ mkdir -p ./build
mv index.phar ./build/

cd build || exit
curl -O https://dl.static-php.dev/static-php-cli/common/php-8.3.6-micro-macos-aarch64.tar.gz -C -
tar -xvf php-8.3.4-micro-macos-aarch64.tar.gz

if ! command -v uname &> /dev/null
then
OS="OS"
else
OS=`uname -a|awk '{print $1}'`
arch=`uname -m|awk '{print $1}'`
fi

case $OS in
"Darwin" ) curl -o php "https://dl.static-php.dev/static-php-cli/common/php-8.3.6-micro-macos-${arch}.tar.gz" -C -;;
"Linux" ) curl -o php "https://dl.static-php.dev/static-php-cli/common/php-8.3.6-micro-linux-${arch}.tar.gz" -C -;;
* ) echo "${OS} is not supported"
exit ;;
esac
tar -xvf php
cat ./micro.sfx ./index.phar > ./phpup && chmod 0755 ./phpup