update #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build-macos-x86_64 | |
on: | |
push: | |
pull_request: | |
env: | |
BUILD_PHP_VERSION: 8.2.13 | |
jobs: | |
macos-x86_64: | |
if: 1 | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Prepare build environment | |
run: | | |
env | |
echo $HOME | |
brew config | |
bash sapi/quickstart/macos/macos-init.sh | |
# sudo rm -rf /Library/Developer/CommandLineTools | |
# xcode-select --install | |
# sudo xcode-select --reset | |
# sudo xcode-select -switch /Library/Developer/CommandLineTools | |
# softwareupdate --list --verbose | |
# softwareupdate --install -a | |
# xcode-select --install | |
# export SDKROOT=$(xcrun --show-sdk-path) | |
ls -lh $(xcrun --show-sdk-path) | |
# sudo xcode-select --switch /Applications/Xcode.app | |
# export MACOSX_DEPLOYMENT_TARGET=12.6 | |
echo 'export PATH="/usr/local/opt/binutils/bin:$PATH"' >> /Users/runner/.bash_profile | |
ifconfig | |
export IPV6=$(ifconfig en0 | grep "inet6 " | grep -v "inet6 fe80:" | awk '{print $2}' | cut -d'/' -f1 | sed -n '2p') | |
export IPV4=$(ifconfig en0 | grep "inet " | grep -v 127.0.0 | awk '{print $2}' | cut -d'/' -f1 | sed -n '1p') | |
echo $IPV4 | |
echo $IPV6 | |
echo "X_IPV6=${IPV6}" >> $GITHUB_ENV | |
echo "X_IPV4=${IPV4}" >> $GITHUB_ENV | |
export PATH=/usr/local/opt/bison/bin:/usr/local/opt/llvm/bin:$PATH | |
# brew bison --debug | |
echo ${{ env.BRANCH_NAME }} | |
echo ${{ github.actor }} | |
echo ${{ github.repository }} | |
echo ${{ github.repository_owner }} | |
echo ${{ github.head_ref }} | |
echo ${{ github.ref_name }} | |
CURRENT_USER=$(whoami) | |
echo ${CURRENT_USER} | |
sudo mkdir -p /usr/local/swoole-cli | |
CURRENT_USER=$(whoami) && sudo chown -R ${CURRENT_USER}:staff /usr/local/swoole-cli | |
- name: Cache PHP Runtime | |
uses: actions/cache@v3 | |
id: php-runtime-cache | |
with: | |
path: ${{ github.workspace }}/bin/runtime | |
key: ${{ runner.os }}-x86_64-php-runtime | |
- name: Cache PHP Vendor | |
uses: actions/cache@v3 | |
id: php-vendor-cache | |
with: | |
path: ${{ github.workspace }}/vendor | |
key: ${{ runner.os }}-x86_64-php-vendor | |
- name: Cache Dependency Source Code Tarball | |
uses: actions/cache@v3 | |
id: dependency-cache | |
with: | |
path: ${{ github.workspace }}/pool/ | |
key: ${{ github.head_ref || github.ref_name }}-${{ runner.os }}-x86_64-pool | |
- name: Cache all-library | |
uses: actions/cache@v3 | |
id: all-library-cache | |
with: | |
path: /usr/local/swoole-cli | |
key: ${{ github.head_ref || github.ref_name }}-${{ runner.os }}-x86_64-all-library | |
- name: Prepare Runtime and Libraries and Extensions | |
run: | | |
set -x | |
mkdir -p pool/lib | |
mkdir -p pool/ext | |
mkdir -p bin/runtime | |
if [ ! -f bin/runtime/php ] ; then | |
bash sapi/quickstart/setup-php-runtime.sh | |
fi | |
if test $(ls -A pool/lib/ | wc -l) -eq 0 ; then | |
bash sapi/download-box/download-box-get-archive-from-server.sh | |
fi | |
ls -A pool/lib/ | |
ls -A /usr/local/swoole-cli/ | |
- name: prepare | |
run: | | |
export PATH=${{ github.workspace }}/bin/runtime:$PATH | |
alias php="php -d curl.cainfo=${{ github.workspace }}/bin/runtime/cacert.pem -d openssl.cafile=${{ github.workspace }}/bin/runtime/cacert.pem" | |
composer update --optimize-autoloader | |
php prepare.php +nginx # -with-c-compiler=gcc | |
- name: Build | |
run: | | |
export PATH=${{ github.workspace }}/bin/runtime:$PATH | |
bash make-install-deps.sh | |
bash ./make.sh all-library | |
bash ./make.sh config | |
- name: Show Build Result | |
run: | | |
ls ./bin/nginx | |
./bin/nginx/sbin/nginx -V | |
NGINX_VERSION=$(echo $(./bin/nginx/sbin/nginx -v 2>&1) | awk -F '/' '{print $2}') | |
echo "NGINX_VERSION=${NGINX_VERSION}" >> $GITHUB_ENV | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: nginx-${{ env.NGINX_VERSION }}-macos-x64 | |
retention-days: 7 | |
path: ./bin/nginx | |
- name: gh release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: nginx-${{ env.NGINX_VERSION }}-macos-x64.tar.xz |