5
5
6
6
jobs :
7
7
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 }}
10
10
strategy :
11
11
fail-fast : false
12
12
matrix :
@@ -15,23 +15,37 @@ jobs:
15
15
- " 8.1"
16
16
- " 8.2"
17
17
- " 8.3"
18
- operating-system :
18
+ runner :
19
19
- " windows-latest"
20
- extensions :
21
- - ctype,fileinfo,mbstring,tokenizer,phar
20
+ combination :
21
+ - spc-min
22
22
23
23
steps :
24
- - name : " OS type"
25
- id : os-type
24
+ - name : " Process env string"
25
+ id : process-env
26
+ shell : bash
26
27
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'
31
45
uses : actions/checkout@v4
32
46
with :
33
47
repository : crazywhalecc/static-php-cli
34
- ref : main
48
+ ref : pre-built-libs
35
49
36
50
- name : " Setup PHP"
37
51
uses : shivammathur/setup-php@v2
@@ -41,44 +55,45 @@ jobs:
41
55
extensions : curl, openssl, mbstring
42
56
ini-values : memory_limit=-1
43
57
44
- - name : " Cache Composer packages"
58
+ - name : " Cache composer packages"
45
59
id : composer-cache
46
- uses : actions/cache@v3
60
+ uses : actions/cache@v4
47
61
with :
48
62
path : vendor
49
63
key : ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
50
64
restore-keys : |
51
- ${{ runner.os }}-php-
65
+ ${{ runner.os }}-php
52
66
53
67
# Cache downloaded source
54
68
- id : cache-download
55
- uses : actions/cache@v3
69
+ uses : actions/cache@v4
56
70
with :
57
71
path : downloads
58
- key : php- ${{ matrix.php-version }}-dependencies
72
+ key : pack-lib-dependencies- ${{ matrix.combination }}-${{ matrix. php-version }}-${{ matrix.runner }}
59
73
60
74
- 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
62
76
63
77
- name : " Validate SPC powershell script"
64
- run : bin/spc --version
78
+ run : ${{ steps.process-env.outputs.CMD }} --version
65
79
66
80
- name : " Run Build Tests (doctor)"
67
- run : bin/spc doctor --auto-fix
81
+ run : ${{ steps.process-env.outputs.CMD }} doctor --auto-fix
68
82
69
83
# If there's no dependencies cache, fetch sources
70
84
- name : " Download sources"
71
- env :
85
+ env :
72
86
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
74
88
75
- - name : " Build extensions: ${{ matrix.extensions }}"
89
+ - name : " Build extensions: ${{ steps.process-env.outputs.EXTENSIONS }}"
76
90
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
80
95
81
- $PHPVER = bin/spc dev:php-ver
96
+ $PHPVER = ${{ steps.process-env.outputs.CMD }} dev:php-ver
82
97
New-Item -ItemType Directory -Force -Path dist
83
98
Compress-Archive -Path "buildroot\bin\php.exe" -DestinationPath "dist\php-$PHPVER-cli-win.zip"
84
99
Compress-Archive -Path "buildroot\bin\micro.sfx" -DestinationPath "dist\php-$PHPVER-micro-win.zip"
92
107
username : ${{ secrets.DEPLOY_SERVER_USER }}
93
108
privateKey : ${{ secrets.DEPLOY_SERVER_SECRET_KEY }}
94
109
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 }}/
96
111
97
112
- name : " Deploy micro to Zhamao Server"
98
113
@@ -102,10 +117,10 @@ jobs:
102
117
username : ${{ secrets.DEPLOY_SERVER_USER }}
103
118
privateKey : ${{ secrets.DEPLOY_SERVER_SECRET_KEY }}
104
119
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 }}/
106
121
107
122
- name : " Upload Artifact"
108
- uses : actions/upload-artifact@v3
123
+ uses : actions/upload-artifact@v4
109
124
with :
110
125
name : php-${{ matrix.php-version }}-windows
111
126
path : |
0 commit comments