Release Linux #23
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release Linux | |
on: [create, workflow_dispatch] | |
env: | |
LWMBS_LIBRARIES: libssh2,curl,zlib,openssl,libzip,bzip2,nghttp2,onig,libyaml,xz,libxml2 | |
LWMBS_EXTENSIONS: iconv,dom,xml,xmlwriter,xmlreader,opcache,bcmath,phar,mbstring,mbregex,session,ctype,fileinfo,filter,tokenizer,curl,redis,sockets,openssl,zip,zlib,bz2,yaml,posix,pcntl,sysvshm,sysvsem,sysvmsg | |
jobs: | |
build: | |
name: PHP ${{ matrix.phpVer }} Linux ${{ matrix.arch }} | |
runs-on: ubuntu-latest | |
container: "ghcr.io/dixyes/prepared-lwmbs:linux-musl-${{ matrix.arch }}-src" | |
strategy: | |
fail-fast: true | |
matrix: | |
phpVer: ["8.2"] | |
arch: ["x86_64", "aarch64"] | |
max-parallel: 6 | |
env: | |
tar: "php-${{ matrix.phpVer }}-linux-${{ matrix.arch }}.tar.gz" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Restore sources | |
uses: actions/cache/restore@v3 | |
id: cache-restore | |
with: | |
path: | | |
build/downloads | |
build/src | |
/versionFile | |
key: ${{ runner.os }}-build-v1-${{ matrix.phpVer }}-${{ hashFiles('/versionFile') }} | |
restore-keys: | | |
${{ runner.os }}-build-v1-${{ matrix.phpVer }}- | |
- name: Make dirs | |
run: | | |
mkdir -p build | |
mkdir -p micro/licenses | |
- name: Prepare lwmbs and sources | |
id: prepare | |
working-directory: build | |
run: | | |
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} php ${GITHUB_WORKSPACE}/fetch_source.php \ | |
"${{ env.LWMBS_LIBRARIES }}" \ | |
"${{ env.LWMBS_EXTENSIONS }}" \ | |
"--phpVer=${{ matrix.phpVer }}" \ | |
"--versionFile=/versionFile" | |
matched_key="${{ steps.cache-restore.outputs.cache-matched-key }}" | |
src_hash="$(sha256sum /versionFile | head -c 64)" | |
if [ "$matched_key" != "${matched_key##*${src_hash}}" ] | |
then | |
echo "srcHash=" >> "$GITHUB_OUTPUT" | |
else | |
echo "srcHash=${src_hash}" >> "$GITHUB_OUTPUT" | |
fi | |
case "musl-${{ matrix.arch }}" in | |
"musl-aarch64") \ | |
export LWMBS_CC=aarch64-linux-musl-gcc && | |
export LWMBS_CXX==aarch64-linux-musl-g++ | |
;; | |
"musl-x86_64") \ | |
export LWMBS_CC=clang && | |
export LWMBS_CXX=clang++ | |
;; | |
esac | |
echo "cc=$LWMBS_CC" >> $GITHUB_OUTPUT | |
echo "cxx=$LWMBS_CXX" >> $GITHUB_OUTPUT | |
php ${GITHUB_WORKSPACE}/dump_licenses.php ${GITHUB_WORKSPACE}/micro/licenses | |
- name: Save sources | |
uses: actions/cache/save@v3 | |
if: steps.prepare.outputs.srcHash != '' | |
with: | |
path: | | |
build/downloads | |
build/src | |
/versionFile | |
key: ${{ runner.os }}-build-v1-${{ matrix.phpVer }}-${{ steps.prepare.outputs.srcHash }} | |
- name: Prepare libraries | |
working-directory: build | |
run: | | |
php ${GITHUB_WORKSPACE}/build_libs.php \ | |
"${{ env.LWMBS_LIBRARIES }}" \ | |
--cc=${{ steps.prepare.outputs.cc }} \ | |
--cxx=${{ steps.prepare.outputs.cxx }} \ | |
--arch=${{ matrix.arch }} \ | |
--fresh | |
- name: Build micro | |
id: micro | |
working-directory: build | |
run: | | |
rm -f /src/php-src/sapi/micro/php_micro.lo | |
php ${GITHUB_WORKSPACE}/build_micro.php \ | |
"${{ env.LWMBS_LIBRARIES }}" \ | |
"${{ env.LWMBS_EXTENSIONS }}" \ | |
--cc=${{ steps.prepare.outputs.cc }} \ | |
--cxx=${{ steps.prepare.outputs.cxx }} \ | |
--arch=${{ matrix.arch }} \ | |
--allStatic | |
cp src/php-src/sapi/micro/micro.sfx src/php-src/sapi/micro/micro.sfx.debug ${GITHUB_WORKSPACE}/micro | |
cd ${GITHUB_WORKSPACE}/micro | |
mv micro.sfx micro-linux-${{ matrix.arch }}.sfx | |
mv micro.sfx.debug micro-linux-${{ matrix.arch }}.sfx.debug | |
cd - | |
- name: Tar micro | |
run: | | |
tar -zcvf ${{ env.tar }} micro | |
mkdir -p tar | |
mv ${{ env.tar }} tar | |
ls tar | |
- name: Cache tar | |
uses: actions/cache/save@v3 | |
with: | |
path: tar | |
key: ${{ runner.os }}-linux-${{ matrix.arch }}-${{ github.sha }} | |
upload: | |
name: Upload artifacts | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
arch: ["x86_64", "aarch64"] | |
needs: | |
- build | |
steps: | |
- name: Restore tar | |
uses: actions/cache/restore@v3 | |
with: | |
fail-on-cache-miss: true | |
path: tar | |
key: ${{ runner.os }}-linux-${{ matrix.arch }}-${{ github.sha }} | |
- name: Upload artifacts | |
uses: ncipollo/release-action@v1 | |
with: | |
allowUpdates: true | |
artifacts: > | |
tar/*.tar.gz | |
token: ${{ secrets.GITHUB_TOKEN }} |