55
66jobs :
77 build-release-artifacts :
8- name : " Build ${{ matrix.php-version }} on ${{ matrix.operating-system }}"
9- runs-on : ${{ matrix.operating-system }}
8+ name : " Build ${{ matrix.php-version }}-${{ matrix.combination }} on ${{ matrix.runner }}"
9+ runs-on : ${{ matrix.runner }}
1010 strategy :
1111 fail-fast : false
1212 matrix :
@@ -15,23 +15,37 @@ jobs:
1515 - " 8.1"
1616 - " 8.2"
1717 - " 8.3"
18- operating-system :
18+ runner :
1919 - " windows-latest"
20- extensions :
21- - ctype,fileinfo,mbstring,tokenizer,phar
20+ combination :
21+ - spc-min
2222
2323 steps :
24- - name : " OS type"
25- id : os-type
24+ - name : " Process env string"
25+ id : process-env
26+ shell : bash
2627 run : |
27- $OS = "windows-x86_64"
28- Add-Content -Path $env:GITHUB_ENV -Value "OS=$OS"
29-
30- - name : " Checkout static-php-cli"
28+ case "${{ matrix.combination }}" in
29+ spc-min)
30+ echo "EXTENSIONS=ctype,fileinfo,mbstring,tokenizer,phar" >> "$GITHUB_OUTPUT"
31+ echo "DEPLOY_TARGET=${{ secrets.DEPLOY_SERVER_TARGET_WINDOWS_SPC_MIN }}" >> "$GITHUB_OUTPUT"
32+ ;;
33+ esac
34+
35+ case "${{ matrix.runner }}" in
36+ windows-latest)
37+ echo "OS=windows" >> "$GITHUB_OUTPUT"
38+ echo "ARCH=x86_64" >> "$GITHUB_OUTPUT"
39+ echo "CMD=bin/spc" >> "$GITHUB_OUTPUT"
40+ ;;
41+ esac
42+
43+ - name : " Checkout remote"
44+ if : github.repository != 'crazywhalecc/static-php-cli'
3145 uses : actions/checkout@v4
3246 with :
3347 repository : crazywhalecc/static-php-cli
34- ref : main
48+ ref : pre-built-libs
3549
3650 - name : " Setup PHP"
3751 uses : shivammathur/setup-php@v2
@@ -41,44 +55,45 @@ jobs:
4155 extensions : curl, openssl, mbstring
4256 ini-values : memory_limit=-1
4357
44- - name : " Cache Composer packages"
58+ - name : " Cache composer packages"
4559 id : composer-cache
46- uses : actions/cache@v3
60+ uses : actions/cache@v4
4761 with :
4862 path : vendor
4963 key : ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
5064 restore-keys : |
51- ${{ runner.os }}-php-
65+ ${{ runner.os }}-php
5266
5367 # Cache downloaded source
5468 - id : cache-download
55- uses : actions/cache@v3
69+ uses : actions/cache@v4
5670 with :
5771 path : downloads
58- key : php- ${{ matrix.php-version }}-dependencies
72+ key : pack-lib-dependencies- ${{ matrix.combination }}-${{ matrix. php-version }}-${{ matrix.runner }}
5973
6074 - name : " Install Dependencies"
61- run : composer update -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
75+ run : composer update -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist --no-dev
6276
6377 - name : " Validate SPC powershell script"
64- run : bin/spc --version
78+ run : ${{ steps.process-env.outputs.CMD }} --version
6579
6680 - name : " Run Build Tests (doctor)"
67- run : bin/spc doctor --auto-fix
81+ run : ${{ steps.process-env.outputs.CMD }} doctor --auto-fix
6882
6983 # If there's no dependencies cache, fetch sources
7084 - name : " Download sources"
71- env :
85+ env :
7286 GITHUB_TOKEN : ${{ secrets.S_GITHUB_TOKEN }}
73- run : bin/spc download --with-php=${{ matrix.php-version }} --for-extensions="${{ matrix.extensions }}"
87+ run : ${{ steps.process-env.outputs.CMD }} download --with-php=${{ matrix.php-version }} --for-extensions="${{ steps.process-env.outputs.EXTENSIONS }}" --retry=5 --prefer-pre-built
7488
75- - name : " Build extensions: ${{ matrix.extensions }}"
89+ - name : " Build extensions: ${{ steps.process-env.outputs.EXTENSIONS }}"
7690 run : |
77- bin/spc doctor --auto-fix
78- bin/spc install-pkg upx
79- bin/spc build --build-cli --build-micro "${{ matrix.extensions }}" --debug --with-upx-pack
91+ ${{ steps.process-env.outputs.CMD }} doctor --auto-fix
92+ ${{ steps.process-env.outputs.CMD }} install-pkg upx
93+
94+ ${{ steps.process-env.outputs.CMD }} build --build-cli --build-micro "${{ matrix.extensions }}" --debug --with-upx-pack
8095
81- $PHPVER = bin/spc dev:php-ver
96+ $PHPVER = ${{ steps.process-env.outputs.CMD }} dev:php-ver
8297 New-Item -ItemType Directory -Force -Path dist
8398 Compress-Archive -Path "buildroot\bin\php.exe" -DestinationPath "dist\php-$PHPVER-cli-win.zip"
8499 Compress-Archive -Path "buildroot\bin\micro.sfx" -DestinationPath "dist\php-$PHPVER-micro-win.zip"
92107 username : ${{ secrets.DEPLOY_SERVER_USER }}
93108 privateKey : ${{ secrets.DEPLOY_SERVER_SECRET_KEY }}
94109 localPath : " dist/php-${{ env.PHPVER }}-cli-win.zip"
95- remotePath : ${{ secrets.DEPLOY_SERVER_TARGET_WINDOWS_SPC_MIN }}/
110+ remotePath : ${{ steps.process-env.outputs.DEPLOY_TARGET }}/
96111
97112 - name : " Deploy micro to Zhamao Server"
98113 uses : Creepios/sftp-action@v1.0.5
@@ -102,10 +117,10 @@ jobs:
102117 username : ${{ secrets.DEPLOY_SERVER_USER }}
103118 privateKey : ${{ secrets.DEPLOY_SERVER_SECRET_KEY }}
104119 localPath : " dist/php-${{ env.PHPVER }}-micro-win.zip"
105- remotePath : ${{ secrets.DEPLOY_SERVER_TARGET_WINDOWS_SPC_MIN }}/
120+ remotePath : ${{ steps.process-env.outputs.DEPLOY_TARGET }}/
106121
107122 - name : " Upload Artifact"
108- uses : actions/upload-artifact@v3
123+ uses : actions/upload-artifact@v4
109124 with :
110125 name : php-${{ matrix.php-version }}-windows
111126 path : |
0 commit comments