diff --git a/.github/workflows/artifacts.yml b/.github/workflows/artifacts.yml index 479a0383..65804dfd 100644 --- a/.github/workflows/artifacts.yml +++ b/.github/workflows/artifacts.yml @@ -121,10 +121,41 @@ jobs: path: ./castor.darwin-amd64 if-no-files-found: error + static-darwin-arm64: + needs: phars + name: Create MacOs arm64 static binary and upload + runs-on: macos-14 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - uses: ./.github/actions/install + + - uses: ./.github/actions/cache + with: + os: 'darwin' + + - name: retrieve phar artifacts + uses: actions/download-artifact@v4 + with: + path: tools/phar/build + merge-multiple: true + + - uses: ./.github/actions/static + with: + os: 'darwin-arm64' + + - name: Upload the MacOs arm64 static binary + uses: actions/upload-artifact@v4 + with: + name: 'castor.darwin-arm64' + path: ./castor.darwin-arm64 + if-no-files-found: error + release: name: Upload artifacts to the release if: github.event_name == 'release' - needs: [phars, static-linux-amd64, static-darwin-amd64] + needs: [phars, static-linux-amd64, static-darwin-amd64, static-darwin-arm64] runs-on: ubuntu-latest steps: - name: Checkout @@ -140,6 +171,7 @@ jobs: run: | gh release upload ${{ github.ref_name }} ./build/castor.darwin-amd64 gh release upload ${{ github.ref_name }} ./build/castor.darwin-amd64.phar + gh release upload ${{ github.ref_name }} ./build/castor.darwin-arm64 gh release upload ${{ github.ref_name }} ./build/castor.darwin-arm64.phar gh release upload ${{ github.ref_name }} ./build/castor.linux-amd64 gh release upload ${{ github.ref_name }} ./build/castor.linux-amd64.phar diff --git a/CHANGELOG.md b/CHANGELOG.md index 90dee60c..b451bdb5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,10 @@ ## Not released yet -* Add support for running Castor on Linux ARM64 +* Distribute static binaries `castor.darwin-arm64` automatically with the + release +* Add support for running Castor on Linux arm64 and distribute the binary + `castor.linux-arm64.phar` automatically with the release * Add a bash installer to ease installation * Add a option `ignoreValidationErrors` on `AsTask` attribute to ignore parameters & options validation errors diff --git a/src/Console/Command/CompileCommand.php b/src/Console/Command/CompileCommand.php index c0f60689..48df44c0 100644 --- a/src/Console/Command/CompileCommand.php +++ b/src/Console/Command/CompileCommand.php @@ -58,12 +58,15 @@ protected function execute(InputInterface $input, OutputInterface $output): int $spcBinaryPath = PlatformHelper::getCacheDirectory() . '/castor-php-static-compiler/' . $phpBuildCacheKey . '/spc'; $spcBinaryDir = \dirname($spcBinaryPath); + $os = $input->getOption('os'); + $arch = $input->getOption('arch'); + $this->setupSPC( $spcBinaryDir, $spcBinaryPath, $io, - $input->getOption('os'), - $input->getOption('arch'), + $os, + $arch, ); if (!$this->fs->exists($spcBinaryDir . '/buildroot/bin/micro.sfx') || $input->getOption('php-rebuild')) { @@ -82,7 +85,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->buildPHP( $spcBinaryPath, $phpExtensions, - $input->getOption('arch'), + ('macos' === $os && 'aarch64' === $arch) ? 'arm64' : $arch, $spcBinaryDir, $io );