1
+ name : ' Build PHP'
2
+ on :
3
+ push :
4
+ pull_request :
5
+ repository_dispatch :
6
+ schedule :
7
+ - cron : ' 30 23 * * *'
8
+ jobs :
9
+ build :
10
+ runs-on : windows-latest
11
+ strategy :
12
+ fail-fast : false
13
+ matrix :
14
+ include :
15
+ - arch : x64
16
+ target : obj-x64
17
+ config : nts-windows-vs16-x64
18
+ - arch : x64
19
+ target : obj-x64
20
+ config : ts-windows-vs16-x64
21
+ - arch : x64
22
+ target : obj-x64
23
+ config : nts-windows-vs16-x64-avx
24
+ - arch : x86
25
+ target : obj
26
+ config : nts-windows-vs16-x86
27
+ - arch : x86
28
+ target : obj
29
+ config : ts-windows-vs16-x86
30
+ name : Build PHP
31
+ steps :
32
+ - name : Checkout
33
+ uses : actions/checkout@v2
34
+ - name : Install PHP
35
+ uses : shivammathur/setup-php@develop
36
+ with :
37
+ php-version : 7.4
38
+ ini-values : disable_functions=mail
39
+ - name : Test PHP
40
+ run : php -v
41
+ - name : Test php extensions
42
+ run : php -m
43
+ - name : Create Build Environment
44
+ run : |
45
+ New-Item -ItemType "directory" -Path C:\php-snap-build
46
+ cd C:\php-snap-build
47
+ git clone https://github.com/Microsoft/php-sdk-binary-tools.git php-sdk
48
+ git clone https://github.com/php/web-rmtools.git rmtools
49
+ New-Item -ItemType "directory" -Path C:\php-snap-build\${{ matrix.target }}
50
+ New-Item -ItemType "directory" -Path C:\php-snap-build\snap_master\vs16\${{ matrix.arch }}
51
+ Copy-Item -Path C:\php-snap-build\rmtools\bin\rmtools_setvars.bat-dist -Destination C:\php-snap-build\rmtools\bin\rmtools_setvars.bat
52
+ Copy-Item -Path C:\php-snap-build\rmtools\data\config\credentials_ftps.php-dist -Destination C:\php-snap-build\rmtools\data\config\credentials_ftps.php
53
+ - name : Patch Tools
54
+ run : |
55
+ $git_location="C:\Program Files\Git\cmd\git.exe"
56
+ $tar_location="C:\Program Files\Git\usr\bin\tar.exe"
57
+ $task_location="C:\php-snap-build\rmtools\bin\snapshot_task.bat"
58
+ $git_script_location="C:\php-snap-build\rmtools\include\Git.php"
59
+ $config_location="C:\php-snap-build\rmtools\data\config\branch\${{ matrix.arch }}\phpmaster.ini"
60
+ ((Get-Content -path $git_script_location -Raw) -replace "c:\\apps\\git\\bin\\git.exe", $git_location) | Set-Content -Path $git_script_location
61
+ ((Get-Content -path $git_script_location -Raw) -replace "c:\\apps\\git\\bin\\tar.exe", $tar_location) | Set-Content -Path $git_script_location
62
+ ((Get-Content -path $task_location -Raw) -replace ">> %LOG_FILE% 2<&1", "") | Set-Content -Path $task_location
63
+ ((Get-Content -path $config_location -Raw) -replace "pgo=1", "pgo=0") | Set-Content -Path $config_location
64
+ - name : build PHP
65
+ run : |
66
+ & C:\php-snap-build\php-sdk\phpsdk-vs16-${{ matrix.arch }}.bat -t C:\php-snap-build\rmtools\bin\snapshot_task.bat --task-args "phpmaster ${{ matrix.config }}"
67
+ - name : Collect Artifacts
68
+ run : |
69
+ mkdir builds
70
+ Get-ChildItem C:\php-snap-build\${{ matrix.target }}\* -Recurse -Include php-*.zip | Foreach-Object { Copy-Item -Path $_ -Destination .\builds }
71
+ Copy-Item -Path C:\php-snap-build\rmtools\data\db\master.json -Destination .\builds\${{ matrix.config }}.json
72
+ Get-ChildItem .\builds *.zip | Rename-Item -NewName { $_.name -replace "win32","windows" }
73
+ - name : Upload Artifact
74
+ uses : actions/upload-artifact@v2
75
+ with :
76
+ name : ${{ matrix.config }}
77
+ path : builds
78
+ upload :
79
+ runs-on : ubuntu-latest
80
+ needs : build
81
+ steps :
82
+ - uses : actions/checkout@v2
83
+ - run : mkdir builds
84
+ - uses : actions/download-artifact@v2
85
+ with :
86
+ path : builds
87
+ - name : Upload to bintray
88
+ env :
89
+ BINTRAY_KEY : ${{ secrets.BINTRAY_KEY }}
90
+ BINTRAY_USER : shivammathur
91
+ BINTRAY_REPO : php
92
+ GITHUB_REPOSITORY : ${{ github.repository }}
93
+ run : |
94
+ VERSION=$(curl -sSL https://raw.githubusercontent.com/php/php-src/master/main/php_version.h | grep -Po -m 1 "\d.\d")
95
+ curl \
96
+ --user "$BINTRAY_USER":"$BINTRAY_KEY" \
97
+ --header "Content-Type: application/json" \
98
+ --data " \
99
+ {\"name\": \"$VERSION-windows\", \
100
+ \"vcs_url\": \"$GITHUB_REPOSITORY\", \
101
+ \"licenses\": [\"MIT\"], \
102
+ \"public_download_numbers\": true, \
103
+ \"public_stats\": true \
104
+ }" \
105
+ https://api.bintray.com/packages/"$BINTRAY_USER"/"$BINTRAY_REPO" || true
106
+ mkdir uploads
107
+ for file in ./builds/*/*; do
108
+ mv $file ./uploads/
109
+ done
110
+ cd uploads || exit
111
+ for file in ./*; do
112
+ curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -X DELETE https://api.bintray.com/content/"$BINTRAY_USER"/"$BINTRAY_REPO"/"$file" || true
113
+ curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -T "$file" https://api.bintray.com/content/"$BINTRAY_USER"/"$BINTRAY_REPO"/"$VERSION"-windows/$VERSION/"$file" || true
114
+ done
115
+ curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -X POST https://api.bintray.com/content/"$BINTRAY_USER"/"$BINTRAY_REPO"/"$VERSION"-windows/"$VERSION"/publish || true
0 commit comments