Skip to content

update

update #351

Workflow file for this run

name: build-php-cli-linux-riscv64
on: [ push, pull_request ]
jobs:
linux-riscv:
if: 0
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Prepare Source Code
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
# 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 Vendor
uses: actions/cache@v3
id: php-vendor-cache
with:
path: ${{ github.workspace }}/vendor
key: ${{ runner.os }}-riscv64-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 swoole-cli-builder-image
uses: actions/cache@v4
id: swoole-cli-builder-image-riscv64-cache
with:
path: ${{ github.workspace }}/var/build-github-action-container/swoole-cli-builder-image.tar
key: ${{ runner.os }}-riscv64-swoole-cli-builder-image
- name: Prepare Libraries and Extensions
run: |
set -x
mkdir -p pool/lib
mkdir -p pool/ext
bash sapi/download-box/download-box-get-archive-from-container.sh
ls -A pool/lib/
ls -A /usr/local/swoole-cli/
- name: Set up QEMU
# Add support for more platforms with QEMU (optional)
# https://github.com/docker/setup-qemu-action
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# 例子: https://github.com/tuna/tunasync-scripts/blob/master/.github/workflows/docker-images.yml#L102
- 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-debian-builder-container.sh --platform "linux/riscv64" --container-image "debian:unstable"
fi
- name: prepare pre-built library
if: 1
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: |
for i in `ls /usr/local/swoole-cli/`
do
echo $i
done
uname -a
uname -s
uname -m
apt install -y php-dev php-cli
- name: Build
if: 1
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 runtime/php/php ] ; then
bash setup-php-runtime.sh
fi
export PATH=/work/runtime/php/:$PATH # 容器已经内置 php 和 composer
alias php="php -d curl.cainfo=/work/runtime/php/cacert.pem -d openssl.cafile=/work/runtime/php/cacert.pem"
sh sapi/quickstart/linux/alpine-init.sh
composer install --no-interaction --no-autoloader --no-scripts --profile --no-dev
composer dump-autoload --optimize --profile --no-dev
php prepare.php --with-override-default-enabled-ext=1 --with-php-version=8.3.4 --with-c-compiler=musl-gcc
bash make-install-deps.sh
bash make.sh all-library
bash make.sh config
bash make.sh build
bash make.sh archive
- name: Show Build Result
if: 1
uses: addnab/docker-run-action@v3
with:
image: swoole-cli-builder:latest
options: -v ${{ github.workspace }}:/work -w /work
run: |
./thirdparty/php-src/sapi/cli/php -v
./thirdparty/php-src/sapi/cli/php -m
BUILD_PHP_VERSION=$(./thirdparty/php-src/sapi/cli/php -v | head -n 1 | awk '{print $2}')
file ./bin/php-${BUILD_PHP_VERSION}/bin/php
readelf -h ./bin/php-${BUILD_PHP_VERSION}/bin/php
APP_VERSION=$(./bin/php-${BUILD_PHP_VERSION}/bin/php -v | head -n 1 | awk '{print $2}')
echo ${APP_VERSION}
echo ${APP_VERSION} > APP_VERSION
./bin/php-${BUILD_PHP_VERSION}/bin/php -r "echo PHP_VERSION;"
- name: get app version
if: 1
run: |
APP_VERSION=$(cat ./APP_VERSION)
echo $APP_VERSION
echo "APP_VERSION=${APP_VERSION}" >> $GITHUB_ENV
echo "BUILD_PHP_VERSION=${APP_VERSION}" >> $GITHUB_ENV
- name: production artifacts debug
if: 0
uses: actions/upload-artifact@v4
with:
name: php-cli-v${{ env.APP_VERSION }}-linux-riscv64-debug
retention-days: 90
path: ./bin/php-${{ env.BUILD_PHP_VERSION }}/bin/php
- name: production artifacts
if: 0
uses: actions/upload-artifact@v4
with:
name: php-cli-v${{ env.APP_VERSION }}-linux-riscv64
retention-days: 90
path: ./bin/php-${{ env.BUILD_PHP_VERSION }}/bin/dist/php
- name: gh release
uses: softprops/action-gh-release@v2
if: 0 && startsWith(github.ref, 'refs/tags/')
with:
files: |
php-cli-v${{ env.APP_VERSION }}-linux-riscv64.tar.xz
php-cli-v${{ env.APP_VERSION }}-linux-riscv64-debug.tar.xz