This commit is contained in:
Dengke Tang
2023-02-28 16:16:27 -08:00
parent 21b8f0052a
commit 1226b906c6
2 changed files with 177 additions and 172 deletions
+172 -172
View File
@@ -1,188 +1,188 @@
name: CI # name: CI
on: # on:
push: # push:
branches-ignore: # branches-ignore:
- 'main' # - 'main'
env: # env:
BUILDER_VERSION: v0.8.18 # BUILDER_VERSION: v0.8.18
BUILDER_SOURCE: releases # BUILDER_SOURCE: releases
BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net # BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net
PACKAGE_NAME: aws-crt-php # PACKAGE_NAME: aws-crt-php
LINUX_BASE_IMAGE: ubuntu-16-x64 # LINUX_BASE_IMAGE: ubuntu-16-x64
RUN: ${{ github.run_id }}-${{ github.run_number }} # RUN: ${{ github.run_id }}-${{ github.run_number }}
jobs: # jobs:
php-5_5-linux-x64: # php-5_5-linux-x64:
name: php-linux-x64 (5.5) # name: php-linux-x64 (5.5)
runs-on: ubuntu-latest # runs-on: ubuntu-latest
steps: # steps:
- name: Setup PHP with Xdebug # - name: Setup PHP with Xdebug
uses: shivammathur/setup-php@v2 # uses: shivammathur/setup-php@v2
with: # with:
coverage: xdebug # coverage: xdebug
php-version: 5.5 # php-version: 5.5
ini-values: xdebug.overload_var_dump=0, memory_limit=4G, phar.readonly=false # ini-values: xdebug.overload_var_dump=0, memory_limit=4G, phar.readonly=false
- name: Checkout # - name: Checkout
uses: actions/checkout@v2 # uses: actions/checkout@v2
with: # with:
submodules: recursive # submodules: recursive
- name: Build for PHP 5.5 # - name: Build for PHP 5.5
env: # env:
CC: clang # CC: clang
CXX: clang++ # CXX: clang++
run: | # run: |
phpize # phpize
./configure # ./configure
make # make
- name: Install dependencies # - name: Install dependencies
# get path to composer.phar so we can run it with custom php.ini # # get path to composer.phar so we can run it with custom php.ini
run: | # run: |
COMPOSER_PHAR=$(realpath $(which composer)) # COMPOSER_PHAR=$(realpath $(which composer))
php -c php.ini $COMPOSER_PHAR update --no-interaction # php -c php.ini $COMPOSER_PHAR update --no-interaction
php-linux-x64: # php-linux-x64:
runs-on: ubuntu-latest # runs-on: ubuntu-latest
strategy: # strategy:
fail-fast: false # fail-fast: false
matrix: # matrix:
version: # version:
- "5.6" # - "5.6"
- "7.0" # - "7.0"
- "7.1" # - "7.1"
- "7.2" # - "7.2"
- "7.3" # - "7.3"
- "7.4" # - "7.4"
- "8.0" # - "8.0"
steps: # steps:
- name: Setup PHP with Xdebug # - name: Setup PHP with Xdebug
uses: shivammathur/setup-php@v2 # uses: shivammathur/setup-php@v2
with: # with:
coverage: xdebug # coverage: xdebug
php-version: ${{matrix.version}} # php-version: ${{matrix.version}}
ini-values: xdebug.overload_var_dump=0, memory_limit=4G, phar.readonly=false # ini-values: xdebug.overload_var_dump=0, memory_limit=4G, phar.readonly=false
- name: Checkout # - name: Checkout
uses: actions/checkout@v2 # uses: actions/checkout@v2
with: # with:
submodules: recursive # submodules: recursive
- name: Run tests # - name: Run tests
env: # env:
CC: clang # CC: clang
CXX: clang++ # CXX: clang++
run: | # run: |
phpize # phpize
./configure # ./configure
make # make
./dev-scripts/run_tests.sh # ./dev-scripts/run_tests.sh
# linux-arm: # # linux-arm:
# name: ARM (${{ matrix.arch }}) # # name: ARM (${{ matrix.arch }})
# runs-on: ubuntu-latest # # runs-on: ubuntu-latest
# strategy: # # strategy:
# matrix: # # matrix:
# arch: [armv6, armv7, arm64] # # arch: [armv6, armv7, arm64]
# steps: # # steps:
# - name: Build ${{ env.PACKAGE_NAME }} # # - name: Build ${{ env.PACKAGE_NAME }}
# run: | # # run: |
# python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')" # # python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')"
# chmod a+x builder # # chmod a+x builder
# ./builder build -p ${{ env.PACKAGE_NAME }} --target=linux-${{ matrix.arch }} --spec=downstream # # ./builder build -p ${{ env.PACKAGE_NAME }} --target=linux-${{ matrix.arch }} --spec=downstream
windows-vc16: # windows-vc16:
runs-on: windows-2019 # runs-on: windows-2019
defaults: # defaults:
run: # run:
shell: cmd # use CMD instead of powershell to catch error from bat script # shell: cmd # use CMD instead of powershell to catch error from bat script
strategy: # strategy:
matrix: # matrix:
arch: [x64] # arch: [x64]
steps: # steps:
- uses: actions/checkout@v3 # - uses: actions/checkout@v3
with: # with:
submodules: recursive # submodules: recursive
- id: setup-php-sdk # - id: setup-php-sdk
uses: cmb69/[email protected] # uses: cmb69/[email protected]
with: # with:
version: '8.0' # version: '8.0'
arch: ${{ matrix.arch }} # arch: ${{ matrix.arch }}
ts: ts # ts: ts
deps: openssl # deps: openssl
- uses: ilammy/msvc-dev-cmd@v1 # - uses: ilammy/msvc-dev-cmd@v1
with: # with:
arch: ${{ matrix.arch }} # arch: ${{ matrix.arch }}
toolset: ${{steps.setup-php-sdk.outputs.toolset}} # toolset: ${{steps.setup-php-sdk.outputs.toolset}}
# not sure why CMD can't do multiline run statements # # not sure why CMD can't do multiline run statements
- run: phpize # - run: phpize
- run: .\configure --with-prefix=${{steps.setup-php-sdk.outputs.prefix}} --enable-awscrt=shared --enable-cli --enable-openssl # - run: .\configure --with-prefix=${{steps.setup-php-sdk.outputs.prefix}} --enable-awscrt=shared --enable-cli --enable-openssl
- run: nmake # - run: nmake
- run: nmake generate-php-ini # - run: nmake generate-php-ini
- run: .\dev-scripts\run_tests.bat ${{steps.setup-php-sdk.outputs.prefix}}\php # - run: .\dev-scripts\run_tests.bat ${{steps.setup-php-sdk.outputs.prefix}}\php
# windows-vc14: # # windows-vc14:
# runs-on: windows-latest # # runs-on: windows-latest
# strategy: # # strategy:
# matrix: # # matrix:
# arch: [x86, x64] # # arch: [x86, x64]
# steps: # # steps:
# - uses: ilammy/msvc-dev-cmd@v1 # # - uses: ilammy/msvc-dev-cmd@v1
# with: # # with:
# toolset: 14.0 # # toolset: 14.0
# arch: ${{ matrix.arch }} # # arch: ${{ matrix.arch }}
# uwp: false # # uwp: false
# spectre: true # # spectre: true
# - name: Build ${{ env.PACKAGE_NAME }} + consumers # # - name: Build ${{ env.PACKAGE_NAME }} + consumers
# run: | # # run: |
# python -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder.pyz')" # # python -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder.pyz')"
# python builder.pyz build -p ${{ env.PACKAGE_NAME }} downstream # # python builder.pyz build -p ${{ env.PACKAGE_NAME }} downstream
macos: # macos:
runs-on: macos-${{ matrix.version }} # runs-on: macos-${{ matrix.version }}
strategy: # strategy:
matrix: # matrix:
version: [10.15] # version: [10.15]
steps: # steps:
# Force PHP to 8.0 # # Force PHP to 8.0
# Doing this because tests fail in PHP 8.1 (default on macos Github Runner as of Dec 2021) # # Doing this because tests fail in PHP 8.1 (default on macos Github Runner as of Dec 2021)
# due to the old version of PHPUnit we're using. # # due to the old version of PHPUnit we're using.
# We're using an old PHPUnit because it's compatible our min supported PHP 5.5. # # We're using an old PHPUnit because it's compatible our min supported PHP 5.5.
# Quick fix is to force PHP version back to 8.0, which can still run our tests without error. # # Quick fix is to force PHP version back to 8.0, which can still run our tests without error.
# A real solution is to get our tests working on all PHP versions # # A real solution is to get our tests working on all PHP versions
# (maybe don't use PHPUnit, maybe raise our min supported PHP version so we can upgrade, # # (maybe don't use PHPUnit, maybe raise our min supported PHP version so we can upgrade,
# or maybe use PHPUnit-Polyfills so we can use a modern PHPUnit with old PHP) # # or maybe use PHPUnit-Polyfills so we can use a modern PHPUnit with old PHP)
- name: Setup PHP 8.0 # - name: Setup PHP 8.0
uses: shivammathur/setup-php@v2 # uses: shivammathur/setup-php@v2
with: # with:
php-version: '8.0' # php-version: '8.0'
- name: Build PHP 8 extension and test # - name: Build PHP 8 extension and test
run: | # run: |
python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')" # python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')"
chmod a+x builder # chmod a+x builder
./builder build -p ${{ env.PACKAGE_NAME }} --spec=downstream # ./builder build -p ${{ env.PACKAGE_NAME }} --spec=downstream
pecl-package-test: # pecl-package-test:
runs-on: ubuntu-latest # runs-on: ubuntu-latest
steps: # steps:
- name: Setup PHP # - name: Setup PHP
uses: shivammathur/setup-php@v2 # uses: shivammathur/setup-php@v2
with: # with:
php-version: '8.0' # php-version: '8.0'
- name: Checkout # - name: Checkout
uses: actions/checkout@v2 # uses: actions/checkout@v2
with: # with:
submodules: recursive # submodules: recursive
- name: Test PECL package build # - name: Test PECL package build
run: | # run: |
python3 dev-scripts/prepare_pecl_release.py --name aws-crt --user aws-crt --version 1.0.0 # python3 dev-scripts/prepare_pecl_release.py --name aws-crt --user aws-crt --version 1.0.0
tar -zxf *.tgz # tar -zxf *.tgz
cd awscrt-1.0.0 # cd awscrt-1.0.0
phpize # phpize
./configure # ./configure
make # make
+5
View File
@@ -35,6 +35,11 @@ jobs:
- name: Prepare Package Script - name: Prepare Package Script
# Update the version in code and generate the package. # Update the version in code and generate the package.
run: | run: |
version=$(git describe --tags --abbrev=0)
version_without_v=$(echo ${version} | cut -f2 -dv)
echo "${version_without_v}" > VERSION
echo $VERSION
echo ${{ steps.tag.outputs.release_tag }}
sed -i "s/#define CRT_VERSION \"[0-9]\+\.[0-9]\+\.[0-9]\+\"/#define CRT_VERSION \"${{ steps.tag.outputs.release_tag }}\"/g" ext/crt.c sed -i "s/#define CRT_VERSION \"[0-9]\+\.[0-9]\+\.[0-9]\+\"/#define CRT_VERSION \"${{ steps.tag.outputs.release_tag }}\"/g" ext/crt.c
python3 dev-scripts/prepare_pecl_release.py --name aws-crt --user aws-crt --email [email protected] --version ${{ steps.tag.outputs.release_tag }} python3 dev-scripts/prepare_pecl_release.py --name aws-crt --user aws-crt --email [email protected] --version ${{ steps.tag.outputs.release_tag }}