reuse static-php-cli-hosted workflows

This commit is contained in:
crazywhalecc 2023-10-05 21:58:42 +08:00
parent 92cafb36f6
commit fbe149bcac
No known key found for this signature in database
GPG Key ID: 1F4BDD59391F2680

View File

@ -1,4 +1,4 @@
name: Build Release Artifacts name: Upload SPC Binary (Release)
on: on:
release: release:
@ -8,71 +8,31 @@ on:
jobs: jobs:
build-release-artifacts: build-release-artifacts:
name: "Build Release Artifacts" name: "Upload SPC Binary (Release)"
runs-on: ${{ matrix.operating-system }} runs-on: ubuntu-latest
strategy: strategy:
fail-fast: false
matrix: matrix:
php-version:
- "8.1"
operating-system: operating-system:
- "ubuntu-latest" - "linux-x86_64"
- "macos-latest" - "macos-x86_64"
- "linux-aarch64"
- "macos-aarch64"
steps: steps:
- name: "Checkout" - name: "Checkout"
uses: "actions/checkout@v4" uses: "actions/checkout@v4"
- name: "Install PHP" - name: Reuse static-php-cli-hosted artifacts
uses: "shivammathur/setup-php@v2" uses: dawidd6/action-download-artifact@v2
with: with:
coverage: none repo: crazywhalecc/static-php-cli-hosted
tools: composer:v2 branch: master
php-version: "${{ matrix.php-version }}" workflow: build-spc-release.yml
ini-values: memory_limit=-1 name: "spc-${{ matrix.operating-system }}"
- name: "Get Composer Cache Directory"
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: "Cache Composer dependencies"
uses: "actions/cache@v3"
with:
path: "${{ steps.composer-cache.outputs.dir }}"
key: "php-${{ matrix.php-version }}-locked-composer-${{ hashFiles('**/composer.lock') }}"
restore-keys: |
php-${{ matrix.php-version }}-locked-composer-
- name: "Install locked dependencies"
run: "composer install --no-interaction --no-progress"
- name: "Download sources"
run: bin/spc download --with-php=${{ matrix.php-version }} php-src,micro,pkg-config,onig,zlib
- name: "Build phpmicro"
run: |
SPC_USE_SUDO=yes bin/spc doctor --auto-fix
bin/spc build pcntl,posix,mbstring,tokenizer,phar --build-micro
- name: "Build PHAR file"
run: "composer build:phar"
- name: "Generate Executable"
run: "bin/spc micro:combine spc.phar -O spc"
- name: "Archive Executable" - name: "Archive Executable"
run: | run: |
OS="" tar -czf spc-${{ matrix.operating-system }}.tar.gz spc
if [ "${{ matrix.operating-system }}" = "ubuntu-latest" ]; then echo "filename=spc-${{ matrix.operating-system }}.tar.gz" >> $GITHUB_ENV
OS="linux-x86_64"
elif [ "${{ matrix.operating-system }}" = "macos-latest" ]; then
OS="macos-x86_64"
fi
tar -czf spc-$OS.tar.gz spc
echo "filename=spc-$OS.tar.gz" >> $GITHUB_ENV
echo "OS=$OS" >> $GITHUB_ENV
- name: "Test Micro file"
run: "./spc dev:extensions"
- name: upload binaries to release - name: upload binaries to release
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
@ -84,4 +44,4 @@ jobs:
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
path: spc path: spc
name: spc-${{ env.OS }} name: spc-${{ matrix.operating-system }}