mirror of
https://github.com/dunglas/frankenphp.git
synced 2025-12-24 13:38:11 +08:00
ci: upgrade to super-linter 6 (#952)
This commit is contained in:
3
.github/workflows/docker.yaml
vendored
3
.github/workflows/docker.yaml
vendored
@@ -16,12 +16,15 @@ on:
|
|||||||
- v*.*.*
|
- v*.*.*
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
|
#checkov:skip=CKV_GHA_7
|
||||||
version:
|
version:
|
||||||
description: 'FrankenPHP version'
|
description: 'FrankenPHP version'
|
||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 4 * * *'
|
- cron: '0 4 * * *'
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
env:
|
env:
|
||||||
IMAGE_NAME: ${{ (github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.version) || startsWith(github.ref, 'refs/tags/')) && 'dunglas/frankenphp' || 'dunglas/frankenphp-dev' }}
|
IMAGE_NAME: ${{ (github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.version) || startsWith(github.ref, 'refs/tags/')) && 'dunglas/frankenphp' || 'dunglas/frankenphp-dev' }}
|
||||||
jobs:
|
jobs:
|
||||||
|
|||||||
17
.github/workflows/lint.yaml
vendored
17
.github/workflows/lint.yaml
vendored
@@ -7,17 +7,14 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: read
|
||||||
|
statuses: write
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Lint Code Base
|
name: Lint Code Base
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
packages: read
|
|
||||||
statuses: write
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout Code
|
name: Checkout Code
|
||||||
@@ -26,7 +23,7 @@ jobs:
|
|||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
-
|
-
|
||||||
name: Lint Code Base
|
name: Lint Code Base
|
||||||
uses: super-linter/super-linter/slim@v5
|
uses: super-linter/super-linter/slim@v6.8.0
|
||||||
env:
|
env:
|
||||||
VALIDATE_ALL_CODEBASE: true
|
VALIDATE_ALL_CODEBASE: true
|
||||||
DEFAULT_BRANCH: main
|
DEFAULT_BRANCH: main
|
||||||
@@ -36,7 +33,11 @@ jobs:
|
|||||||
VALIDATE_CPP: false
|
VALIDATE_CPP: false
|
||||||
VALIDATE_JSCPD: false
|
VALIDATE_JSCPD: false
|
||||||
VALIDATE_GO: false
|
VALIDATE_GO: false
|
||||||
|
VALIDATE_GO_MODULES: false
|
||||||
VALIDATE_PHP_PHPCS: false
|
VALIDATE_PHP_PHPCS: false
|
||||||
VALIDATE_PHP_PHPSTAN: false
|
VALIDATE_PHP_PHPSTAN: false
|
||||||
VALIDATE_PHP_PSALM: false
|
VALIDATE_PHP_PSALM: false
|
||||||
VALIDATE_TERRAGRUNT: false
|
VALIDATE_TERRAGRUNT: false
|
||||||
|
# Prettier and StandardJS are incompatible
|
||||||
|
VALIDATE_JAVASCRIPT_PRETTIER: false
|
||||||
|
VALIDATE_TYPESCRIPT_PRETTIER: false
|
||||||
|
|||||||
3
.github/workflows/static.yaml
vendored
3
.github/workflows/static.yaml
vendored
@@ -16,12 +16,15 @@ on:
|
|||||||
- v*.*.*
|
- v*.*.*
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
|
#checkov:skip=CKV_GHA_7
|
||||||
version:
|
version:
|
||||||
description: 'FrankenPHP version'
|
description: 'FrankenPHP version'
|
||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 0 * * *'
|
- cron: '0 0 * * *'
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
env:
|
env:
|
||||||
IMAGE_NAME: ${{ (github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.version) || startsWith(github.ref, 'refs/tags/')) && 'dunglas/frankenphp' || 'dunglas/frankenphp-dev' }}
|
IMAGE_NAME: ${{ (github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.version) || startsWith(github.ref, 'refs/tags/')) && 'dunglas/frankenphp' || 'dunglas/frankenphp-dev' }}
|
||||||
jobs:
|
jobs:
|
||||||
|
|||||||
2
.github/workflows/tests.yaml
vendored
2
.github/workflows/tests.yaml
vendored
@@ -11,6 +11,8 @@ on:
|
|||||||
- main
|
- main
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- 'docs/**'
|
- 'docs/**'
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
jobs:
|
jobs:
|
||||||
tests:
|
tests:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
|
#checkov:skip=CKV_DOCKER_2
|
||||||
|
#checkov:skip=CKV_DOCKER_3
|
||||||
|
#checkov:skip=CKV_DOCKER_7
|
||||||
FROM php-base AS common
|
FROM php-base AS common
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
|
#checkov:skip=CKV_DOCKER_2
|
||||||
|
#checkov:skip=CKV_DOCKER_3
|
||||||
|
#checkov:skip=CKV_DOCKER_7
|
||||||
FROM php-base AS common
|
FROM php-base AS common
|
||||||
|
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
|
|||||||
295
build-static.sh
295
build-static.sh
@@ -3,138 +3,138 @@
|
|||||||
set -o errexit
|
set -o errexit
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
if ! type "git" > /dev/null 2>&1; then
|
if ! type "git" >/dev/null 2>&1; then
|
||||||
echo "The \"git\" command must be installed."
|
echo "The \"git\" command must be installed."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
arch="$(uname -m)"
|
arch="$(uname -m)"
|
||||||
os="$(uname -s | tr '[:upper:]' '[:lower:]')"
|
os="$(uname -s | tr '[:upper:]' '[:lower:]')"
|
||||||
md5binary="md5sum"
|
md5binary="md5sum"
|
||||||
if [ "${os}" = "darwin" ]; then
|
if [ "${os}" = "darwin" ]; then
|
||||||
os="mac"
|
os="mac"
|
||||||
md5binary="md5 -q"
|
md5binary="md5 -q"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${os}" = "linux" ] && ! type "cmake" > /dev/null 2>&1; then
|
if [ "${os}" = "linux" ] && ! type "cmake" >/dev/null 2>&1; then
|
||||||
echo "The \"cmake\" command must be installed."
|
echo "The \"cmake\" command must be installed."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${PHP_EXTENSIONS}" ]; then
|
if [ -z "${PHP_EXTENSIONS}" ]; then
|
||||||
if [ -n "${EMBED}" ] && [ -f "${EMBED}/composer.json" ]; then
|
if [ -n "${EMBED}" ] && [ -f "${EMBED}/composer.json" ]; then
|
||||||
cd "${EMBED}"
|
cd "${EMBED}"
|
||||||
PHP_EXTENSIONS="$(composer check-platform-reqs --no-dev 2>/dev/null | grep ^ext | sed -e 's/^ext-//' -e 's/ .*//' | xargs | tr ' ' ',')"
|
PHP_EXTENSIONS="$(composer check-platform-reqs --no-dev 2>/dev/null | grep ^ext | sed -e 's/^ext-//' -e 's/ .*//' | xargs | tr ' ' ',')"
|
||||||
export PHP_EXTENSIONS
|
export PHP_EXTENSIONS
|
||||||
cd -
|
cd -
|
||||||
else
|
else
|
||||||
export PHP_EXTENSIONS="apcu,bcmath,bz2,calendar,ctype,curl,dba,dom,exif,fileinfo,filter,ftp,gd,gmp,gettext,iconv,igbinary,imagick,intl,ldap,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pcntl,pdo,pdo_mysql,pdo_pgsql,pdo_sqlite,pgsql,phar,posix,protobuf,readline,redis,session,shmop,simplexml,soap,sockets,sodium,sqlite3,ssh2,sysvmsg,sysvsem,sysvshm,tidy,tokenizer,xlswriter,xml,xmlreader,xmlwriter,zip,zlib,yaml,zstd"
|
export PHP_EXTENSIONS="apcu,bcmath,bz2,calendar,ctype,curl,dba,dom,exif,fileinfo,filter,ftp,gd,gmp,gettext,iconv,igbinary,imagick,intl,ldap,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pcntl,pdo,pdo_mysql,pdo_pgsql,pdo_sqlite,pgsql,phar,posix,protobuf,readline,redis,session,shmop,simplexml,soap,sockets,sodium,sqlite3,ssh2,sysvmsg,sysvsem,sysvshm,tidy,tokenizer,xlswriter,xml,xmlreader,xmlwriter,zip,zlib,yaml,zstd"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${PHP_EXTENSION_LIBS}" ]; then
|
if [ -z "${PHP_EXTENSION_LIBS}" ]; then
|
||||||
export PHP_EXTENSION_LIBS="bzip2,freetype,libavif,libjpeg,liblz4,libwebp,libzip"
|
export PHP_EXTENSION_LIBS="bzip2,freetype,libavif,libjpeg,liblz4,libwebp,libzip"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# The Brotli library must always be built as it is required by http://github.com/dunglas/caddy-cbrotli
|
# The Brotli library must always be built as it is required by http://github.com/dunglas/caddy-cbrotli
|
||||||
if ! echo "${PHP_EXTENSION_LIBS}" | grep -q "\bbrotli\b"; then
|
if ! echo "${PHP_EXTENSION_LIBS}" | grep -q "\bbrotli\b"; then
|
||||||
export PHP_EXTENSION_LIBS="${PHP_EXTENSION_LIBS},brotli"
|
export PHP_EXTENSION_LIBS="${PHP_EXTENSION_LIBS},brotli"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${PHP_VERSION}" ]; then
|
if [ -z "${PHP_VERSION}" ]; then
|
||||||
export PHP_VERSION="8.3"
|
export PHP_VERSION="8.3"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${FRANKENPHP_VERSION}" ]; then
|
if [ -z "${FRANKENPHP_VERSION}" ]; then
|
||||||
FRANKENPHP_VERSION="$(git rev-parse --verify HEAD)"
|
FRANKENPHP_VERSION="$(git rev-parse --verify HEAD)"
|
||||||
export FRANKENPHP_VERSION
|
export FRANKENPHP_VERSION
|
||||||
elif [ -d ".git/" ]; then
|
elif [ -d ".git/" ]; then
|
||||||
CURRENT_REF="$(git rev-parse --abbrev-ref HEAD)"
|
CURRENT_REF="$(git rev-parse --abbrev-ref HEAD)"
|
||||||
export CURRENT_REF
|
export CURRENT_REF
|
||||||
|
|
||||||
if echo "${FRANKENPHP_VERSION}" | grep -F -q "."; then
|
if echo "${FRANKENPHP_VERSION}" | grep -F -q "."; then
|
||||||
# Tag
|
# Tag
|
||||||
|
|
||||||
# Trim "v" prefix if any
|
# Trim "v" prefix if any
|
||||||
FRANKENPHP_VERSION=${FRANKENPHP_VERSION#v}
|
FRANKENPHP_VERSION=${FRANKENPHP_VERSION#v}
|
||||||
export FRANKENPHP_VERSION
|
export FRANKENPHP_VERSION
|
||||||
|
|
||||||
git checkout "v${FRANKENPHP_VERSION}"
|
git checkout "v${FRANKENPHP_VERSION}"
|
||||||
else
|
else
|
||||||
git checkout "${FRANKENPHP_VERSION}"
|
git checkout "${FRANKENPHP_VERSION}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
bin="frankenphp-${os}-${arch}"
|
bin="frankenphp-${os}-${arch}"
|
||||||
|
|
||||||
if [ -n "${CLEAN}" ]; then
|
if [ -n "${CLEAN}" ]; then
|
||||||
rm -Rf dist/
|
rm -Rf dist/
|
||||||
go clean -cache
|
go clean -cache
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Build libphp if necessary
|
# Build libphp if necessary
|
||||||
if [ -f "dist/static-php-cli/buildroot/lib/libphp.a" ]; then
|
if [ -f "dist/static-php-cli/buildroot/lib/libphp.a" ]; then
|
||||||
cd dist/static-php-cli
|
cd dist/static-php-cli
|
||||||
else
|
else
|
||||||
mkdir -p dist/
|
mkdir -p dist/
|
||||||
cd dist/
|
cd dist/
|
||||||
|
|
||||||
if [ -d "static-php-cli/" ]; then
|
if [ -d "static-php-cli/" ]; then
|
||||||
cd static-php-cli/
|
cd static-php-cli/
|
||||||
git pull
|
git pull
|
||||||
else
|
else
|
||||||
git clone --depth 1 https://github.com/crazywhalecc/static-php-cli
|
git clone --depth 1 https://github.com/crazywhalecc/static-php-cli
|
||||||
cd static-php-cli/
|
cd static-php-cli/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if type "brew" > /dev/null 2>&1; then
|
if type "brew" >/dev/null 2>&1; then
|
||||||
if ! type "composer" > /dev/null; then
|
if ! type "composer" >/dev/null; then
|
||||||
packages="composer"
|
packages="composer"
|
||||||
fi
|
fi
|
||||||
if ! type "go" > /dev/null; then
|
if ! type "go" >/dev/null; then
|
||||||
packages="${packages} go"
|
packages="${packages} go"
|
||||||
fi
|
fi
|
||||||
if [ -n "${RELEASE}" ] && ! type "gh" > /dev/null 2>&1; then
|
if [ -n "${RELEASE}" ] && ! type "gh" >/dev/null 2>&1; then
|
||||||
packages="${packages} gh"
|
packages="${packages} gh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${packages}" ]; then
|
if [ -n "${packages}" ]; then
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
brew install --formula --quiet ${packages}
|
brew install --formula --quiet ${packages}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
composer install --no-dev -a
|
composer install --no-dev -a
|
||||||
|
|
||||||
if [ "${os}" = "linux" ]; then
|
if [ "${os}" = "linux" ]; then
|
||||||
extraOpts="--disable-opcache-jit"
|
extraOpts="--disable-opcache-jit"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${DEBUG_SYMBOLS}" ]; then
|
if [ -n "${DEBUG_SYMBOLS}" ]; then
|
||||||
extraOpts="${extraOpts} --no-strip"
|
extraOpts="${extraOpts} --no-strip"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
./bin/spc doctor --auto-fix
|
./bin/spc doctor --auto-fix
|
||||||
./bin/spc download --with-php="${PHP_VERSION}" --for-extensions="${PHP_EXTENSIONS}" --for-libs="${PHP_EXTENSION_LIBS}" --ignore-cache-sources=php-src --prefer-pre-built
|
./bin/spc download --with-php="${PHP_VERSION}" --for-extensions="${PHP_EXTENSIONS}" --for-libs="${PHP_EXTENSION_LIBS}" --ignore-cache-sources=php-src --prefer-pre-built
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
./bin/spc build --debug --enable-zts --build-embed ${extraOpts} "${PHP_EXTENSIONS}" --with-libs="${PHP_EXTENSION_LIBS}"
|
./bin/spc build --debug --enable-zts --build-embed ${extraOpts} "${PHP_EXTENSIONS}" --with-libs="${PHP_EXTENSION_LIBS}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CGO_CFLAGS="-DFRANKENPHP_VERSION=${FRANKENPHP_VERSION} -I${PWD}/buildroot/include/ $(./buildroot/bin/php-config --includes | sed s#-I/#-I"${PWD}"/buildroot/#g)"
|
CGO_CFLAGS="-DFRANKENPHP_VERSION=${FRANKENPHP_VERSION} -I${PWD}/buildroot/include/ $(./buildroot/bin/php-config --includes | sed s#-I/#-I"${PWD}"/buildroot/#g)"
|
||||||
if [ -n "${DEBUG_SYMBOLS}" ]; then
|
if [ -n "${DEBUG_SYMBOLS}" ]; then
|
||||||
CGO_CFLAGS="-g ${CGO_CFLAGS}"
|
CGO_CFLAGS="-g ${CGO_CFLAGS}"
|
||||||
fi
|
fi
|
||||||
export CGO_CFLAGS
|
export CGO_CFLAGS
|
||||||
|
|
||||||
if [ "${os}" = "mac" ]; then
|
if [ "${os}" = "mac" ]; then
|
||||||
export CGO_LDFLAGS="-framework CoreFoundation -framework SystemConfiguration"
|
export CGO_LDFLAGS="-framework CoreFoundation -framework SystemConfiguration"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CGO_LDFLAGS="${CGO_LDFLAGS} ${PWD}/buildroot/lib/libbrotlicommon.a ${PWD}/buildroot/lib/libbrotlienc.a ${PWD}/buildroot/lib/libbrotlidec.a $(./buildroot/bin/php-config --ldflags || true) $(./buildroot/bin/php-config --libs || true)"
|
CGO_LDFLAGS="${CGO_LDFLAGS} ${PWD}/buildroot/lib/libbrotlicommon.a ${PWD}/buildroot/lib/libbrotlienc.a ${PWD}/buildroot/lib/libbrotlidec.a $(./buildroot/bin/php-config --ldflags || true) $(./buildroot/bin/php-config --libs || true)"
|
||||||
if [ "${os}" = "linux" ]; then
|
if [ "${os}" = "linux" ]; then
|
||||||
if echo "${PHP_EXTENSIONS}" | grep -qE "\b(intl|imagick|grpc|v8js|protobuf|mongodb|tbb)\b"; then
|
if echo "${PHP_EXTENSIONS}" | grep -qE "\b(intl|imagick|grpc|v8js|protobuf|mongodb|tbb)\b"; then
|
||||||
CGO_LDFLAGS="${CGO_LDFLAGS} -lstdc++"
|
CGO_LDFLAGS="${CGO_LDFLAGS} -lstdc++"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
export CGO_LDFLAGS
|
export CGO_LDFLAGS
|
||||||
|
|
||||||
@@ -144,92 +144,91 @@ export LIBPHP_VERSION
|
|||||||
cd ../
|
cd ../
|
||||||
|
|
||||||
if [ "${os}" = "linux" ]; then
|
if [ "${os}" = "linux" ]; then
|
||||||
if [ -n "${MIMALLOC}" ]; then
|
if [ -n "${MIMALLOC}" ]; then
|
||||||
# Replace musl's mallocng by mimalloc
|
# Replace musl's mallocng by mimalloc
|
||||||
# The default musl allocator is slow, especially when used by multi-threaded apps,
|
# The default musl allocator is slow, especially when used by multi-threaded apps,
|
||||||
# and triggers weird bugs
|
# and triggers weird bugs
|
||||||
# Adapted from https://www.tweag.io/blog/2023-08-10-rust-static-link-with-mimalloc/
|
# Adapted from https://www.tweag.io/blog/2023-08-10-rust-static-link-with-mimalloc/
|
||||||
|
|
||||||
echo 'The USE_MIMALLOC environment variable is EXPERIMENTAL.'
|
echo 'The USE_MIMALLOC environment variable is EXPERIMENTAL.'
|
||||||
echo 'This option can be removed or its behavior modified at any time.'
|
echo 'This option can be removed or its behavior modified at any time.'
|
||||||
|
|
||||||
if [ ! -f "mimalloc/out/libmimalloc.a" ]; then
|
if [ ! -f "mimalloc/out/libmimalloc.a" ]; then
|
||||||
if [ -d "mimalloc" ]; then
|
if [ -d "mimalloc" ]; then
|
||||||
cd mimalloc/
|
cd mimalloc/
|
||||||
git reset --hard
|
git reset --hard
|
||||||
git clean -xdf
|
git clean -xdf
|
||||||
git fetch --tags
|
git fetch --tags
|
||||||
else
|
else
|
||||||
git clone https://github.com/microsoft/mimalloc.git
|
git clone https://github.com/microsoft/mimalloc.git
|
||||||
cd mimalloc/
|
cd mimalloc/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
git checkout "$(git describe --tags "$(git rev-list --tags --max-count=1 || true)" || true)"
|
git checkout "$(git describe --tags "$(git rev-list --tags --max-count=1 || true)" || true)"
|
||||||
|
|
||||||
curl -f -L --retry 5 https://raw.githubusercontent.com/tweag/rust-alpine-mimalloc/b26002b49d466a295ea8b50828cb7520a71a872a/mimalloc.diff -o mimalloc.diff
|
curl -f -L --retry 5 https://raw.githubusercontent.com/tweag/rust-alpine-mimalloc/b26002b49d466a295ea8b50828cb7520a71a872a/mimalloc.diff -o mimalloc.diff
|
||||||
patch -p1 < mimalloc.diff
|
patch -p1 <mimalloc.diff
|
||||||
|
|
||||||
mkdir -p out/
|
mkdir -p out/
|
||||||
cd out/
|
cd out/
|
||||||
if [ -n "${DEBUG_SYMBOLS}" ]; then
|
if [ -n "${DEBUG_SYMBOLS}" ]; then
|
||||||
cmake \
|
cmake \
|
||||||
-DCMAKE_BUILD_TYPE=Debug \
|
-DCMAKE_BUILD_TYPE=Debug \
|
||||||
-DMI_BUILD_SHARED=OFF \
|
-DMI_BUILD_SHARED=OFF \
|
||||||
-DMI_BUILD_OBJECT=OFF \
|
-DMI_BUILD_OBJECT=OFF \
|
||||||
-DMI_BUILD_TESTS=OFF \
|
-DMI_BUILD_TESTS=OFF \
|
||||||
../
|
../
|
||||||
else
|
else
|
||||||
cmake \
|
cmake \
|
||||||
-DCMAKE_BUILD_TYPE=Release \
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
-DMI_BUILD_SHARED=OFF \
|
-DMI_BUILD_SHARED=OFF \
|
||||||
-DMI_BUILD_OBJECT=OFF \
|
-DMI_BUILD_OBJECT=OFF \
|
||||||
-DMI_BUILD_TESTS=OFF \
|
-DMI_BUILD_TESTS=OFF \
|
||||||
../
|
../
|
||||||
fi
|
fi
|
||||||
make -j"$(nproc || true)"
|
make -j"$(nproc || true)"
|
||||||
|
|
||||||
cd ../../
|
cd ../../
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${DEBUG_SYMBOLS}" ]; then
|
if [ -n "${DEBUG_SYMBOLS}" ]; then
|
||||||
libmimalloc_path=mimalloc/out/libmimalloc-debug.a
|
libmimalloc_path=mimalloc/out/libmimalloc-debug.a
|
||||||
else
|
else
|
||||||
libmimalloc_path=mimalloc/out/libmimalloc.a
|
libmimalloc_path=mimalloc/out/libmimalloc.a
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Patch musl library to use mimalloc
|
# Patch musl library to use mimalloc
|
||||||
for libc_path in "/usr/local/musl/lib/libc.a" "/usr/local/musl/$(uname -m)-linux-musl/lib/libc.a" "/usr/lib/libc.a"
|
for libc_path in "/usr/local/musl/lib/libc.a" "/usr/local/musl/$(uname -m)-linux-musl/lib/libc.a" "/usr/lib/libc.a"; do
|
||||||
do
|
if [ ! -f "${libc_path}" ] || [ -f "${libc_path}.unpatched" ]; then
|
||||||
if [ ! -f "${libc_path}" ] || [ -f "${libc_path}.unpatched" ]; then
|
continue
|
||||||
continue
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
{
|
{
|
||||||
echo "CREATE libc.a"
|
echo "CREATE libc.a"
|
||||||
echo "ADDLIB ${libc_path}"
|
echo "ADDLIB ${libc_path}"
|
||||||
echo "DELETE aligned_alloc.lo calloc.lo donate.lo free.lo libc_calloc.lo lite_malloc.lo malloc.lo malloc_usable_size.lo memalign.lo posix_memalign.lo realloc.lo reallocarray.lo valloc.lo"
|
echo "DELETE aligned_alloc.lo calloc.lo donate.lo free.lo libc_calloc.lo lite_malloc.lo malloc.lo malloc_usable_size.lo memalign.lo posix_memalign.lo realloc.lo reallocarray.lo valloc.lo"
|
||||||
echo "ADDLIB ${libmimalloc_path}"
|
echo "ADDLIB ${libmimalloc_path}"
|
||||||
echo "SAVE"
|
echo "SAVE"
|
||||||
} | ar -M
|
} | ar -M
|
||||||
mv "${libc_path}" "${libc_path}.unpatched"
|
mv "${libc_path}" "${libc_path}.unpatched"
|
||||||
mv libc.a "${libc_path}"
|
mv libc.a "${libc_path}"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Increase the default stack size to prevents issues with code including many files such as Symfony containers
|
# Increase the default stack size to prevents issues with code including many files such as Symfony containers
|
||||||
extraExtldflags="-Wl,-z,stack-size=0x80000"
|
extraExtldflags="-Wl,-z,stack-size=0x80000"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${DEBUG_SYMBOLS}" ]; then
|
if [ -z "${DEBUG_SYMBOLS}" ]; then
|
||||||
extraLdflags="-w -s"
|
extraLdflags="-w -s"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd ../
|
cd ../
|
||||||
|
|
||||||
# Embed PHP app, if any
|
# Embed PHP app, if any
|
||||||
if [ -n "${EMBED}" ] && [ -d "${EMBED}" ]; then
|
if [ -n "${EMBED}" ] && [ -d "${EMBED}" ]; then
|
||||||
tar -cf app.tar -C "${EMBED}" .
|
tar -cf app.tar -C "${EMBED}" .
|
||||||
${md5binary} app.tar | awk '{printf $1}' > app_checksum.txt
|
${md5binary} app.tar | awk '{printf $1}' >app_checksum.txt
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd caddy/frankenphp/
|
cd caddy/frankenphp/
|
||||||
@@ -238,20 +237,20 @@ go build -buildmode=pie -tags "cgo netgo osusergo static_build" -ldflags "-linkm
|
|||||||
cd ../..
|
cd ../..
|
||||||
|
|
||||||
if [ -d "${EMBED}" ]; then
|
if [ -d "${EMBED}" ]; then
|
||||||
truncate -s 0 app.tar
|
truncate -s 0 app.tar
|
||||||
truncate -s 0 app_checksum.txt
|
truncate -s 0 app_checksum.txt
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if type "upx" > /dev/null 2>&1 && [ -z "${DEBUG_SYMBOLS}" ] && [ -z "${NO_COMPRESS}" ]; then
|
if type "upx" >/dev/null 2>&1 && [ -z "${DEBUG_SYMBOLS}" ] && [ -z "${NO_COMPRESS}" ]; then
|
||||||
upx --best "dist/${bin}"
|
upx --best "dist/${bin}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
"dist/${bin}" version
|
"dist/${bin}" version
|
||||||
|
|
||||||
if [ -n "${RELEASE}" ]; then
|
if [ -n "${RELEASE}" ]; then
|
||||||
gh release upload "v${FRANKENPHP_VERSION}" "dist/${bin}" --repo dunglas/frankenphp --clobber
|
gh release upload "v${FRANKENPHP_VERSION}" "dist/${bin}" --repo dunglas/frankenphp --clobber
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${CURRENT_REF}" ]; then
|
if [ -n "${CURRENT_REF}" ]; then
|
||||||
git checkout "${CURRENT_REF}"
|
git checkout "${CURRENT_REF}"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
|
#checkov:skip=CKV_DOCKER_2
|
||||||
|
#checkov:skip=CKV_DOCKER_3
|
||||||
FROM golang:1.22-alpine
|
FROM golang:1.22-alpine
|
||||||
|
|
||||||
ENV CFLAGS="-ggdb3"
|
ENV CFLAGS="-ggdb3"
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
|
#checkov:skip=CKV_DOCKER_2
|
||||||
|
#checkov:skip=CKV_DOCKER_3
|
||||||
FROM golang:1.22
|
FROM golang:1.22
|
||||||
|
|
||||||
ENV CFLAGS="-ggdb3"
|
ENV CFLAGS="-ggdb3"
|
||||||
|
|||||||
22
release.sh
22
release.sh
@@ -9,25 +9,25 @@ set -o errtrace
|
|||||||
set -o pipefail
|
set -o pipefail
|
||||||
set -o xtrace
|
set -o xtrace
|
||||||
|
|
||||||
if ! type "git" > /dev/null; then
|
if ! type "git" >/dev/null; then
|
||||||
echo "The \"git\" command must be installed."
|
echo "The \"git\" command must be installed."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! type "gh" > /dev/null; then
|
if ! type "gh" >/dev/null; then
|
||||||
echo "The \"gh\" command must be installed."
|
echo "The \"gh\" command must be installed."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $# -ne 1 ]]; then
|
if [[ $# -ne 1 ]]; then
|
||||||
echo "Usage: ./release.sh version" >&2
|
echo "Usage: ./release.sh version" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Adapted from https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
|
# Adapted from https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
|
||||||
if [[ ! $1 =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?$ ]]; then
|
if [[ ! $1 =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?$ ]]; then
|
||||||
echo "Invalid version number: $1" >&2
|
echo "Invalid version number: $1" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
git checkout main
|
git checkout main
|
||||||
@@ -44,6 +44,6 @@ git tag -s -m "Version $1" "caddy/v$1"
|
|||||||
git push --follow-tags
|
git push --follow-tags
|
||||||
|
|
||||||
tags=$(git tag --list --sort=-version:refname 'v*')
|
tags=$(git tag --list --sort=-version:refname 'v*')
|
||||||
previous_tag=$(awk 'NR==2 {print;exit}' <<< "${tags}")
|
previous_tag=$(awk 'NR==2 {print;exit}' <<<"${tags}")
|
||||||
|
|
||||||
gh release create --draft --generate-notes --latest --notes-start-tag "${previous_tag}" --verify-tag "v$1"
|
gh release create --draft --generate-notes --latest --notes-start-tag "${previous_tag}" --verify-tag "v$1"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
for ((i = 0 ; i < 100 ; i++)); do
|
for ((i = 0; i < 100; i++)); do
|
||||||
curl --no-progress-meter -o /dev/null http://localhost:2019/config/apps/frankenphp -: --no-progress-meter -o /dev/null -H 'Cache-Control: must-revalidate' -H 'Content-Type: application/json' --data-binary '{"workers":[{"file_name":"./index.php"}]}' -X PATCH http://localhost:2019/config/apps/frankenphp
|
curl --no-progress-meter -o /dev/null http://localhost:2019/config/apps/frankenphp -: --no-progress-meter -o /dev/null -H 'Cache-Control: must-revalidate' -H 'Content-Type: application/json' --data-binary '{"workers":[{"file_name":"./index.php"}]}' -X PATCH http://localhost:2019/config/apps/frankenphp
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
|
#checkov:skip=CKV_DOCKER_2
|
||||||
|
#checkov:skip=CKV_DOCKER_3
|
||||||
|
#checkov:skip=CKV_DOCKER_7
|
||||||
FROM golang-base
|
FROM golang-base
|
||||||
|
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
|
|||||||
Reference in New Issue
Block a user