Skip to content

Commit

Permalink
ci: improve static build steps (#305)
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas authored Nov 16, 2023
1 parent 4c70ae2 commit b56b47d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
5 changes: 3 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ jobs:
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
Expand All @@ -23,7 +24,7 @@ jobs:
working_directory: static-php-cli/
command: |
composer install --no-dev -a
./bin/spc fetch --with-php=8.2 -A
./bin/spc fetch --for-extensions="$PHP_EXTENSIONS"
- save_cache:
key: spc-{{ checksum "static-php-cli/composer.json" }}
paths:
Expand All @@ -32,7 +33,7 @@ jobs:
- run:
working_directory: static-php-cli/
name: Build libphp.a
command: ./bin/spc build --enable-zts --build-embed "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"
command: ./bin/spc build --enable-zts --build-embed "$PHP_EXTENSIONS"
- run:
working_directory: static-php-cli/
name: Set CGO flags
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ jobs:
runs-on: macos-latest
env:
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:
-
uses: actions/checkout@v4
Expand All @@ -99,13 +100,13 @@ jobs:
-
name: Fetch libraries sources
working-directory: static-php-cli/
run: ./bin/spc fetch --with-php=8.2 -A
run: ./bin/spc fetch --for-extensions="$PHP_EXTENSIONS"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
name: Build libphp.a
working-directory: static-php-cli/
run: ./bin/spc build --enable-zts --build-embed "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"
run: ./bin/spc build --enable-zts --build-embed "$PHP_EXTENSIONS"
-
name: Set CGO flags
working-directory: static-php-cli/
Expand Down
5 changes: 3 additions & 2 deletions docs/static.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ git clone --depth=1 https://github.com/crazywhalecc/static-php-cli.git
cd static-php-cli
composer install --no-dev -a
./bin/spc doctor --auto-fix
./bin/spc fetch --with-php=8.2 -A
./bin/spc build --enable-zts --build-embed --debug "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"
export 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"
./bin/spc fetch --for-extensions="$PHP_EXTENSIONS"
./bin/spc build --enable-zts --build-embed "$PHP_EXTENSIONS"
export CGO_CFLAGS="$(./buildroot/bin/php-config --includes | sed s#-I/#-I$PWD/buildroot/#g)"
export CGO_LDFLAGS="-framework CoreFoundation -framework SystemConfiguration $(./buildroot/bin/php-config --ldflags) $(./buildroot/bin/php-config --libs)"

Expand Down
3 changes: 2 additions & 1 deletion static-builder.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ RUN apk update; \
jq \
libgcc \
libstdc++ \
libtool \
linux-headers \
m4 \
make \
Expand Down Expand Up @@ -56,7 +57,7 @@ WORKDIR /static-php-cli
RUN git clone --depth=1 https://github.com/crazywhalecc/static-php-cli . && \
composer install --no-cache --no-dev --classmap-authoritative

RUN --mount=type=secret,id=github-token GITHUB_TOKEN=$(cat /run/secrets/github-token) ./bin/spc download --with-php=$PHP_VERSION --all
RUN --mount=type=secret,id=github-token GITHUB_TOKEN=$(cat /run/secrets/github-token) ./bin/spc download --with-php=$PHP_VERSION --for-extensions="$PHP_EXTENSIONS"

RUN ./bin/spc build --build-embed --enable-zts --disable-opcache-jit "$PHP_EXTENSIONS" --with-libs="$PHP_EXTENSION_LIBS"

Expand Down

0 comments on commit b56b47d

Please sign in to comment.