|
| 1 | +name: build-swoole-cli-linux-glibc-x86_64 |
| 2 | + |
| 3 | +on: [ push, pull_request ] |
| 4 | + |
| 5 | +jobs: |
| 6 | + linux-glibc: |
| 7 | + if: ${{ 0 && !contains(github.event.head_commit.message, '--filter=') || contains(github.event.head_commit.message, '[linux-glibc]') }} |
| 8 | + strategy: |
| 9 | + fail-fast: false |
| 10 | + matrix: |
| 11 | + os: [ ubuntu-22.04, ubuntu-22.04-arm ] |
| 12 | + name: linux-glibc-${{ matrix.os }} |
| 13 | + runs-on: ${{ matrix.os }} |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v4 |
| 16 | + - name: Show Environment Info |
| 17 | + run: | |
| 18 | + echo $PATH |
| 19 | + env |
| 20 | + docker info |
| 21 | + id -u |
| 22 | + id -g |
| 23 | + who |
| 24 | + cat /etc/os-release |
| 25 | + hostnamectl |
| 26 | + uname -s |
| 27 | + uname -m |
| 28 | + uname -r |
| 29 | +
|
| 30 | + cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c |
| 31 | + cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l |
| 32 | + cat /proc/cpuinfo | grep "cpu cores" | uniq |
| 33 | + cat /proc/cpuinfo| grep "processor"| wc -l |
| 34 | + lscpu |
| 35 | +
|
| 36 | + export IPV6=$(ip -6 address show | grep inet6 | awk '{print $2}' | cut -d'/' -f1 | sed -n '2p') |
| 37 | + export IPV4=$(ip -4 address show | grep inet | grep -v 127.0.0 | awk '{print $2}' | cut -d'/' -f1 | sed -n '1p') |
| 38 | + echo $IPV4 |
| 39 | + echo $IPV6 |
| 40 | + echo "X_IPV6=${IPV6}" >> $GITHUB_ENV |
| 41 | + echo "X_IPV4=${IPV4}" >> $GITHUB_ENV |
| 42 | +
|
| 43 | + - name: Prepare Build Environment |
| 44 | + run: | |
| 45 | + git submodule update --init |
| 46 | +
|
| 47 | + sudo mkdir -p /usr/local/swoole-cli |
| 48 | + uid=$(id -u) && gid=$(id -g) && sudo chown -R ${uid}:${gid} /usr/local/swoole-cli |
| 49 | +
|
| 50 | + mkdir -p ${{ github.workspace }}/var/build-github-action-container/ |
| 51 | +
|
| 52 | + - name: Cache PHP Runtime |
| 53 | + uses: actions/cache@v4 |
| 54 | + id: php-runtime-cache-x86_64 |
| 55 | + with: |
| 56 | + path: ${{ github.workspace }}/runtime |
| 57 | + key: ${{ runner.os }}-x86_64-php-runtime |
| 58 | + |
| 59 | + - name: Cache PHP Vendor |
| 60 | + uses: actions/cache@v4 |
| 61 | + id: php-vendor-cache-x86_64 |
| 62 | + with: |
| 63 | + path: ${{ github.workspace }}/vendor |
| 64 | + key: ${{ runner.os }}-x86_64-php-vendor |
| 65 | + |
| 66 | + - name: Cache Dependency Source Code Tarball |
| 67 | + uses: actions/cache@v4 |
| 68 | + id: pool-cache |
| 69 | + with: |
| 70 | + path: ${{ github.workspace }}/pool/ |
| 71 | + key: source-code-tarball-pool |
| 72 | + |
| 73 | + - name: Cache all-library |
| 74 | + uses: actions/cache@v4 |
| 75 | + id: all-library-cache-x86_64 |
| 76 | + with: |
| 77 | + path: /usr/local/swoole-cli |
| 78 | + key: ${{ github.head_ref || github.ref_name }}-${{ runner.os }}-x86_64-all-library |
| 79 | + |
| 80 | + - name: Prepare Runtime and Libraries and Extensions |
| 81 | + run: | |
| 82 | + set -x |
| 83 | + mkdir -p pool/lib |
| 84 | + mkdir -p pool/ext |
| 85 | + mkdir -p bin/ |
| 86 | + mkdir -p runtime/ |
| 87 | + test -f runtime/php && rm -f runtime/php |
| 88 | + if [ ! -f runtime/php/php ] ; then |
| 89 | + bash setup-php-runtime.sh |
| 90 | + fi |
| 91 | + bash sapi/download-box/download-box-get-archive-from-server.sh |
| 92 | + ls -A pool/lib/ |
| 93 | + ls -A /usr/local/swoole-cli/ |
| 94 | +
|
| 95 | + - name: Build |
| 96 | + run: | |
| 97 | + set -eux |
| 98 | + uname -m |
| 99 | + composer install --no-interaction --no-autoloader --no-scripts --profile |
| 100 | + composer dump-autoload --optimize --profile |
| 101 | +
|
| 102 | + php prepare.php --with-libavif |
| 103 | +
|
| 104 | + sudo apt update |
| 105 | + bash ./sapi/scripts/install-deps-on-ubuntu.sh |
| 106 | + bash ./ext/swoole/scripts/install-deps-on-ubuntu.sh |
| 107 | + bash ./sapi/scripts/build-swoole-cli-with-linux-gcc.sh |
| 108 | +
|
| 109 | + ./bin/swoole-cli -v |
| 110 | + ./bin/swoole-cli -m |
| 111 | + ./bin/swoole-cli --ri curl |
| 112 | + ./bin/swoole-cli --ri gd |
| 113 | + ./bin/swoole-cli --ri imagick |
| 114 | + ./bin/swoole-cli --ri swoole |
| 115 | + { ldd ./bin/swoole-cli ; } || { echo $? ; } ; |
| 116 | + file ./bin/swoole-cli |
| 117 | +
|
| 118 | + - name: Make nfpm package |
| 119 | + run: | |
| 120 | + ARCH=$(uname -m) |
| 121 | + if [ "$ARCH" = "aarch64" ]; then |
| 122 | + NFPM_ARCH="arm64" |
| 123 | + else |
| 124 | + NFPM_ARCH="amd64" |
| 125 | + fi |
| 126 | + wget https://github.com/goreleaser/nfpm/releases/download/v2.43.4/nfpm_2.43.4_${NFPM_ARCH}.deb |
| 127 | + sudo dpkg -i nfpm_2.43.4_${NFPM_ARCH}.deb |
| 128 | + strip ./bin/swoole-cli |
| 129 | + ./make.sh nfpm-pkg |
| 130 | + ls -ls ./*.deb |
| 131 | + ls -ls ./*.rpm |
| 132 | +
|
| 133 | + - name: upload artifacts to cloud object storage |
| 134 | + if: ${{ (github.repository == 'swoole/swoole-cli') && (startsWith(github.ref, 'refs/tags/')) }} |
| 135 | + env: |
| 136 | + OSS_SECRET_ID: ${{ secrets.QCLOUD_OSS_SECRET_ID }} |
| 137 | + OSS_SECRET_KEY: ${{ secrets.QCLOUD_OSS_SECRET_KEY }} |
| 138 | + OSS_BUCKET: ${{ vars.QCLOUD_OSS_BUCKET }} |
| 139 | + OSS_REGION: ${{ vars.QCLOUD_OSS_REGION }} |
| 140 | + run: | |
| 141 | + ARCH=$(uname -m) |
| 142 | + if [ "$ARCH" = "aarch64" ]; then |
| 143 | + FILE_ARCH="arm64" |
| 144 | + else |
| 145 | + FILE_ARCH="x64" |
| 146 | + fi |
| 147 | + SWOOLE_VERSION=$(awk 'NR==1{ print $1 }' "sapi/SWOOLE-VERSION.conf") |
| 148 | + OS="linux" |
| 149 | + bash sapi/scripts/tencent-cloud-object-storage.sh --upload-file ${{ github.workspace }}/swoole-cli-"${SWOOLE_VERSION}-${OS}-${FILE_ARCH}"-glibc.deb |
| 150 | + bash sapi/scripts/tencent-cloud-object-storage.sh --upload-file ${{ github.workspace }}/swoole-cli-"${SWOOLE_VERSION}-${OS}-${FILE_ARCH}"-glibc.rpm |
0 commit comments