Skip to content

Commit

Permalink
Enabled ARM64 build (#51)
Browse files Browse the repository at this point in the history
* Enabled ARM64 build
* Fixed NOTICE file
  • Loading branch information
intuibase authored Jul 5, 2024
1 parent 805137d commit ddb8c54
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 8 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ jobs:
BUILD_ARCHITECTURE: ${{ matrix.arch }}
steps:
- uses: actions/checkout@v4
- if: ${{ matrix.run_qemu }}
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- uses: actions/download-artifact@v4
with:
name: build-native-${{ matrix.arch }}
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
build_arch:
required: true
type: string
default: 'x86_64'
default: 'all'
pull_request:
paths-ignore:
- "**/*.asciidoc"
Expand All @@ -33,6 +33,8 @@ concurrency:
jobs:
build-native:
uses: ./.github/workflows/build-native.yml
with:
build_arch: all

build-php-deps:
uses: ./.github/workflows/build-php-deps.yml
Expand All @@ -45,11 +47,15 @@ jobs:
- build-native
- build-php-deps
uses: ./.github/workflows/build-packages.yml
with:
build_arch: all

tests-phpt:
needs:
- build-native
uses: ./.github/workflows/test-phpt.yml
with:
build_arch: all

# The very last job to report whether the Workflow passed.
# This will act as the Branch Protection gatekeeper
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
build:
uses: ./.github/workflows/build.yml
with:
build_arch: 'x86_64'
build_arch: 'all'

sign:
runs-on: ubuntu-latest
Expand Down
8 changes: 4 additions & 4 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This project depends on folliwng packages:
Package name: Boost C++ Libraries
Version: 1.83.0
Authors: Boost contributors (https://github.com/boostorg/boost/graphs/contributors)
Licenses: BSL-1.0 license
Licenses: BSL-1.0 license
URL: https://github.com/boostorg/boost/tree/boost-1.83.0


Expand Down Expand Up @@ -45,7 +45,7 @@ DEALINGS IN THE SOFTWARE.
Package name: libcurl
Version: 8.0.1
Authors: Daniel Stenberg, <[email protected]>, and many contributors
Licenses: Custom (https://github.com/curl/curl/blob/curl-8_0_1/COPYING)
Licenses: curl (https://github.com/curl/curl/blob/curl-8_0_1/COPYING)
URL: https://github.com/curl/curl/blob/curl-8_0_1/

curl/COPYING content:
Expand Down Expand Up @@ -78,7 +78,7 @@ in this Software without prior written authorization of the copyright holder.
Package name: libunwind
Version: 1.6.2
Authors: David Mosberger <[email protected]>
Licenses: MIT licenses
Licenses: MIT
URL: https://github.com/libunwind/libunwind/tree/b3ca1b59a795a617877c01fe5d299ab7a07ff29d

No NOTICE file found
Expand Down Expand Up @@ -129,7 +129,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Package name: zlib
Version: 1.3
Authors: Jean-loup Gailly <[email protected]> and Mark Adler <[email protected]>
Licenses: Custom zlib license (https://github.com/madler/zlib/blob/09155eaa2f9270dc4ed1fa13e2b4b2613e6e4851/LICENSE)
Licenses: Zlib (https://github.com/madler/zlib/blob/09155eaa2f9270dc4ed1fa13e2b4b2613e6e4851/LICENSE)
URL: https://github.com/madler/zlib/tree/09155eaa2f9270dc4ed1fa13e2b4b2613e6e4851

No NOTICE file found
Expand Down
8 changes: 7 additions & 1 deletion prod/native/extension/phpt/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,13 @@ else
ALPINE_IMAGE=-alpine
fi

ELASTIC_AGENT_PHP_PATH=${PWD}/../../../php
DOCKER_PLATFORM="linux/x86_64"
if [[ "${BUILD_ARCHITECTURE}" =~ arm64$ ]]; then
DOCKER_PLATFORM="linux/arm64"
fi
echo "Running on platform ${DOCKER_PLATFORM}";

ELASTIC_AGENT_PHP_PATH=${PWD}/../../../php

LOCAL_TMP_DIR=$(mktemp -d)

Expand All @@ -71,6 +76,7 @@ mkdir -p "${LOCAL_TMP_DIR}/$(dirname ${TESTS_TO_RUN})"
cp -R "${TESTS_TO_RUN}" "${LOCAL_TMP_DIR}/${TESTS_TO_RUN}"

docker run --rm \
--platform ${DOCKER_PLATFORM} \
-v ${LOCAL_TMP_DIR}/tests:/phpt-tests/tests \
-v ./tests_util:/phpt-tests/tests_util \
-v ${LOCAL_LOG_FAILED_TESTS}:${LOG_FAILED_TESTS} \
Expand Down
7 changes: 7 additions & 0 deletions prod/native/phpbridge_extension/phpt/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ else
ALPINE_IMAGE=-alpine
fi

DOCKER_PLATFORM="linux/x86_64"
if [[ "${BUILD_ARCHITECTURE}" =~ arm64$ ]]; then
DOCKER_PLATFORM="linux/arm64"
fi
echo "Running on platform ${DOCKER_PLATFORM}";

ELASTIC_AGENT_PHP_PATH=${PWD}/../../../php


Expand All @@ -71,6 +77,7 @@ mkdir -p ${LOCAL_TMP_DIR}/$(dirname ${TESTS_TO_RUN})
cp -R ${TESTS_TO_RUN} ${LOCAL_TMP_DIR}/${TESTS_TO_RUN}

docker run --rm \
--platform ${DOCKER_PLATFORM} \
-v ${LOCAL_TMP_DIR}/tests:/phpt-tests/tests \
-v ${LOCAL_LOG_FAILED_TESTS}:${LOG_FAILED_TESTS} \
-v ${LOCAL_LOG_TEST_RUN}:${LOG_TEST_RUN} \
Expand Down
14 changes: 13 additions & 1 deletion tools/build/build_packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,12 @@ test_package() {
local PHP_VERSION=8.3
local PKG_TYPE=$1
local PKG_FILENAME=$2
local DOCKER_PLATFORM=$3

echo ${PKG_FILENAME}

echo "Starting ${PKG_FILENAME} smoke test"
echo "Running on platform ${DOCKER_PLATFORM}";

local TEST_LICENSE_FILES="echo -n 'Checking for \"copyright\" files existence: ' && test -f /opt/elastic/elastic-otel-php/LICENSE && test -f /opt/elastic/elastic-otel-php/NOTICE && echo -e '\033[0;32mOK\033[0;39m'"

Expand All @@ -78,6 +80,7 @@ test_package() {
local INSTALL_SMOKE="apk add --allow-untrusted --verbose --no-cache /source/build/packages/${PKG_FILENAME} && php /source/packaging/test/smokeTest.php"
local UNINSTALL_SMOKE="apk del --verbose --no-cache elastic-otel-php && php /source/packaging/test/smokeTestUninstalled.php"
docker run --rm \
--platform ${DOCKER_PLATFORM} \
-v ${PWD}:/source \
-e ELASTIC_OTEL_LOG_LEVEL_STDERR=error \
php:${PHP_VERSION}-alpine sh -c "ls /source/build/packages && ${INSTALL_SMOKE} && ${TEST_LICENSE_FILES} && ${UNINSTALL_SMOKE} && ls -alR /opt/elastic"
Expand All @@ -86,6 +89,7 @@ test_package() {
local INSTALL_SMOKE="dpkg -i /source/build/packages/${PKG_FILENAME} && php /source/packaging/test/smokeTest.php"
local UNINSTALL_SMOKE="dpkg --purge elastic-otel-php && php /source/packaging/test/smokeTestUninstalled.php"
docker run --rm \
--platform ${DOCKER_PLATFORM} \
-v ${PWD}:/source \
-e ELASTIC_OTEL_LOG_LEVEL_STDERR=error \
php:${PHP_VERSION} sh -c "ls /source/build/packages && ${INSTALL_SMOKE} && ${TEST_LICENSE_FILES} && ${UNINSTALL_SMOKE} && ls -alR /opt/elastic"
Expand All @@ -96,6 +100,7 @@ test_package() {
local UNINSTALL_SMOKE="rpm -ve elastic-otel-php && php /source/packaging/test/smokeTestUninstalled.php"

docker run --rm \
--platform ${DOCKER_PLATFORM} \
-v ${PWD}:/source \
-e ELASTIC_OTEL_LOG_LEVEL_STDERR=error \
redhat/ubi9 sh -c "ls /source/build/packages && ${INSTALL_PHP} && ${INSTALL_SMOKE} && ${TEST_LICENSE_FILES} && ${UNINSTALL_SMOKE} && ls -alR /opt/elastic"
Expand Down Expand Up @@ -130,6 +135,12 @@ export BUILD_ARCHITECUTRE="${BUILD_ARCHITECUTRE}"
export PACKAGE_GOARCHITECTURE="${PACKAGE_GOARCHITECTURE}"
export PACKAGE_SHA="${PACKAGE_SHA}"

DOCKER_PLATFORM="linux/x86_64"
if [[ "${BUILD_ARCHITECTURE}" =~ arm64$ ]]; then
DOCKER_PLATFORM="linux/arm64"
fi
echo "Running on platform ${DOCKER_PLATFORM}";

mkdir -p "${PWD}/build/packages"
envsubst <packaging/nfpm.yaml >${PWD}/build/packages/nfpm.yaml

Expand All @@ -138,6 +149,7 @@ do
echo "Building package type: ${PKG}"

docker run --rm \
--platform ${DOCKER_PLATFORM} \
-e PACKAGE_VERSION="${PACKAGE_VERSION}" \
-e BUILD_ARCHITECUTRE="${BUILD_ARCHITECUTRE}" \
-e PACKAGE_GOARCHITECTURE="${PACKAGE_GOARCHITECTURE}" \
Expand All @@ -157,7 +169,7 @@ do
md5sum "${PKG_FILENAME}" >"${PKG_FILENAME}".sha512
popd

test_package ${pkg} "${PKG_FILENAME}"
test_package ${pkg} "${PKG_FILENAME}" "${DOCKER_PLATFORM}"

done

Expand Down

0 comments on commit ddb8c54

Please sign in to comment.