add linux github ci

This commit is contained in:
crazywhalecc 2023-04-08 21:20:22 +08:00
parent 000ebef28b
commit 298a758166
No known key found for this signature in database
GPG Key ID: 1F4BDD59391F2680
2 changed files with 71 additions and 52 deletions

View File

@ -11,6 +11,14 @@ on:
- '8.2'
- '8.1'
- '8.0'
target:
required: true
default: 'cli'
type: choice
options:
- 'cli'
- 'micro'
- 'all'
extensions:
type: string
debug:
@ -20,58 +28,98 @@ env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
# linux:
# runs-on: ubuntu-latest
# steps:
# - run: sudo apt-get install ninja-build
# - run: ninja --version
# linux:
# runs-on: ubuntu-latest
# steps:
# - run: sudo apt-get install ninja-build
# - run: ninja --version
# When windows support is ready, we can use this
# windows:
# runs-on: windows-latest
# steps:
# - run: choco install ninja
# - run: ninja --version
# When windows support is ready, we can use this
# windows:
# runs-on: windows-latest
# steps:
# - run: choco install ninja
# - run: ninja --version
linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: sudo apt install musl-tools -y
- run: composer update --no-dev
# If there's no dependencies cache, fetch sources, with or without debug
- run: ./bin/spc fetch --with-php=${{ inputs.version }} --all --debug
# Run the build, with or without debug
- if: inputs.debug == true
run: echo "SPC_BUILD_DEBUG='--debug'" >> $GITHUB_ENV
- if: ${{ inputs.target == 'micro' || inputs.target == 'all' }}
run: echo "SPC_BUILD_TARGET='--build-${{ inputs.target }}' >> $GITHUB_ENV
- run: ./bin/spc build ${{ inputs.extensions }} ${{ env.SPC_BUILD_DEBUG }} ${{ env.SPC_BUILD_TARGET }}
- if: ${{ inputs.target == 'cli' || inputs.target == 'all' }}
uses: actions/upload-artifact@v3
with:
name: php-${{ inputs.version }}-linux
path: buildroot/bin/php
- if: ${{ inputs.target == 'micro' || inputs.target == 'all' }}
uses: actions/upload-artifact@v3
with:
name: micro-${{ inputs.version }}-linux
path: buildroot/bin/micro.sfx
mac:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
# Install some missing packages
- run: brew install automake gzip
- id: cache-composer-deps
uses: actions/cache@v3
with:
path: vendor
key: composer-dependencies
# If there's no Composer cache, install dependencies
- if: steps.cache-composer-deps.outputs.cache-hit != 'true'
run: composer update
- id: cache-build-deps
uses: actions/cache@v3
with:
path: source
key: php-${{ inputs.version }}-dependencies
# If there's no dependencies cache, fetch sources, with or without debug
- if: ${{ steps.cache-build-deps.outputs.cache-hit != 'true' && inputs.debug == true }}
run: ./bin/spc fetch --with-php=${{ inputs.version }} --with-openssl11 --all --debug
- if: ${{ steps.cache-build-deps.outputs.cache-hit != 'true' && inputs.debug == false }}
run: ./bin/spc fetch --with-php=${{ inputs.version }} --all
# Run the build, with or without debug
- if: inputs.debug == true
run: ./bin/spc build ${{ inputs.extensions }} --debug
run: echo "SPC_BUILD_DEBUG='--debug'" >> $GITHUB_ENV
- if: inputs.debug == false
run: ./bin/spc build ${{ inputs.extensions }}
- uses: actions/upload-artifact@v3
- if: ${{ inputs.target == 'micro' || inputs.target == 'all' }}
run: echo "SPC_BUILD_TARGET='--build-${{ inputs.target }}' >> $GITHUB_ENV
- run: ./bin/spc build ${{ inputs.extensions }} ${{ env.SPC_BUILD_DEBUG }} ${{ env.SPC_BUILD_TARGET }}
- if: ${{ inputs.target == 'cli' || inputs.target == 'all' }}
uses: actions/upload-artifact@v3
with:
name: php-${{ inputs.version }}
name: php-${{ inputs.version }}-macos
path: buildroot/bin/php
- if: ${{ inputs.target == 'micro' || inputs.target == 'all' }}
uses: actions/upload-artifact@v3
with:
name: micro-${{ inputs.version }}-macos
path: buildroot/bin/micro.sfx

View File

@ -1,29 +0,0 @@
<?php
declare(strict_types=1);
namespace SPC\builder\macos\library;
/**
* is a template library class for unix
*/
class libuv extends MacOSLibraryBase
{
public const NAME = 'libuv';
protected function build()
{
[,,$destdir] = SEPARATED_PATH;
shell()->cd($this->source_dir)
->exec('./autogen.sh')
->exec(
"{$this->builder->configure_env} ./configure " .
'--enable-static --disable-shared ' .
'--prefix='
)
->exec('make clean')
->exec("make -j{$this->builder->concurrency}")
->exec("make install DESTDIR={$destdir}");
}
}