Upgrade actions/upload-artifact to v8 in build and test workflows

This commit is contained in:
crazywhalecc
2026-04-13 12:27:52 +08:00
parent 4413529d83
commit e22e615ba4
4 changed files with 200 additions and 200 deletions

View File

@@ -276,7 +276,7 @@ jobs:
# Upload debug logs # Upload debug logs
- if: ${{ inputs.debug && failure() }} - if: ${{ inputs.debug && failure() }}
name: "Upload build logs on failure" name: "Upload build logs on failure"
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v8
with: with:
name: spc-logs-${{ inputs.php-version }}-${{ inputs.os }} name: spc-logs-${{ inputs.php-version }}-${{ inputs.os }}
path: log/*.log path: log/*.log
@@ -284,7 +284,7 @@ jobs:
# Upload cli executable # Upload cli executable
- if: ${{ inputs.build-cli == true }} - if: ${{ inputs.build-cli == true }}
name: "Upload PHP cli SAPI" name: "Upload PHP cli SAPI"
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v8
with: with:
name: php-cli-${{ inputs.php-version }}-${{ inputs.os }} name: php-cli-${{ inputs.php-version }}-${{ inputs.os }}
path: buildroot/bin/php path: buildroot/bin/php
@@ -292,7 +292,7 @@ jobs:
# Upload micro self-extracted executable # Upload micro self-extracted executable
- if: ${{ inputs.build-micro == true }} - if: ${{ inputs.build-micro == true }}
name: "Upload PHP micro SAPI" name: "Upload PHP micro SAPI"
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v8
with: with:
name: php-micro-${{ inputs.php-version }}-${{ inputs.os }} name: php-micro-${{ inputs.php-version }}-${{ inputs.os }}
path: buildroot/bin/micro.sfx path: buildroot/bin/micro.sfx
@@ -300,7 +300,7 @@ jobs:
# Upload fpm executable # Upload fpm executable
- if: ${{ inputs.build-fpm == true }} - if: ${{ inputs.build-fpm == true }}
name: "Upload PHP fpm SAPI" name: "Upload PHP fpm SAPI"
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v8
with: with:
name: php-fpm-${{ inputs.php-version }}-${{ inputs.os }} name: php-fpm-${{ inputs.php-version }}-${{ inputs.os }}
path: buildroot/bin/php-fpm path: buildroot/bin/php-fpm
@@ -308,7 +308,7 @@ jobs:
# Upload frankenphp executable # Upload frankenphp executable
- if: ${{ inputs['build-frankenphp'] == true }} - if: ${{ inputs['build-frankenphp'] == true }}
name: "Upload FrankenPHP SAPI" name: "Upload FrankenPHP SAPI"
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v8
with: with:
name: php-frankenphp-${{ inputs.php-version }}-${{ inputs.os }} name: php-frankenphp-${{ inputs.php-version }}-${{ inputs.os }}
path: buildroot/bin/frankenphp path: buildroot/bin/frankenphp
@@ -316,17 +316,17 @@ jobs:
# Upload extensions metadata # Upload extensions metadata
- if: ${{ inputs['shared-extensions'] != '' }} - if: ${{ inputs['shared-extensions'] != '' }}
name: "Upload shared extensions" name: "Upload shared extensions"
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v8
with: with:
name: php-shared-ext-${{ inputs.php-version }}-${{ inputs.os }} name: php-shared-ext-${{ inputs.php-version }}-${{ inputs.os }}
path: | path: |
buildroot/modules/*.so buildroot/modules/*.so
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v8
name: "Upload License Files" name: "Upload License Files"
with: with:
name: license-files-${{ inputs.php-version }}-${{ inputs.os }} name: license-files-${{ inputs.php-version }}-${{ inputs.os }}
path: buildroot/license/ path: buildroot/license/
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v8
name: "Upload Build Metadata" name: "Upload Build Metadata"
with: with:
name: build-meta-${{ inputs.php-version }}-${{ inputs.os }} name: build-meta-${{ inputs.php-version }}-${{ inputs.os }}

View File

@@ -94,24 +94,24 @@ jobs:
# Upload cli executable # Upload cli executable
- if: ${{ inputs.build-cli == true }} - if: ${{ inputs.build-cli == true }}
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v8
with: with:
name: php-${{ inputs.version }} name: php-${{ inputs.version }}
path: buildroot/bin/php.exe path: buildroot/bin/php.exe
# Upload micro self-extracted executable # Upload micro self-extracted executable
- if: ${{ inputs.build-micro == true }} - if: ${{ inputs.build-micro == true }}
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v8
with: with:
name: micro-${{ inputs.version }} name: micro-${{ inputs.version }}
path: buildroot/bin/micro.sfx path: buildroot/bin/micro.sfx
# Upload extensions metadata # Upload extensions metadata
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v8
with: with:
name: license-files name: license-files
path: buildroot/license/ path: buildroot/license/
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v8
with: with:
name: build-meta name: build-meta
path: | path: |

View File

@@ -1,187 +1,187 @@
name: Build SPC Binary name: Build SPC Binary
on: on:
push: push:
branches: [ "main", "v3" ] branches: [ "main", "v3" ]
pull_request: pull_request:
branches: [ "main", "v3" ] branches: [ "main", "v3" ]
paths: paths:
- '.github/workflows/release-build.yml' - '.github/workflows/release-build.yml'
release: release:
types: types:
- published - published
workflow_dispatch: workflow_dispatch:
env: env:
PHP_VERSION: 8.4 PHP_VERSION: 8.4
MICRO_VERSION: 8.4.11 MICRO_VERSION: 8.4.11
jobs: jobs:
build-release-artifacts: build-release-artifacts:
name: "Build SPC Binary for ${{ matrix.operating-system.name }}" name: "Build SPC Binary for ${{ matrix.operating-system.name }}"
runs-on: ${{ matrix.operating-system.os }} runs-on: ${{ matrix.operating-system.os }}
strategy: strategy:
matrix: matrix:
operating-system: operating-system:
- name: "linux-x86_64" - name: "linux-x86_64"
os: "ubuntu-latest" os: "ubuntu-latest"
filename: "spc-linux-x86_64.tar.gz" filename: "spc-linux-x86_64.tar.gz"
- name: "macos-x86_64" - name: "macos-x86_64"
os: "macos-15-intel" os: "macos-15-intel"
filename: "spc-macos-x86_64.tar.gz" filename: "spc-macos-x86_64.tar.gz"
- name: "linux-aarch64" - name: "linux-aarch64"
os: "ubuntu-latest" os: "ubuntu-latest"
filename: "spc-linux-aarch64.tar.gz" filename: "spc-linux-aarch64.tar.gz"
- name: "macos-aarch64" - name: "macos-aarch64"
os: "macos-14" os: "macos-14"
filename: "spc-macos-aarch64.tar.gz" filename: "spc-macos-aarch64.tar.gz"
- name: "windows-x64" - name: "windows-x64"
os: "ubuntu-latest" os: "ubuntu-latest"
filename: "spc-windows-x64.exe" filename: "spc-windows-x64.exe"
steps: steps:
- name: "Checkout" - name: "Checkout"
uses: "actions/checkout@v5" uses: "actions/checkout@v5"
- if: inputs.debug == true - if: inputs.debug == true
run: echo "SPC_BUILD_DEBUG=--debug" >> $GITHUB_ENV run: echo "SPC_BUILD_DEBUG=--debug" >> $GITHUB_ENV
- name: "Install PHP for official runners" - name: "Install PHP for official runners"
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
coverage: none coverage: none
tools: composer:v2 tools: composer:v2
php-version: "${{ env.PHP_VERSION }}" php-version: "${{ env.PHP_VERSION }}"
ini-values: memory_limit=-1 ini-values: memory_limit=-1
extensions: curl, openssl, mbstring extensions: curl, openssl, mbstring
- name: "Get Composer Cache Directory" - name: "Get Composer Cache Directory"
id: composer-cache id: composer-cache
run: | run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: "Cache Composer dependencies" - name: "Cache Composer dependencies"
uses: "actions/cache@v5" uses: "actions/cache@v5"
with: with:
path: "${{ steps.composer-cache.outputs.dir }}" path: "${{ steps.composer-cache.outputs.dir }}"
key: "php-${{ env.PHP_VERSION }}-locked-composer-${{ hashFiles('**/composer.lock') }}" key: "php-${{ env.PHP_VERSION }}-locked-composer-${{ hashFiles('**/composer.lock') }}"
restore-keys: | restore-keys: |
php-${{ env.PHP_VERSION }}-locked-composer php-${{ env.PHP_VERSION }}-locked-composer
- name: "Install Locked Dependencies" - name: "Install Locked Dependencies"
run: "composer install --no-interaction --no-progress" run: "composer install --no-interaction --no-progress"
- name: "Build PHAR File" - name: "Build PHAR File"
run: "composer build:phar" run: "composer build:phar"
- name: "Download Minimal Combination" - name: "Download Minimal Combination"
run: | run: |
if [ "${{ matrix.operating-system.name }}" = "windows-x64" ]; then if [ "${{ matrix.operating-system.name }}" = "windows-x64" ]; then
curl -fsSL https://dl.static-php.dev/static-php-cli/windows/spc-min/php-${{ env.MICRO_VERSION }}-micro-win.zip -o tmp.zip curl -fsSL https://dl.static-php.dev/static-php-cli/windows/spc-min/php-${{ env.MICRO_VERSION }}-micro-win.zip -o tmp.zip
unzip tmp.zip unzip tmp.zip
else else
curl -fsSL https://dl.static-php.dev/static-php-cli/minimal/php-${{ env.MICRO_VERSION }}-micro-${{ matrix.operating-system.name }}.tar.gz -o tmp.tgz curl -fsSL https://dl.static-php.dev/static-php-cli/minimal/php-${{ env.MICRO_VERSION }}-micro-${{ matrix.operating-system.name }}.tar.gz -o tmp.tgz
tar -zxvf tmp.tgz tar -zxvf tmp.tgz
fi fi
- name: "Generate Executable" - name: "Generate Executable"
run: | run: |
bin/spc micro:combine spc.phar -M micro.sfx -O spc -I "memory_limit=2G" bin/spc micro:combine spc.phar -M micro.sfx -O spc -I "memory_limit=2G"
if [ "${{ matrix.operating-system.name }}" = "windows-x64" ]; then if [ "${{ matrix.operating-system.name }}" = "windows-x64" ]; then
mv spc spc.exe mv spc spc.exe
else else
chmod +x spc chmod +x spc
fi fi
if [ "${{ matrix.operating-system.name }}" = "macos-aarch64" ] || [ "${{ matrix.operating-system.name }}" = "macos-x86_64" ]; then if [ "${{ matrix.operating-system.name }}" = "macos-aarch64" ] || [ "${{ matrix.operating-system.name }}" = "macos-x86_64" ]; then
sudo xattr -cr ./spc sudo xattr -cr ./spc
fi fi
- name: "Archive Executable and Validate Binary" - name: "Archive Executable and Validate Binary"
run: | run: |
if [ "${{ matrix.operating-system.name }}" != "windows-x64" ]; then if [ "${{ matrix.operating-system.name }}" != "windows-x64" ]; then
tar -czf ${{ matrix.operating-system.filename }} spc tar -czf ${{ matrix.operating-system.filename }} spc
# validate spc binary # validate spc binary
if [ "${{ matrix.operating-system.name }}" == "linux-x86_64" ]; then if [ "${{ matrix.operating-system.name }}" == "linux-x86_64" ]; then
./spc dev:info php ./spc dev:info php
fi fi
fi fi
- name: "Copy file" - name: "Copy file"
run: | run: |
if [ "${{ matrix.operating-system.name }}" != "windows-x64" ]; then if [ "${{ matrix.operating-system.name }}" != "windows-x64" ]; then
mkdir dist/ && cp ${{ matrix.operating-system.filename }} dist/ && cp spc dist/spc-${{ matrix.operating-system.name }} mkdir dist/ && cp ${{ matrix.operating-system.filename }} dist/ && cp spc dist/spc-${{ matrix.operating-system.name }}
else else
mkdir dist/ && cp spc.exe dist/${{ matrix.operating-system.filename }} mkdir dist/ && cp spc.exe dist/${{ matrix.operating-system.filename }}
echo "SUFFIX=.exe" >> $GITHUB_ENV echo "SUFFIX=.exe" >> $GITHUB_ENV
fi fi
- name: "Upload Binaries to Release" - name: "Upload Binaries to Release"
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
if: ${{startsWith(github.ref, 'refs/tags/') }} if: ${{startsWith(github.ref, 'refs/tags/') }}
with: with:
files: dist/${{ matrix.operating-system.filename }} files: dist/${{ matrix.operating-system.filename }}
- name: "Deploy to self-hosted OSS (latest)" - name: "Deploy to self-hosted OSS (latest)"
# only run this step if the repository is static-php-cli and is release tag # only run this step if the repository is static-php-cli and is release tag
if: ${{ github.repository == 'crazywhalecc/static-php-cli' && startsWith(github.ref, 'refs/tags/') }} if: ${{ github.repository == 'crazywhalecc/static-php-cli' && startsWith(github.ref, 'refs/tags/') }}
uses: static-php/upload-s3-action@v1.0.0 uses: static-php/upload-s3-action@v1.0.0
with: with:
aws_key_id: ${{ secrets.AWS_KEY_ID }} aws_key_id: ${{ secrets.AWS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_bucket: ${{ secrets.AWS_BUCKET }} aws_bucket: ${{ secrets.AWS_BUCKET }}
source_dir: "dist/" source_dir: "dist/"
destination_dir: v3/spc-bin/latest/ destination_dir: v3/spc-bin/latest/
endpoint: ${{ secrets.AWS_ENDPOINT }} endpoint: ${{ secrets.AWS_ENDPOINT }}
- name: "Deploy to self-hosted OSS (versioned)" - name: "Deploy to self-hosted OSS (versioned)"
# only run this step if the repository is static-php-cli and is release tag # only run this step if the repository is static-php-cli and is release tag
if: ${{ github.repository == 'crazywhalecc/static-php-cli' && startsWith(github.ref, 'refs/tags/') }} if: ${{ github.repository == 'crazywhalecc/static-php-cli' && startsWith(github.ref, 'refs/tags/') }}
uses: static-php/upload-s3-action@v1.0.0 uses: static-php/upload-s3-action@v1.0.0
with: with:
aws_key_id: ${{ secrets.AWS_KEY_ID }} aws_key_id: ${{ secrets.AWS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_bucket: ${{ secrets.AWS_BUCKET }} aws_bucket: ${{ secrets.AWS_BUCKET }}
source_dir: "dist/" source_dir: "dist/"
destination_dir: v3/spc-bin/${{ github.ref_name }}/ destination_dir: v3/spc-bin/${{ github.ref_name }}/
endpoint: ${{ secrets.AWS_ENDPOINT }} endpoint: ${{ secrets.AWS_ENDPOINT }}
- name: "Upload Artifact" - name: "Upload Artifact"
uses: actions/upload-artifact@v5 uses: actions/upload-artifact@v8
with: with:
path: spc${{ env.SUFFIX }} path: spc${{ env.SUFFIX }}
name: spc-${{ matrix.operating-system.name }}${{ env.SUFFIX }} name: spc-${{ matrix.operating-system.name }}${{ env.SUFFIX }}
test-spc: test-spc:
name: "Test SPC Binary for ${{ matrix.operating-system.name }}" name: "Test SPC Binary for ${{ matrix.operating-system.name }}"
runs-on: ${{ matrix.operating-system.os }} runs-on: ${{ matrix.operating-system.os }}
needs: [build-release-artifacts] needs: [build-release-artifacts]
strategy: strategy:
matrix: matrix:
operating-system: operating-system:
- name: "linux-x86_64" - name: "linux-x86_64"
os: "ubuntu-latest" os: "ubuntu-latest"
- name: "macos-x86_64" - name: "macos-x86_64"
os: "macos-15-intel" os: "macos-15-intel"
- name: "linux-aarch64" - name: "linux-aarch64"
os: "ubuntu-24.04-arm" os: "ubuntu-24.04-arm"
- name: "macos-aarch64" - name: "macos-aarch64"
os: "macos-15" os: "macos-15"
- name: "windows-x64" - name: "windows-x64"
os: "windows-latest" os: "windows-latest"
steps: steps:
- name: "Checkout" - name: "Checkout"
uses: actions/checkout@v5 uses: actions/checkout@v5
- name: "Download Artifact" - name: "Download Artifact"
uses: actions/download-artifact@v5 uses: actions/download-artifact@v5
env: env:
SUFFIX: ${{ matrix.operating-system.name == 'windows-x64' && '.exe' || '' }} SUFFIX: ${{ matrix.operating-system.name == 'windows-x64' && '.exe' || '' }}
with: with:
name: spc-${{ matrix.operating-system.name }}${{ env.SUFFIX }} name: spc-${{ matrix.operating-system.name }}${{ env.SUFFIX }}
- name: "Chmod" - name: "Chmod"
if: matrix.operating-system.name != 'windows-x64' if: matrix.operating-system.name != 'windows-x64'
run: chmod +x spc run: chmod +x spc
- name: "Run SPC Tests" - name: "Run SPC Tests"
env: env:
SUFFIX: ${{ matrix.operating-system.name == 'windows-x64' && '.exe' || '' }} SUFFIX: ${{ matrix.operating-system.name == 'windows-x64' && '.exe' || '' }}
run: ./spc${{ env.SUFFIX }} dev:info php run: ./spc${{ env.SUFFIX }} dev:info php

View File

@@ -206,7 +206,7 @@ jobs:
- name: "Upload logs" - name: "Upload logs"
if: ${{ always() && hashFiles('log/**') != '' }} if: ${{ always() && hashFiles('log/**') != '' }}
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v8
with: with:
name: build-logs-${{ matrix.os }}-${{ matrix.php }} name: build-logs-${{ matrix.os }}-${{ matrix.php }}
path: log path: log