Skip to content

Commit

Permalink
改进 源码 hash 验证 (#607)
Browse files Browse the repository at this point in the history
* update github action version

* macos setup bin path

* test macos-init.sh

* test

* test

* test

* 改进 源码 hash 验证;修复github action 构建错误

* 修复 github aciton macos 环境下 构建错误,

* macos 环境下 Homebrew packages :   coreutils binutils 不兼容

* 优化显示源码包 hash 值

* github action workflow  macos 保持 x86_64 架构

* show runner macos architecture

* fix workflow

* update macos worfklow

* test macos build

* update macos-x86_64.yml

* upgrade github action config

* update macos-x86_64.yml

* macos build libpng

* github aciton macos with version 12

* update workflow config

* update auto-cache-pool-tarball.yml
  • Loading branch information
jingjingxyk authored May 6, 2024
1 parent 6b0da99 commit df6ceca
Show file tree
Hide file tree
Showing 17 changed files with 189 additions and 88 deletions.
25 changes: 15 additions & 10 deletions .github/workflows/auto-cache-pool-tarball.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
if: 1
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Prepare Source Code
run: |
echo $PATH
Expand Down Expand Up @@ -40,21 +40,21 @@ jobs:
echo "X_IPV4=${IPV4}" >> $GITHUB_ENV
- name: Cache PHP Runtime
uses: actions/cache@v3
uses: actions/cache@v4
id: php-runtime-cache
with:
path: ${{ github.workspace }}/bin/runtime
key: ${{ runner.os }}-x86_64-php-runtime

- name: Cache PHP Vendor
uses: actions/cache@v3
uses: actions/cache@v4
id: php-vendor-cache
with:
path: ${{ github.workspace }}/vendor
key: ${{ runner.os }}-x86_64-php-vendor

- name: Cache Dependency Source Code Tarball
uses: actions/cache@v3
uses: actions/cache@v4
id: pool-cache
with:
path: ${{ github.workspace }}/pool/
Expand All @@ -79,11 +79,14 @@ jobs:
composer install --no-interaction --no-autoloader --no-scripts --profile
composer dump-autoload --optimize --profile
php prepare.php +inotify +apcu +ds +xlswriter +ssh2 +pgsql
php prepare.php +apcu +ds +xlswriter +ssh2 +pgsql @macos
php prepare.php +inotify +apcu +ds +xlswriter +ssh2 +pgsql --show-tarball-hash=1
php prepare.php +apcu +ds +xlswriter +ssh2 +pgsql @macos --show-tarball-hash=1
cd ${{ github.workspace }}/pool/
zip -9 -r ${WORK_DIR}/all-deps.zip ext lib
HASH=$(sha256sum ${WORK_DIR}/all-deps.zip | awk '{print $1}')
echo " all-deps.zip sha265: ${HASH} "
echo -n ${HASH} > ${WORK_DIR}/all-deps.zip.sha256sum
cd ${{ github.workspace }}
- name: Show Build Result
Expand All @@ -93,14 +96,16 @@ jobs:
- name: production artifacts
if: 1
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: cached-all-deps
name: all-deps
retention-days: 90
path: all-deps.zip

- name: gh release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: all-deps.zip
files: |
all-deps.zip
all-deps.zip.sha256sum
18 changes: 9 additions & 9 deletions .github/workflows/linux-aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
if: 1
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Prepare Source Code
run: |
lscpu
Expand Down Expand Up @@ -37,35 +37,35 @@ jobs:
mkdir -p ${{ github.workspace }}/var/build-github-action-container/
- name: Cache PHP Runtime
uses: actions/cache@v3
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@v3
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@v3
uses: actions/cache@v4
id: pool-cache
with:
path: ${{ github.workspace }}/pool/
key: source-code-tarball-pool

- name: Cache all-library
uses: actions/cache@v3
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@v3
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
Expand Down Expand Up @@ -162,21 +162,21 @@ jobs:
echo "APP_VERSION=${APP_VERSION}" >> $GITHUB_ENV
- name: production artifacts debug
uses: actions/upload-artifact@v3
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@v3
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@v1
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: swoole-cli-v${{ env.APP_VERSION }}-linux-arm64.tar.xz
18 changes: 9 additions & 9 deletions .github/workflows/linux-x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
if: 1
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Prepare Source Code
run: |
echo $PATH
Expand Down Expand Up @@ -46,35 +46,35 @@ jobs:
mkdir -p ${{ github.workspace }}/var/build-github-action-container/
- name: Cache PHP Runtime
uses: actions/cache@v3
uses: actions/cache@v4
id: php-runtime-cache
with:
path: ${{ github.workspace }}/bin/runtime
key: ${{ runner.os }}-x86_64-php-runtime

- name: Cache PHP Vendor
uses: actions/cache@v3
uses: actions/cache@v4
id: php-vendor-cache
with:
path: ${{ github.workspace }}/vendor
key: ${{ runner.os }}-x86_64-php-vendor

- name: Cache Dependency Source Code Tarball
uses: actions/cache@v3
uses: actions/cache@v4
id: pool-cache
with:
path: ${{ github.workspace }}/pool/
key: source-code-tarball-pool

- name: Cache all-library
uses: actions/cache@v3
uses: actions/cache@v4
id: all-library-cache
with:
path: /usr/local/swoole-cli
key: ${{ github.head_ref || github.ref_name }}-${{ runner.os }}-x86_64-all-library

- name: Cache swoole-cli-builder-image
uses: actions/cache@v3
uses: actions/cache@v4
id: swoole-cli-builder-image-cache
with:
path: ${{ github.workspace }}/var/build-github-action-container/swoole-cli-builder-image.tar
Expand Down Expand Up @@ -139,21 +139,21 @@ jobs:
./bin/swoole-cli ./vendor/bin/phpunit ./sapi/src/UnitTest/SwoolePGSQLTest.php
- name: production artifacts debug
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: swoole-cli-v${{ env.APP_VERSION }}-linux-x64-debug
retention-days: 90
path: ./bin/swoole-cli

- name: production artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: swoole-cli-v${{ env.APP_VERSION }}-linux-x64
retention-days: 90
path: ./bin/dist/swoole-cli

- name: gh release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: swoole-cli-v${{ env.APP_VERSION }}-linux-x64.tar.xz
43 changes: 31 additions & 12 deletions .github/workflows/macos-x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,24 @@ on: [ push, pull_request ]
jobs:
macos-x86_64:
if: 1
runs-on: macos-latest
runs-on: macos-12
# macos-latest (macos-14) 变更了 CPU 架构,由 x86_64 变更为 arm64
# macos-14 CPU 架构 arm64
# macos-13 CPU 架构 x86_64
# macos-12 CPU 架构 x86_64
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#choosing-github-hosted-runners

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Prepare build environment
run: |
uname -s
uname -m
uname -r
env
echo $HOME
brew config
set -x
bash sapi/quickstart/macos/macos-init.sh
# sudo rm -rf /Library/Developer/CommandLineTools
Expand All @@ -39,7 +48,13 @@ jobs:
echo "X_IPV6=${IPV6}" >> $GITHUB_ENV
echo "X_IPV4=${IPV4}" >> $GITHUB_ENV
export PATH=/usr/local/opt/bison/bin:/usr/local/opt/llvm/bin:$PATH
export PATH=/usr/local/opt/llvm/bin:$PATH
export PATH=/usr/local/opt/flex/bin:$PATH
export PATH=/usr/local/opt/bison/bin:$PATH
export PATH=/usr/local/opt/libtool/bin:$PATH
libtoolize --version
libtool --help-all
# brew bison --debug
CURRENT_USER=$(whoami)
Expand All @@ -49,28 +64,28 @@ jobs:
git submodule update --init
- name: Cache PHP Runtime
uses: actions/cache@v3
uses: actions/cache@v4
id: php-runtime-cache
with:
path: ${{ github.workspace }}/bin/runtime
key: ${{ runner.os }}-x86_64-php-runtime

- name: Cache PHP Vendor
uses: actions/cache@v3
uses: actions/cache@v4
id: php-vendor-cache
with:
path: ${{ github.workspace }}/vendor
key: ${{ runner.os }}-x86_64-php-vendor

- name: Cache Dependency Source Code Tarball
uses: actions/cache@v3
uses: actions/cache@v4
id: pool-cache
with:
path: ${{ github.workspace }}/pool/
key: source-code-tarball-pool

- name: Cache all-library
uses: actions/cache@v3
uses: actions/cache@v4
id: all-library-cache
with:
path: /usr/local/swoole-cli
Expand All @@ -97,11 +112,15 @@ jobs:
composer install --no-interaction --no-autoloader --no-scripts --profile
composer dump-autoload --optimize --profile
php prepare.php --without-docker=1 +ds +apcu +xlswriter +ssh2 --with-build-type=release --with-swoole-pgsql=1
php prepare.php --without-docker=1 +ds +apcu +xlswriter +ssh2 --with-build-type=release
- name: Build
run: |
export PATH=${{ github.workspace }}/bin/runtime:$PATH
export PATH=/usr/local/opt/llvm/bin:$PATH
export PATH=/usr/local/opt/flex/bin:$PATH
export PATH=/usr/local/opt/bison/bin:$PATH
export PATH=/usr/local/opt/libtool/bin:$PATH
bash ./make.sh all-library
Expand All @@ -123,21 +142,21 @@ jobs:
./bin/swoole-cli ./vendor/bin/phpunit ./sapi/src/UnitTest/MainTest.php
- name: Archive production artifacts debug
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: swoole-cli-v${{ env.APP_VERSION }}-macos-x64-debug
retention-days: 90
path: ./bin/swoole-cli

- name: Archive production artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: swoole-cli-v${{ env.APP_VERSION }}-macos-x64
retention-days: 90
path: ./bin/dist/swoole-cli

- name: gh release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: swoole-cli-v${{ env.APP_VERSION }}-macos-x64.tar.xz
10 changes: 5 additions & 5 deletions .github/workflows/windows-cygwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ jobs:
git config --global core.eol lf
ipconfig
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Prepare submodule
run: |
git submodule update --init
- name: Cache cygwin packages
id: cache-cygwin
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: cache-cygwin-packages
with:
Expand All @@ -29,7 +29,7 @@ jobs:

- name: Cache pool
id: cache-cygwin-pool
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: "${{ github.workspace }}\\pool\\"
key: ${{ runner.os }}-build-pool-cache
Expand Down Expand Up @@ -104,14 +104,14 @@ jobs:
bash ./sapi/scripts/cygwin/cygwin-archive.sh
- name: production artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: swoole-cli-v${{ env.APP_VERSION }}-cygwin-x64
retention-days: 90
path: swoole-cli-v${{ env.APP_VERSION }}-cygwin-x64.zip

- name: gh release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
8 changes: 7 additions & 1 deletion docs/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,10 @@ php ./prepare.php --with-parallel-jobs=8
with-build-type
----
构建类型,默认是 release
可选项: release debug dev
可选项: release debug dev


show-tarball-hash
---
计算并显示已下载的源码包 HASH 值

2 changes: 1 addition & 1 deletion ext/swoole
Submodule swoole updated 134 files
Loading

0 comments on commit df6ceca

Please sign in to comment.