Skip to content

Commit 703985c

Browse files
committed
Update release to use binaries produced by buildx
1 parent b330a8e commit 703985c

File tree

11 files changed

+356
-232
lines changed

11 files changed

+356
-232
lines changed

.github/workflows/release.yml

Lines changed: 138 additions & 181 deletions
Large diffs are not rendered by default.

Dockerfile

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
1-
FROM ubuntu:22.04
1+
FROM alpine:3.17
22
ARG BUILD_DEV=0
3-
ARG REV=main
43

54
# Install the manticore-executor binary
6-
RUN apt-get update -y && apt-get install -y sudo git && \
7-
git clone https://github.com/manticoresoftware/executor.git && \
8-
cd executor && git checkout $REV && \
9-
./build-linux 8.1.13 0 $BUILD_DEV && \
5+
COPY . /src
6+
RUN apk add bash && \
7+
cd /src && \
8+
./build-alpine 8.1.13 0 $BUILD_DEV && \
109
mv build/dist/bin/php /usr/bin/manticore-executor && \
1110
ln -s /usr/bin/manticore-executor /usr/bin/php && \
12-
cd .. && rm -fr executor
11+
cd ../..
1312

1413
# Add composer
1514
RUN test "$BUILD_DEV" -eq 1 && php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
1615
php -r "if (hash_file('sha384', 'composer-setup.php') === '55ce33d7678c5a611085589f1f3ddf8b3c52d662cd01d4ba75c0ee0459970c2200a51f492d557530c71c15d8dba01eae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" && \
1716
php composer-setup.php && \
1817
php -r "unlink('composer-setup.php');" && \
19-
sudo mv composer.phar /usr/local/bin/composer
18+
sudo mv composer.phar /usr/bin/composer || true
2019

2120
WORKDIR /src
2221

2322
# Build on silicon chip mac:
24-
# docker buildx build --build-arg BUILD_DEV=1 --build-arg REV=v0.4.1 --platform linux/amd64 -t manticoresearch/manticore-executor:0.4.1 --push .
23+
# docker buildx build --build-arg BUILD_DEV=1 --platform linux/amd64,linux/arm64 -t manticoresearch/manticore-executor:0.5.1-dev --push .

bin/upload_repo_arc

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
#!/usr/bin/env bash
2-
# Copyright (c) 2022, Manticore Software LTD (https://manticoresearch.com)
3-
4-
# This program is free software; you can redistribute it and/or modify
5-
# it under the terms of the The PHP License, version 3.01. You should have
6-
# received a copy of the license along with this program; if you did not,
7-
# you can find it at https://www.php.net/license/3_01.txt
8-
92
# That file here is for reference; actually used the one stored on the host to avoid checkout of the whole code
10-
set -e
3+
114
copy_to() {
125
echo -e "Copy $1 to /mnt/repo_storage/manticoresearch_$2";
136
cp "$1" "/mnt/repo_storage/manticoresearch_$2" && echo -e "Success"

bin/upload_repo_deb

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
#!/usr/bin/env bash
2-
# Copyright (c) 2022, Manticore Software LTD (https://manticoresearch.com)
3-
4-
# This program is free software; you can redistribute it and/or modify
5-
# it under the terms of the The PHP License, version 3.01. You should have
6-
# received a copy of the license along with this program; if you did not,
7-
# you can find it at https://www.php.net/license/3_01.txt
8-
9-
10-
# from outside: $DISTRO = stretch,buster,xenial,bionic,focal,jammy,bullseye
2+
# from outside: $DISTRO = stretch,buster,xenial,bionic,focal,jammy,bullseye,bookworm
113
# That file here is for reference; actually used the one stored on the host to avoid checkout of the whole code
124
set -e
135
echo "Uploading $DISTRO"
@@ -26,6 +18,7 @@ copy_to() {
2618
for f in build/*deb; do
2719
# VER="$(echo "$f" | cut -d_ -f2)"
2820
ARCH=$(echo "$f" | cut -d_ -f3 | cut -d. -f1)
21+
echo "Arch: $ARCH"
2922
if [ -f "$f" ]; then
3023
if [ -z "${IS_RELEASE_DIGIT}" ]; then
3124
IS_RELEASE_DIGIT=$(echo "$f" | cut -d. -f3 | cut -d- -f1)
@@ -45,17 +38,22 @@ for f in build/*deb; do
4538
copy_to "$f" "$DISTRO/main/binary-arm64/"
4639
# bundlearm=1
4740
fi
41+
42+
if [[ $ARCH == "all" ]]; then
43+
copy_to "$f" "$DISTRO/main/binary-amd64/"
44+
copy_to "$f" "$DISTRO/main/binary-arm64/"
45+
fi
4846
fi
4947
done
5048

5149
# no need to make bundle as we deploy one single package
5250

5351
if [ -n "$SUFFIX" ]; then
5452
/usr/bin/docker exec repo-generator /generator.sh -distro "$DISTRO" -architecture amd -dev 1
55-
/usr/bin/docker exec repo-generator /generator.sh -distro "$DISTRO" -architecture arm -dev 1
53+
# /usr/bin/docker exec repo-generator /generator.sh -distro "$DISTRO" -architecture arm -dev 1
5654
else
5755
/usr/bin/docker exec repo-generator /generator.sh -distro "$DISTRO" -architecture amd
58-
/usr/bin/docker exec repo-generator /generator.sh -distro "$DISTRO" -architecture arm
56+
# /usr/bin/docker exec repo-generator /generator.sh -distro "$DISTRO" -architecture arm
5957
fi
6058

6159
rm -rf build/*deb

bin/upload_repo_rpm

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
#!/usr/bin/env bash
2-
# Copyright (c) 2022, Manticore Software LTD (https://manticoresearch.com)
3-
4-
# This program is free software; you can redistribute it and/or modify
5-
# it under the terms of the The PHP License, version 3.01. You should have
6-
# received a copy of the license along with this program; if you did not,
7-
# you can find it at https://www.php.net/license/3_01.txt
8-
9-
10-
# from outside: $DISTRO = 7,8,9
11-
2+
# from outside: $DISTRO = 7,8
123
# That file here is for reference; actually used the one stored on the host to avoid checkout of the whole code
134
set -e
145
echo "Uploading $DISTRO"
@@ -24,15 +15,19 @@ copy_to() {
2415
# bundleaarch=0
2516
# bundleintel=0
2617

27-
for f in build/*."el$DISTRO".{x86_64,aarch64}.rpm; do
18+
for f in build/*."el$DISTRO".{x86_64,aarch64,noarch}.rpm; do
19+
2820
echo "file $f"
2921
tail=$(echo "$f" | sed 's_build/__g;s/[a-z]*-//g;')
3022
# VER=$(echo "$tail" | cut -d. -f1,2,3,4,5)
3123
if [[ $tail == *".x86_64."* ]]; then
3224
ARCH=x86_64
3325
elif [[ $tail == *".aarch64."* ]]; then
3426
ARCH=aarch64
35-
fi;
27+
elif [[ $tail == *".noarch."* ]]; then
28+
ARCH=noarch
29+
fi
30+
echo "Arch: $ARCH"
3631
if [ -f "$f" ]; then
3732
if [ -z "${IS_RELEASE_DIGIT}" ]; then
3833
IS_RELEASE_DIGIT=$(echo "$f" | cut -d. -f3 | cut -d_ -f1)
@@ -43,6 +38,7 @@ for f in build/*."el$DISTRO".{x86_64,aarch64}.rpm; do
4338
fi
4439
fi
4540

41+
4642
FILENAME=$(basename "$f")
4743
cp $f /work/repomanager/docker/rpm_signer/data/$DISTRO/$ARCH/$FILENAME
4844
/usr/bin/docker exec rpm_signer /worker.sh $DISTRO $ARCH
@@ -58,6 +54,11 @@ for f in build/*."el$DISTRO".{x86_64,aarch64}.rpm; do
5854
# bundleaarch=1
5955
fi
6056

57+
if [[ $ARCH == "noarch" ]]; then
58+
copy_to "$f" x86_64/
59+
copy_to "$f" aarch64/
60+
fi
61+
6162
fi
6263
done
6364

build-alpine

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#!/usr/bin/env bash
2+
# Copyright (c) 2022, Manticore Software LTD (https://manticoresearch.com)
3+
4+
# This program is free software; you can redistribute it and/or modify
5+
# it under the terms of the The PHP License, version 3.01. You should have
6+
# received a copy of the license along with this program; if you did not,
7+
# you can find it at https://www.php.net/license/3_01.txt
8+
9+
set -e
10+
install_deps() {
11+
arch=$(arch)
12+
# Do basic configuration of the system, and install build tools
13+
apk update && \
14+
apk add binutils cmake make libgcc musl-dev gcc g++ perl linux-headers && \
15+
ln -s "/usr/bin/${arch}-alpine-linux-musl-gcc-ar" "/usr/bin/${arch}-alpine-linux-musl-ar" && \
16+
ln -s "/usr/bin/${arch}-alpine-linux-musl-gcc-ranlib" "/usr/bin/${arch}-alpine-linux-musl-ranlib" && \
17+
ln -s "/usr/bin/${arch}-alpine-linux-musl-gcc-nm" "/usr/bin/${arch}-alpine-linux-musl-nm" && \
18+
ln -s /usr/bin/strip "/usr/bin/${arch}-alpine-linux-musl-strip" && \
19+
ln -s /usr/bin/objcopy "/usr/bin/${arch}-alpine-linux-musl-objcopy"
20+
export CROSS_COMPILE="/usr/bin/${arch}-alpine-linux-musl-"
21+
22+
apk add curl git autoconf bison re2c pkgconf zlib-dev zstd-dev openssl-libs-static openssl-dev zlib-static zlib-dev
23+
}
24+
25+
install_dev_deps() {
26+
apk add oniguruma-dev gmp-dev
27+
28+
test -d libzip-1.9.2 && rm -f $_
29+
curl -sSL https://github.com/nih-at/libzip/releases/download/v1.9.2/libzip-1.9.2.tar.gz | tar -xzf -
30+
cd libzip-1.9.2 && mkdir -p build && cd build
31+
cmake -DBUILD_SHARED_LIBS=OFF -DENABLE_LZMA=OFF -DENABLE_BZIP2=OFF ..
32+
make -j4 && make install
33+
cd ../..
34+
rm -fr libzip-1.9.2
35+
36+
test -d libxml2-2.10.3 && rm -f libxml2-2.10.3
37+
curl -sSL https://github.com/GNOME/libxml2/archive/refs/tags/v2.10.3.tar.gz | tar -xzf -
38+
cd libxml2-2.10.3 && mkdir -p build && cd build
39+
cmake -DBUILD_SHARED_LIBS=OFF -DLIBXML2_WITH_LZMA=OFF -DLIBXML2_WITH_PYTHON=OFF -DLIBXML2_WITH_ICONV=OFF -DCMAKE_BUILD_TYPE=Release ..
40+
make -j4 && make install
41+
cd ../..
42+
rm -fr libxml2-2.10.3
43+
}
44+
45+
export -f install_deps install_dev_deps
46+
. build-bash-base.sh "$@"
47+
48+
MAKE_LDFLAGS=-ldl
49+
ENABLE_SHARED=no
50+
ENABLE_STATIC=yes
51+
52+
./configure CFLAGS="-O3" --prefix="$BUILD_PREFIX" --disable-all \
53+
--enable-shared=$ENABLE_SHARED --enable-static=$ENABLE_STATIC --with-layout=GNU \
54+
--with-pear=no --disable-cgi --disable-phpdbg \
55+
--with-pcre-jit --enable-zstd --with-libzstd \
56+
--enable-pcntl --enable-posix \
57+
--enable-sockets \
58+
--enable-zts --enable-parallel \
59+
--with-openssl --with-zlib \
60+
"${BUILD_EXTRA[@]}"
61+
62+
sed -ie 's/-export-dynamic//g' Makefile
63+
sed -ie 's/-o $(SAPI_CLI_PATH)/-all-static -o $(SAPI_CLI_PATH)/g' Makefile
64+
65+
make LDFLAGS=$MAKE_LDFLAGS -j8
66+
make install-cli

build-linux

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
# received a copy of the license along with this program; if you did not,
77
# you can find it at https://www.php.net/license/3_01.txt
88

9+
# ! This script is deprecated and we use muslc build on alpine.
10+
# See: build-alpine
911
set -e
1012
install_deps() {
1113
sudo apt-get update -y
@@ -39,7 +41,6 @@ fi
3941
--enable-sockets \
4042
--enable-zts --enable-parallel \
4143
--with-openssl --with-zlib \
42-
--enable-opcache \
4344
"${BUILD_EXTRA[@]}"
4445

4546
if [[ "$BUILD_STATIC" == 1 ]]; then

collect-assets

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env bash
2+
# Copyright (c) 2022, Manticore Software LTD (https://manticoreseAPP_ARCH.com)
3+
4+
# This program is free software; you can redistribute it and/or modify
5+
# it under the terms of the The PHP License, version 3.01. You should have
6+
# received a copy of the license along with this program; if you did not,
7+
# you can find it at https://www.php.net/license/3_01.txt
8+
# ! Must be defined: APP_ARCH, APP_NAME, APP_VERSION, GITHUB_SHA, RUNNER_OS
9+
# This script is part of tools to use in GitHub workflow
10+
11+
assets="${APP_NAME}_${APP_VERSION}-$( date +%y%m%d )-${GITHUB_SHA:0:7}_$(echo "${RUNNER_OS}" | tr '[:upper:]' '[:lower:]')_${APP_ARCH}"
12+
13+
pwd
14+
echo "$assets"
15+
mkdir -p "$assets"
16+
17+
# If we have dist dir that means we built it on host machine
18+
if test -d dist; then
19+
cp dist/bin/php "$assets/${APP_NAME}"
20+
else
21+
id=$(docker create "${DOCKER_IMAGE}")
22+
docker cp "$id:/usr/bin/${APP_NAME}" "$assets/${APP_NAME}"
23+
chmod +x "$assets/${APP_NAME}"
24+
docker rm -v "$id"
25+
fi
26+
27+
# Add common files
28+
cp {README.md,LICENSE} "$assets/"
29+
30+
# Finaly make assets arhive
31+
(
32+
tar czf "$assets.tar.gz" "$assets"
33+
ls -lah *.*
34+
)

extra.LICENSE

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
--------------------------------------------------------------------
2+
The PHP License, version 3.01
3+
Copyright (c) 1999 - 2019 The PHP Group. All rights reserved.
4+
--------------------------------------------------------------------
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, is permitted provided that the following conditions
8+
are met:
9+
10+
1. Redistributions of source code must retain the above copyright
11+
notice, this list of conditions and the following disclaimer.
12+
13+
2. Redistributions in binary form must reproduce the above copyright
14+
notice, this list of conditions and the following disclaimer in
15+
the documentation and/or other materials provided with the
16+
distribution.
17+
18+
3. The name "PHP" must not be used to endorse or promote products
19+
derived from this software without prior written permission. For
20+
written permission, please contact group@php.net.
21+
22+
4. Products derived from this software may not be called "PHP", nor
23+
may "PHP" appear in their name, without prior written permission
24+
from group@php.net. You may indicate that your software works in
25+
conjunction with PHP by saying "Foo for PHP" instead of calling
26+
it "PHP Foo" or "phpfoo"
27+
28+
5. The PHP Group may publish revised and/or new versions of the
29+
license from time to time. Each version will be given a
30+
distinguishing version number.
31+
Once covered code has been published under a particular version
32+
of the license, you may always continue to use it under the terms
33+
of that version. You may also choose to use such covered code
34+
under the terms of any subsequent version of the license
35+
published by the PHP Group. No one other than the PHP Group has
36+
the right to modify the terms applicable to covered code created
37+
under this License.
38+
39+
6. Redistributions of any form whatsoever must retain the following
40+
acknowledgment:
41+
"This product includes PHP software, freely available from
42+
<http://www.php.net/software/>".
43+
44+
THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND
45+
ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
46+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
47+
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP
48+
DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
49+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
50+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
51+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
52+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
53+
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
54+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
55+
OF THE POSSIBILITY OF SUCH DAMAGE.
56+
57+
--------------------------------------------------------------------
58+
59+
This software consists of voluntary contributions made by many
60+
individuals on behalf of the PHP Group.
61+
62+
The PHP Group can be contacted via Email at group@php.net.
63+
64+
For more information on the PHP Group and the PHP project,
65+
please see <http://www.php.net>.
66+
67+
PHP includes the Zend Engine, freely available at
68+
<http://www.zend.com>.

packages/extra.spec

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Name: {{ NAME }}
33
Version: {{ VERSION }}
44
Release: 1%{?dist}
55
Group: Applications
6-
License: PHP 3.01
6+
License: Apache-2.0
77
Packager: {{ MAINTAINER }}
88
Vendor: {{ MAINTAINER }}
99
Requires: {{ EXECUTOR_NAME }} >= {{ EXECUTOR_VERSION }}
@@ -17,18 +17,23 @@ BuildArch: noarch
1717
{{ DESC }}
1818

1919
%prep
20+
rm -rf %{buildroot}
21+
22+
%setup -n %{name}
2023

2124
%build
2225

2326
%install
2427

2528
%clean
29+
rm -rf %{buildroot}
2630

2731
%post
2832

2933
%postun
3034

3135
%files
3236
%defattr(-, root, root)
37+
%license usr/share/{{ NAME }}-LICENSE
3338

3439
%changelog

0 commit comments

Comments
 (0)