Skip to content

Commit

Permalink
Merge pull request #355 from tucksaun/feat/darwin-static-arm64
Browse files Browse the repository at this point in the history
feat: Add support for Darwin ARM64 static
  • Loading branch information
lyrixx authored Apr 2, 2024
2 parents fa1a027 + 392d177 commit 66df36d
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 5 deletions.
34 changes: 33 additions & 1 deletion .github/workflows/artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions src/Console/Command/CompileCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')) {
Expand All @@ -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
);
Expand Down

0 comments on commit 66df36d

Please sign in to comment.