1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- version: 2.1
- orbs:
- gh: circleci/github-cli@2.2.0
- jobs:
- release_mac_arm:
- macos:
- xcode: 14.3.1
- environment:
- HOMEBREW_NO_AUTO_UPDATE: 1
- PHP_EXTENSIONS: bcmath,calendar,ctype,curl,dba,dom,exif,filter,fileinfo,gd,iconv,intl,mbstring,mbregex,mysqli,mysqlnd,opcache,openssl,pcntl,pdo,pdo_mysql,pdo_pgsql,pdo_sqlite,pgsql,phar,posix,readline,redis,session,simplexml,sockets,sqlite3,tokenizer,xml,xmlreader,xmlwriter,zip,zlib,apcu
- steps:
- - checkout
- - run: brew install --formula go automake cmake composer
- - run:
- name: Clone static-php-cli
- command: git clone --depth 1 https://github.com/crazywhalecc/static-php-cli
- - restore_cache:
- keys:
- - spc-{{ checksum "static-php-cli/composer.json" }}
- - run:
- name: Install static-php-cli and fetch libraries sources
- working_directory: static-php-cli/
- command: |
- composer install --no-dev -a
- ./bin/spc fetch --for-extensions="$PHP_EXTENSIONS"
- - save_cache:
- key: spc-{{ checksum "static-php-cli/composer.json" }}
- paths:
- - static-php-cli/downloads/
- - static-php-cli/vendor/
- - run:
- working_directory: static-php-cli/
- name: Build libphp.a
- command: ./bin/spc build --enable-zts --build-embed "$PHP_EXTENSIONS"
- - run:
- working_directory: static-php-cli/
- name: Set CGO flags
- command: |
- if [ -z "$CIRCLE_TAG" ]; then export FRANKENPHP_VERSION=$CIRCLE_SHA1; else export FRANKENPHP_VERSION=${CIRCLE_TAG:1}; fi
- echo "export CGO_CFLAGS='-DFRANKENPHP_VERSION=$FRANKENPHP_VERSION $(./buildroot/bin/php-config --includes | sed s#-I/#-I$PWD/buildroot/#g)'" >> "$BASH_ENV"
- echo "export CGO_LDFLAGS='-framework CoreFoundation -framework SystemConfiguration $(./buildroot/bin/php-config --ldflags) $(./buildroot/bin/php-config --libs)'" >> "$BASH_ENV"
- echo "export PHP_VERSION='$(./buildroot/bin/php-config --version)'" >> "$BASH_ENV"
- echo "export FRANKENPHP_VERSION='$FRANKENPHP_VERSION'" >> "$BASH_ENV"
- - restore_cache:
- keys:
- - go-mod-v4-{{ checksum "caddy/go.sum" }}
- - run:
- name: Build FrankenPHP
- working_directory: caddy/frankenphp/
- command: |
- go env
- go build -buildmode=pie -tags "cgo netgo osusergo static_build" -ldflags "-linkmode=external -extldflags -static-pie -w -s -X 'github.com/caddyserver/caddy/v2.CustomVersion=FrankenPHP $FRANKENPHP_VERSION PHP $PHP_VERSION Caddy'" -o frankenphp-mac-arm64
- ./frankenphp-mac-arm64 version
- - gh/setup
- - run:
- name: Upload asset
- working_directory: caddy/frankenphp/
- command: |
- if [ -n "$CIRCLE_TAG" ]; then
- gh release upload $CIRCLE_TAG frankenphp-mac-arm64 --repo dunglas/frankenphp --clobber
- fi
- - store_artifacts:
- path: caddy/frankenphp/frankenphp-mac-arm64
- destination: frankenphp-mac-arm64
- - save_cache:
- key: go-mod-v4-{{ checksum "caddy/go.sum" }}
- paths:
- - "~/go/pkg/mod"
- workflows:
- release:
- jobs:
- - release_mac_arm:
- filters:
- branches:
- ignore: /.*/
- tags:
- only: /^v.*/
|