forked from swoole/swoole-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
190 lines (166 loc) · 6.94 KB
/
windows-cygwin.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
name: build-php-cli-windows-cygwin
on:
push:
pull_request:
env:
BUILD_PHP_VERSION: 8.2.27
jobs:
windows-cygwin:
if: 0
runs-on: windows-2022
strategy:
matrix:
php-version:
- "8.2.27"
- "8.1.31"
- "8.3.15"
- "8.4.2"
steps:
- name: Show Environment Info
shell: cmd
run: |
ver
wmic cpu get name, caption, maxclockspeed, status
systeminfo
systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
systeminfo | findstr /B /C:"Manufacturer" /C:"Product" /C:"Version"
set
ipconfig
uname -a
pwd
ipconfig /all
- name: Prepare git
run: |
git config --global core.autocrlf false
git config --global core.eol lf
git config --global core.ignorecase false
- uses: actions/checkout@v4
- name: set php version
# 参考文档: https://docs.github.com/zh/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell
shell: bash
run: |
echo "BUILD_PHP_VERSION=${{ matrix.php-version }}" >> $GITHUB_ENV
- name: Prepare submodule
run: |
ipconfig /all
# git submodule update --init
- name: Cache cygwin packages
id: cache-cygwin
uses: actions/cache@v4
env:
cache-name: cache-cygwin-packages
with:
path: C:\cygwin-packages
key: "${{ runner.os }}-build-${{ env.cache-name }}"
- name: Cache pool
id: cache-cygwin-pool
uses: actions/cache@v4
with:
path: "${{ github.workspace }}\\pool\\"
key: "${{ runner.os }}-build-pool-cache"
- name: Install Cygwin
uses: cygwin/cygwin-install-action@v2
with:
site: https://mirrors.kernel.org/sourceware/cygwin/
# with:
# platform: x64
# packages: make wget tar libtool re2c bison gcc-g++ autoconf automake openssl libpcre2-devel libssl-devel libcurl-devel libxml2-devel libxslt-devel libgmp-devel ImageMagick libpng-devel libjpeg-devel libfreetype-devel libwebp-devel libsqlite3-devel zlib-devel libbz2-devel liblz4-devel liblzma-devel libzip-devel libicu-devel libonig-devel libcares-devel libsodium-devel libyaml-devel libMagick-devel libzstd-devel libbrotli-devel libreadline-devel libintl-devel libpq-devel libssh2-devel libidn2-devel gettext-devel coreutils openssl-devel zip unzip
- name: Install Cygwin Packages with bash
if: 0
shell: C:\cygwin\bin\bash.EXE --noprofile --norc -e -o pipefail -o igncr {0}
run: |
ls -lah /cygdrive/c/
ls -lah /cygdrive/d/
cp -f /cygdrive/c/setup.exe /cygdrive/c/cygwin/bin/setup-x86_64.exe
bash ./sapi/scripts/cygwin/install-cygwin.sh
- name: Install Cygwin Packages
if: 1
run: |
Copy-Item -Path "C:\setup.exe" -Destination "${{ github.workspace }}\setup-x86_64.exe"
cmd /c .\sapi\quickstart\windows\cygwin-build\install-cygwin.bat
- name: Install re2c
shell: C:\cygwin\bin\bash.EXE --noprofile --norc -e -o pipefail -o igncr {0}
run: |
bash ./sapi/scripts/cygwin/install-re2c.sh
- name: Configure
shell: C:\cygwin\bin\bash.EXE --noprofile --norc -e -o pipefail -o igncr {0}
run: |
# git config --global --add safe.directory /cygdrive/d/a/swoole-cli/swoole-cli
# git submodule update --init
bash ./sapi/scripts/cygwin/cygwin-config-ext.sh --php-version ${{ env.BUILD_PHP_VERSION }}
- name: Configure
shell: C:\cygwin\bin\bash.EXE --noprofile --norc -e -o pipefail -o igncr {0}
run: |
bash ./sapi/scripts/cygwin/cygwin-config.sh --php-version ${{ env.BUILD_PHP_VERSION }}
- name: Build
shell: C:\cygwin\bin\bash.EXE --noprofile --norc -e -o pipefail -o igncr {0}
run: |
bash ./sapi/scripts/cygwin/cygwin-build.sh
- name: Show Build Result
run: |
./bin/php.exe -v
./bin/php.exe -m
./bin/php.exe --ri mongodb
./bin/php.exe --ri gd
./bin/php.exe --ri swoole
./bin/php.exe -r "echo PHP_VERSION;"
- name: get app version with bash
# 参考 https://github.com/marketplace/actions/install-cygwin
shell: C:\cygwin\bin\bash.EXE --noprofile --norc -e -o pipefail -o igncr {0}
# shell: C:\cygwin\bin\bash.EXE --login --noprofile --norc -e -o pipefail -o igncr {0}
run: |
./bin/php.exe -v | awk '{print $2}'
APP_VERSION=$(./bin/php.exe -v | head -n 1 | awk '{print $2}')
echo $APP_VERSION
echo "APP_VERSION=${APP_VERSION}" >> $GITHUB_ENV
- name: get app version with PowerShell
run: |
./bin/php.exe -v
$cmdOutput=./bin/php.exe -v
$cmdOutput=$cmdOutput | select -first 1
$cmdOutput -match "(\d{1,2}\.\d{1,2}\.\d{1,2})"
$CYGWIN_APP_VERSION=$Matches[1]
echo $CYGWIN_APP_VERSION
echo "CYGWIN_APP_VERSION=$CYGWIN_APP_VERSION" >> $Env:GITHUB_ENV
# 参考 https://github.com/orgs/community/discussions/26641
# echo "APP_VERSION=${APP_VERSION}" >> $Env:GITHUB_ENV
# echo "APP_VERSION=$APP_VERSION" | Out-File -FilePath $env:GITHUB_ENV -Append
# Add-Content -Path $env:GITHUB_ENV -Value "name=$value"
# Add-Content -Path $env:GITHUB_ENV -Value "APP_VERSION=$APP_VERSION"
- name: Archive
run: |
bash ./sapi/scripts/cygwin/cygwin-archive.sh
- name: production artifacts
uses: actions/upload-artifact@v4
with:
name: php-cli-v${{ env.APP_VERSION }}-cygwin-x64
retention-days: 90
path: php-cli-v${{ env.APP_VERSION }}-cygwin-x64.zip
- name: gh release
uses: softprops/action-gh-release@v2
if: ${{ startsWith(github.ref, 'refs/tags/') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: php-cli-v${{ env.APP_VERSION }}-cygwin-x64.zip
upload-to-cloud-object-storage:
if: 0
runs-on: ubuntu-latest
needs: windows-cygwin
steps:
- name: Prepare Run Environment
run:
sudo apt install -y curl
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- name: upload artifacts to cloud object storage
if: ${{ 0 && (github.repository == 'swoole/swoole-cli') && (startsWith(github.ref, 'refs/tags/')) }}
env:
OSS_SECRET_ID: ${{ secrets.QCLOUD_OSS_SECRET_ID }}
OSS_SECRET_KEY: ${{ secrets.QCLOUD_OSS_SECRET_KEY }}
OSS_BUCKET: ${{ vars.QCLOUD_OSS_BUCKET }}
OSS_REGION: ${{ vars.QCLOUD_OSS_REGION }}
run: |
FILE_NAME=$(ls -d swoole-cli-v*-cygwin-x64)
FILE="${{ github.workspace }}/${FILE_NAME}/${FILE_NAME}.zip"
bash sapi/scripts/tencent-cloud-object-storage.sh --upload-file ${FILE}