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

Better build action #58

Merged
merged 5 commits into from
Mar 6, 2024
Merged
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
32 changes: 21 additions & 11 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
path: build/automate.phar

static-binary:
name: Build static binary ${{ matrix.os }} ${{ matrix.arch }}
name: Build static binary ${{ matrix.filename }}
if: github.event_name == 'release'
needs: [ phar ]
strategy:
Expand All @@ -54,13 +54,18 @@ jobs:
# Linux amd64
- runs_on: ubuntu-latest
spc_binary: https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-x86_64
os: linux
arch: amd64
build_options: --build-micro --with-upx-pack
filename: automate-linux-amd64
# MacOS amd64
- runs_on: macos-latest
spc_binary: https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-x86_64
os: darwin
arch: amd64
build_options: --build-micro
filename: automate-darwin-amd64
# MacOS arm64
- runs_on: macos-14
spc_binary: https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-aarch64
build_options: --build-micro
filename: automate-darwin-arm64

runs-on: ${{ matrix.runs_on }}
steps:
Expand All @@ -86,20 +91,25 @@ jobs:
run: |
bin/spc doctor --auto-fix

- name: Install UPX package
if: ${{ contains(matrix.build_options, 'upx') }}
run: |
bin/spc install-pkg upx

- name: Build static binary
run: |
bin/spc download --for-extensions="dom,gmp,openssl,phar,sodium,xml,xmlwriter"
bin/spc build "dom,gmp,openssl,phar,sodium,xml,xmlwriter" --build-micro
bin/spc micro:combine build/automate.phar --output build/automate-${{ matrix.os }}-${{ matrix.arch }}
bin/spc download --for-extensions="dom,gmp,openssl,phar,sodium,xml,xmlwriter" --with-php=8.3
bin/spc build "dom,gmp,openssl,phar,sodium,xml,xmlwriter" ${{ matrix.build_options }}
bin/spc micro:combine build/automate.phar --output build/${{ matrix.filename }}

- name: Ensure the static binary works
run: build/automate-${{ matrix.os }}-${{ matrix.arch }} --version
run: build/${{ matrix.filename }} --version

- uses: actions/upload-artifact@v4
name: Upload the static binary artifact
with:
name: automate-${{ matrix.os }}-${{ matrix.arch }}
path: build/automate-${{ matrix.os }}-${{ matrix.arch }}
name: ${{ matrix.filename }}
path: build/${{ matrix.filename }}

release:
name: Upload artifacts to the release
Expand Down