config.yml 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. version: 2.1
  2. orbs:
  3. gh: circleci/github-cli@2.2.0
  4. jobs:
  5. release_mac_arm:
  6. macos:
  7. xcode: 14.3.1
  8. environment:
  9. HOMEBREW_NO_AUTO_UPDATE: 1
  10. 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
  11. steps:
  12. - checkout
  13. - run: brew install --formula go automake cmake composer
  14. - run:
  15. name: Clone static-php-cli
  16. command: git clone --depth 1 https://github.com/crazywhalecc/static-php-cli
  17. - restore_cache:
  18. keys:
  19. - spc-{{ checksum "static-php-cli/composer.json" }}
  20. - run:
  21. name: Install static-php-cli and fetch libraries sources
  22. working_directory: static-php-cli/
  23. command: |
  24. composer install --no-dev -a
  25. ./bin/spc fetch --for-extensions="$PHP_EXTENSIONS"
  26. - save_cache:
  27. key: spc-{{ checksum "static-php-cli/composer.json" }}
  28. paths:
  29. - static-php-cli/downloads/
  30. - static-php-cli/vendor/
  31. - run:
  32. working_directory: static-php-cli/
  33. name: Build libphp.a
  34. command: ./bin/spc build --enable-zts --build-embed "$PHP_EXTENSIONS"
  35. - run:
  36. working_directory: static-php-cli/
  37. name: Set CGO flags
  38. command: |
  39. if [ -z "$CIRCLE_TAG" ]; then export FRANKENPHP_VERSION=$CIRCLE_SHA1; else export FRANKENPHP_VERSION=${CIRCLE_TAG:1}; fi
  40. echo "export CGO_CFLAGS='-DFRANKENPHP_VERSION=$FRANKENPHP_VERSION $(./buildroot/bin/php-config --includes | sed s#-I/#-I$PWD/buildroot/#g)'" >> "$BASH_ENV"
  41. echo "export CGO_LDFLAGS='-framework CoreFoundation -framework SystemConfiguration $(./buildroot/bin/php-config --ldflags) $(./buildroot/bin/php-config --libs)'" >> "$BASH_ENV"
  42. echo "export PHP_VERSION='$(./buildroot/bin/php-config --version)'" >> "$BASH_ENV"
  43. echo "export FRANKENPHP_VERSION='$FRANKENPHP_VERSION'" >> "$BASH_ENV"
  44. - restore_cache:
  45. keys:
  46. - go-mod-v4-{{ checksum "caddy/go.sum" }}
  47. - run:
  48. name: Build FrankenPHP
  49. working_directory: caddy/frankenphp/
  50. command: |
  51. go env
  52. 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
  53. ./frankenphp-mac-arm64 version
  54. - gh/setup
  55. - run:
  56. name: Upload asset
  57. working_directory: caddy/frankenphp/
  58. command: |
  59. if [ -n "$CIRCLE_TAG" ]; then
  60. gh release upload $CIRCLE_TAG frankenphp-mac-arm64 --repo dunglas/frankenphp --clobber
  61. fi
  62. - store_artifacts:
  63. path: caddy/frankenphp/frankenphp-mac-arm64
  64. destination: frankenphp-mac-arm64
  65. - save_cache:
  66. key: go-mod-v4-{{ checksum "caddy/go.sum" }}
  67. paths:
  68. - "~/go/pkg/mod"
  69. workflows:
  70. release:
  71. jobs:
  72. - release_mac_arm:
  73. filters:
  74. branches:
  75. ignore: /.*/
  76. tags:
  77. only: /^v.*/