mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 12:54:52 +08:00
fix ci
This commit is contained in:
parent
bb52b87d2f
commit
feb20fad83
23
.github/workflows/build.yml
vendored
23
.github/workflows/build.yml
vendored
@ -49,37 +49,34 @@ jobs:
|
|||||||
echo "SPC_BUILD_OS=linux" >> $GITHUB_ENV
|
echo "SPC_BUILD_OS=linux" >> $GITHUB_ENV
|
||||||
|
|
||||||
# Cache composer dependencies
|
# Cache composer dependencies
|
||||||
- id: cache-${{ matrix.operating-system }}-composer-deps
|
- id: cache-composer-deps
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: vendor
|
path: vendor
|
||||||
key: ${{ matrix.operating-system }}-composer-dependencies
|
key: composer-dependencies
|
||||||
|
|
||||||
# If there's no Composer cache, install dependencies
|
# If there's no Composer cache, install dependencies
|
||||||
- if: steps.cache-${{ matrix.operating-system }}-composer-deps.outputs.cache-hit != 'true'
|
- if: steps.cache-composer-deps.outputs.cache-hit != 'true'
|
||||||
run: composer update --no-dev
|
run: composer update --no-dev
|
||||||
|
|
||||||
# Cache downloaded source
|
# Cache downloaded source
|
||||||
- id: cache-${{ matrix.operating-system }}-build-deps
|
- id: cache-download
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: source
|
path: downloads
|
||||||
key: ${{ matrix.operating-system }}-php-${{ inputs.version }}-dependencies
|
key: php-${{ inputs.version }}-dependencies
|
||||||
|
|
||||||
# With or without debug
|
# With or without debug
|
||||||
- if: inputs.debug == true
|
- if: inputs.debug == true
|
||||||
run: echo "SPC_BUILD_DEBUG='--debug'" >> $GITHUB_ENV
|
run: echo "SPC_BUILD_DEBUG='--debug'" >> $GITHUB_ENV
|
||||||
|
|
||||||
# If there's no dependencies cache, fetch sources, with or without debug
|
# With target select: cli, micro or both
|
||||||
- if: ${{ steps.cache-${{ matrix.operating-system }}-build-deps.outputs.cache-hit != 'true' && inputs.debug == true }}
|
|
||||||
run: ./bin/spc fetch --with-php=${{ inputs.version }} --all --debug
|
|
||||||
- if: ${{ steps.cache-${{ matrix.operating-system }}-build-deps.outputs.cache-hit != 'true' && inputs.debug == false }}
|
|
||||||
run: ./bin/spc fetch --with-php=${{ inputs.version }} --all
|
|
||||||
|
|
||||||
# Build target select: cli, micro or both
|
|
||||||
- if: ${{ inputs.target == 'micro' || inputs.target == 'all' }}
|
- if: ${{ inputs.target == 'micro' || inputs.target == 'all' }}
|
||||||
run: echo "SPC_BUILD_TARGET='--build-${{ inputs.target }}'" >> $GITHUB_ENV
|
run: echo "SPC_BUILD_TARGET='--build-${{ inputs.target }}'" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
# If there's no dependencies cache, fetch sources, with or without debug
|
||||||
|
- run: CACHE_API_EXEC=yes ./bin/spc fetch --with-php=${{ inputs.version }} --all ${{ env.SPC_BUILD_DEBUG }}
|
||||||
|
|
||||||
# Run build command
|
# Run build command
|
||||||
- run: ./bin/spc build ${{ inputs.extensions }} ${{ env.SPC_BUILD_DEBUG }} ${{ env.SPC_BUILD_TARGET }}
|
- run: ./bin/spc build ${{ inputs.extensions }} ${{ env.SPC_BUILD_DEBUG }} ${{ env.SPC_BUILD_TARGET }}
|
||||||
|
|
||||||
|
|||||||
@ -322,10 +322,10 @@ class Downloader
|
|||||||
|
|
||||||
$cmd = "curl -sfSL {$methodArg} {$headerArg} \"{$url}\"";
|
$cmd = "curl -sfSL {$methodArg} {$headerArg} \"{$url}\"";
|
||||||
if (getenv('CACHE_API_EXEC') === 'yes') {
|
if (getenv('CACHE_API_EXEC') === 'yes') {
|
||||||
if (!file_exists(SOURCE_PATH . '/.curl_exec_cache')) {
|
if (!file_exists(DOWNLOAD_PATH . '/.curl_exec_cache')) {
|
||||||
$cache = [];
|
$cache = [];
|
||||||
} else {
|
} else {
|
||||||
$cache = json_decode(file_get_contents(SOURCE_PATH . '/.curl_exec_cache'), true);
|
$cache = json_decode(file_get_contents(DOWNLOAD_PATH . '/.curl_exec_cache'), true);
|
||||||
}
|
}
|
||||||
if (isset($cache[$cmd]) && $cache[$cmd]['expire'] >= time()) {
|
if (isset($cache[$cmd]) && $cache[$cmd]['expire'] >= time()) {
|
||||||
return $cache[$cmd]['cache'];
|
return $cache[$cmd]['cache'];
|
||||||
@ -336,7 +336,7 @@ class Downloader
|
|||||||
}
|
}
|
||||||
$cache[$cmd]['cache'] = implode("\n", $output);
|
$cache[$cmd]['cache'] = implode("\n", $output);
|
||||||
$cache[$cmd]['expire'] = time() + 3600;
|
$cache[$cmd]['expire'] = time() + 3600;
|
||||||
file_put_contents(SOURCE_PATH . '/.curl_exec_cache', json_encode($cache));
|
file_put_contents(DOWNLOAD_PATH . '/.curl_exec_cache', json_encode($cache));
|
||||||
return $cache[$cmd]['cache'];
|
return $cache[$cmd]['cache'];
|
||||||
}
|
}
|
||||||
f_exec($cmd, $output, $ret);
|
f_exec($cmd, $output, $ret);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user