添加 phpy 扩展 #2338
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build-swoole-cli-linux-aarch64 | |
on: [ push, pull_request ] | |
jobs: | |
linux-aarch64: | |
if: "!contains(github.event.head_commit.message, '--filter=') || contains(github.event.head_commit.message, '[linux-aarch64]')" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Show Environment Info | |
run: | | |
lscpu | |
echo $PATH | |
env | |
docker info | |
id -u | |
id -g | |
who | |
cat /etc/os-release | |
hostnamectl | |
uname -s | |
uname -m | |
uname -r | |
export IPV6=$(ip -6 address show | grep inet6 | awk '{print $2}' | cut -d'/' -f1 | sed -n '2p') | |
export IPV4=$(ip -4 address show | grep inet | grep -v 127.0.0 | awk '{print $2}' | cut -d'/' -f1 | sed -n '1p') | |
echo $IPV4 | |
echo $IPV6 | |
echo "X_IPV6=${IPV6}" >> $GITHUB_ENV | |
echo "X_IPV4=${IPV4}" >> $GITHUB_ENV | |
- name: Prepare Build Environment | |
run: | | |
git submodule update --init | |
sudo mkdir -p /usr/local/swoole-cli | |
uid=$(id -u) && gid=$(id -g) && sudo chown -R ${uid}:${gid} /usr/local/swoole-cli | |
mkdir -p ${{ github.workspace }}/var/build-github-action-container/ | |
- name: Cache PHP Runtime | |
uses: actions/cache@v4 | |
id: php-runtime-cache | |
with: | |
path: ${{ github.workspace }}/bin/runtime | |
key: ${{ runner.os }}-aarch64-php-runtime | |
- name: Cache PHP Vendor | |
uses: actions/cache@v4 | |
id: php-vendor-cache | |
with: | |
path: ${{ github.workspace }}/vendor | |
key: ${{ runner.os }}-aarch64-php-vendor | |
- name: Cache Dependency Source Code Tarball | |
uses: actions/cache@v4 | |
id: pool-cache | |
with: | |
path: ${{ github.workspace }}/pool/ | |
key: source-code-tarball-pool | |
- name: Cache all-library | |
uses: actions/cache@v4 | |
id: all-library-cache | |
with: | |
path: /usr/local/swoole-cli | |
key: ${{ github.head_ref || github.ref_name }}-${{ runner.os }}-aarch64-all-library | |
- name: Cache swoole-cli-builder-image | |
uses: actions/cache@v4 | |
id: swoole-cli-builder-image-aarch64-cache | |
with: | |
path: ${{ github.workspace }}/var/build-github-action-container/swoole-cli-builder-image.tar | |
key: ${{ runner.os }}-aarch64-swoole-cli-builder-image | |
- name: Prepare Libraries and Extensions | |
run: | | |
set -x | |
mkdir -p pool/lib | |
mkdir -p pool/ext | |
mkdir -p bin/runtime | |
bash sapi/download-box/download-box-get-archive-from-server.sh | |
ls -A pool/lib/ | |
ls -A /usr/local/swoole-cli/ | |
- name: Prepare QEMU | |
run: | | |
set -x | |
sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | |
- name: Prepare swoole-cli-builder-image | |
run: | | |
if [ -f ${{ github.workspace }}/var/build-github-action-container/swoole-cli-builder-image.tar ] ; then | |
docker load -i ${{ github.workspace }}/var/build-github-action-container/swoole-cli-builder-image.tar | |
else | |
bash .github/workflows/build-alpine-builder-container.sh --platform "linux/arm64" | |
fi | |
- name: prepare pre-built library | |
uses: addnab/docker-run-action@v3 | |
with: | |
image: docker.io/jingjingxyk/build-swoole-cli:all-dependencies-alpine-3.18-php8-v1.0.0-aarch64-20240618T091126Z | |
options: -v ${{ github.workspace }}:/work -w /work -v /usr/local/swoole-cli/:/usr/local/tmp/ | |
run: | | |
for i in `ls /usr/local/swoole-cli/` | |
do | |
if [ ! -d /usr/local/tmp/${i} ] ; then | |
echo $i | |
cp -rf /usr/local/swoole-cli/${i}/ /usr/local/tmp/${i} | |
fi | |
done | |
- name: Build | |
uses: addnab/docker-run-action@v3 | |
with: | |
image: swoole-cli-builder:latest | |
options: -v ${{ github.workspace }}:/work -w /work -v /usr/local/swoole-cli:/usr/local/swoole-cli | |
run: | | |
set -eux | |
uname -m | |
if [ ! -f bin/runtime/php ] ; then | |
bash setup-php-runtime.sh | |
fi | |
export PATH=/work/bin/runtime:$PATH # 容器已经内置 php 和 composer | |
alias php="php -d curl.cainfo=/work/bin/runtime/cacert.pem -d openssl.cafile=/work/bin/runtime/cacert.pem" | |
sh sapi/quickstart/linux/alpine-init.sh | |
composer install --no-interaction --no-autoloader --no-scripts --profile | |
composer dump-autoload --optimize --profile | |
php prepare.php | |
bash make.sh all-library | |
bash make.sh config | |
bash make.sh build | |
bash make.sh archive | |
- name: Show Build Result | |
uses: addnab/docker-run-action@v3 | |
with: | |
image: swoole-cli-builder:latest | |
options: -v ${{ github.workspace }}:/work -w /work | |
run: | | |
./bin/swoole-cli -v | |
./bin/swoole-cli -m | |
./bin/swoole-cli --ri swoole | |
file ./bin/swoole-cli | |
readelf -h ./bin/swoole-cli | |
APP_VERSION=$(./bin/swoole-cli -v | awk '{print $2}') | |
echo ${APP_VERSION} | |
echo ${APP_VERSION} > APP_VERSION | |
./bin/swoole-cli -r "echo PHP_VERSION;" | |
./bin/swoole-cli ./vendor/bin/phpunit ./sapi/src/UnitTest/MainTest.php --list-tests | |
./bin/swoole-cli ./vendor/bin/phpunit ./sapi/src/UnitTest/MainTest.php | |
- name: get app version | |
run: | | |
APP_VERSION=$(cat ./APP_VERSION) | |
echo $APP_VERSION | |
echo "APP_VERSION=${APP_VERSION}" >> $GITHUB_ENV | |
- name: production artifacts debug | |
uses: actions/upload-artifact@v4 | |
with: | |
name: swoole-cli-v${{ env.APP_VERSION }}-linux-arm64-debug | |
retention-days: 90 | |
path: ./bin/swoole-cli | |
- name: production artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: swoole-cli-v${{ env.APP_VERSION }}-linux-arm64 | |
retention-days: 90 | |
path: ./bin/dist/swoole-cli | |
- name: gh release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: swoole-cli-v${{ env.APP_VERSION }}-linux-arm64.tar.xz |