mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-20 23:35:37 +08:00
add linux github ci
This commit is contained in:
94
.github/workflows/build.yml
vendored
94
.github/workflows/build.yml
vendored
@@ -11,6 +11,14 @@ on:
|
|||||||
- '8.2'
|
- '8.2'
|
||||||
- '8.1'
|
- '8.1'
|
||||||
- '8.0'
|
- '8.0'
|
||||||
|
target:
|
||||||
|
required: true
|
||||||
|
default: 'cli'
|
||||||
|
type: choice
|
||||||
|
options:
|
||||||
|
- 'cli'
|
||||||
|
- 'micro'
|
||||||
|
- 'all'
|
||||||
extensions:
|
extensions:
|
||||||
type: string
|
type: string
|
||||||
debug:
|
debug:
|
||||||
@@ -20,58 +28,98 @@ env:
|
|||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# linux:
|
# linux:
|
||||||
# runs-on: ubuntu-latest
|
# runs-on: ubuntu-latest
|
||||||
# steps:
|
# steps:
|
||||||
# - run: sudo apt-get install ninja-build
|
# - run: sudo apt-get install ninja-build
|
||||||
# - run: ninja --version
|
# - run: ninja --version
|
||||||
|
|
||||||
# When windows support is ready, we can use this
|
# When windows support is ready, we can use this
|
||||||
# windows:
|
# windows:
|
||||||
# runs-on: windows-latest
|
# runs-on: windows-latest
|
||||||
# steps:
|
# steps:
|
||||||
# - run: choco install ninja
|
# - run: choco install ninja
|
||||||
# - run: ninja --version
|
# - 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:
|
mac:
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
# Install some missing packages
|
# Install some missing packages
|
||||||
- run: brew install automake gzip
|
- run: brew install automake gzip
|
||||||
|
|
||||||
- id: cache-composer-deps
|
- id: cache-composer-deps
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: vendor
|
path: vendor
|
||||||
key: composer-dependencies
|
key: composer-dependencies
|
||||||
|
|
||||||
# If there's no Composer cache, install dependencies
|
# If there's no Composer cache, install dependencies
|
||||||
- if: steps.cache-composer-deps.outputs.cache-hit != 'true'
|
- if: steps.cache-composer-deps.outputs.cache-hit != 'true'
|
||||||
run: composer update
|
run: composer update
|
||||||
|
|
||||||
- id: cache-build-deps
|
- id: cache-build-deps
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: source
|
path: source
|
||||||
key: php-${{ inputs.version }}-dependencies
|
key: php-${{ inputs.version }}-dependencies
|
||||||
|
|
||||||
# If there's no dependencies cache, fetch sources, with or without debug
|
# If there's no dependencies cache, fetch sources, with or without debug
|
||||||
- if: ${{ steps.cache-build-deps.outputs.cache-hit != 'true' && inputs.debug == true }}
|
- if: ${{ steps.cache-build-deps.outputs.cache-hit != 'true' && inputs.debug == true }}
|
||||||
run: ./bin/spc fetch --with-php=${{ inputs.version }} --with-openssl11 --all --debug
|
run: ./bin/spc fetch --with-php=${{ inputs.version }} --with-openssl11 --all --debug
|
||||||
|
|
||||||
- if: ${{ steps.cache-build-deps.outputs.cache-hit != 'true' && inputs.debug == false }}
|
- if: ${{ steps.cache-build-deps.outputs.cache-hit != 'true' && inputs.debug == false }}
|
||||||
run: ./bin/spc fetch --with-php=${{ inputs.version }} --all
|
run: ./bin/spc fetch --with-php=${{ inputs.version }} --all
|
||||||
|
|
||||||
# Run the build, with or without debug
|
# Run the build, with or without debug
|
||||||
- if: inputs.debug == true
|
- if: inputs.debug == true
|
||||||
run: ./bin/spc build ${{ inputs.extensions }} --debug
|
run: echo "SPC_BUILD_DEBUG='--debug'" >> $GITHUB_ENV
|
||||||
|
|
||||||
- if: inputs.debug == false
|
- if: ${{ inputs.target == 'micro' || inputs.target == 'all' }}
|
||||||
run: ./bin/spc build ${{ inputs.extensions }}
|
run: echo "SPC_BUILD_TARGET='--build-${{ inputs.target }}' >> $GITHUB_ENV
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v3
|
- 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:
|
with:
|
||||||
name: php-${{ inputs.version }}
|
name: php-${{ inputs.version }}-macos
|
||||||
path: buildroot/bin/php
|
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
|
||||||
@@ -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}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user