forked from static-php/hosted
-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (96 loc) · 4.58 KB
/
build-php.yml
File metadata and controls
108 lines (96 loc) · 4.58 KB
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
name: Build Self-Hosted PHP Binary
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:
jobs:
build-release-artifacts:
name: "Build ${{ matrix.php-version }} on ${{ matrix.operating-system }}"
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
php-version:
- "7.3"
operating-system:
- "ubuntu-latest"
- "macos-latest"
- "debian-arm64-self-hosted"
- "macos-arm64-self-hosted"
extensions:
- bcmath,bz2,calendar,ctype,curl,dom,exif,fileinfo,filter,ftp,gd,gmp,iconv,xml,mbstring,mbregex,mysqlnd,openssl,pcntl,pdo,pdo_mysql,pdo_sqlite,phar,posix,redis,session,simplexml,soap,sockets,sqlite3,tokenizer,xmlwriter,xmlreader,zlib,zip
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
- name: OS type
id: os-type
run: |
OS=""
if [ "${{ matrix.operating-system }}" = "ubuntu-latest" ]; then
OS="linux-x86_64"
elif [ "${{ matrix.operating-system }}" = "macos-latest" ]; then
OS="macos-x86_64"
elif [ "${{ matrix.operating-system }}" = "debian-arm64-self-hosted" ]; then
OS="linux-aarch64"
elif [ "${{ matrix.operating-system }}" = "macos-arm64-self-hosted" ]; then
OS="macos-aarch64"
fi
echo "OS=$OS" >> $GITHUB_ENV
- if: ${{ matrix.operating-system == 'macos-latest' || matrix.operating-system == 'ubuntu-latest' }}
name: Download SPC bin artifact for GitHub-hosted runners
uses: dawidd6/action-download-artifact@v2
with:
repo: crazywhalecc/static-php-cli
branch: main
workflow: release-build.yml
name: "spc-${{ env.OS }}"
- if: ${{ matrix.operating-system == 'debian-arm64-self-hosted' || matrix.operating-system == 'macos-arm64-self-hosted' }}
name: Download SPC bin artifact for self-hosted runners
uses: dawidd6/action-download-artifact@v2
with:
repo: crazywhalecc/static-php-cli-hosted
branch: master
workflow: build-arm-macos-release.yml
name: "spc-${{ env.OS }}"
- name: Validate SPC bin
run: |
chmod +x spc
./spc --version
- id: cache-download
uses: actions/cache@v3
with:
path: downloads
key: php-${{ matrix.php-version }}-dependencies
# If there's no dependencies cache, fetch sources
- if: steps.cache-download.outputs.cache-hit != 'true'
name: "Download sources"
run: ./spc download --with-php=${{ matrix.php-version }} --all
- name: "Build library: ${{ matrix.library }}"
run: |
SPC_USE_SUDO=yes ./spc doctor --auto-fix
./spc build --build-cli --build-micro --build-fpm ${{ matrix.extensions }} --debug
PHPVER=$(cat source/php-src/main/php_version.h | grep "PHP_VERSION " | awk -F\" '{print $2}')
mkdir dist/
tar -czf dist/php-$PHPVER-cli-$OS.tar.gz -C buildroot/bin/ php
tar -czf dist/php-$PHPVER-micro-$OS.tar.gz -C buildroot/bin/ micro.sfx
tar -czf dist/php-$PHPVER-fpm-$OS.tar.gz -C buildroot/bin/ php-fpm
- name: Deploy to Zhamao Server
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_SERVER_SECRET_KEY }}
ARGS: "-rltgoDzvO"
SOURCE: "dist/"
REMOTE_HOST: ${{ secrets.DEPLOY_SERVER_HOST }}
REMOTE_PORT: ${{ secrets.DEPLOY_SERVER_PORT }}
REMOTE_USER: ${{ secrets.DEPLOY_SERVER_USER }}
TARGET: ${{ secrets.DEPLOY_SERVER_TARGET }}
- name: "Upload Artifact"
uses: actions/upload-artifact@v3
with:
name: php-${{ matrix.php-version }}-${{ env.OS }}
path: |
buildroot/bin/php
buildroot/bin/php-fpm
buildroot/bin/micro.sfx
if-no-files-found: error