fix: use C++ 17 compiler for ICU (#414) #1
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: Build SPC Binary | |
on: | |
push: | |
branches: [ "main" ] | |
release: | |
types: | |
- published | |
workflow_dispatch: | |
jobs: | |
build-release-artifacts: | |
name: "Build SPC Binary" | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php-version: | |
- "8.2" | |
micro-version: | |
- "8.2.16" | |
operating-system: | |
- "linux-x86_64" | |
- "macos-x86_64" | |
- "linux-aarch64" | |
- "macos-aarch64" | |
- "windows-x64" | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@v4" | |
- if: inputs.debug == true | |
run: echo "SPC_BUILD_DEBUG=--debug" >> $GITHUB_ENV | |
- name: "Install PHP for official runners" | |
uses: "shivammathur/setup-php@v2" | |
with: | |
coverage: none | |
tools: composer:v2 | |
php-version: "${{ matrix.php-version }}" | |
ini-values: memory_limit=-1 | |
- name: "Get Composer Cache Directory" | |
id: composer-cache | |
run: | | |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: "Cache Composer dependencies" | |
uses: "actions/cache@v3" | |
with: | |
path: "${{ steps.composer-cache.outputs.dir }}" | |
key: "php-${{ matrix.php-version }}-locked-composer-${{ hashFiles('**/composer.lock') }}" | |
restore-keys: | | |
php-${{ matrix.php-version }}-locked-composer | |
- name: "Install Locked Dependencies" | |
run: "composer install --no-interaction --no-progress" | |
- name: "Build PHAR File" | |
run: "composer build:phar" | |
- name: "Download minimal combination" | |
run: | | |
if [ "${{ matrix.operating-system }}" = "windows-x64" ]; then | |
curl https://dl.static-php.dev/static-php-cli/windows/spc-min/php-${{ matrix.micro-version }}-micro-win.zip -o tmp.zip | |
unzip tmp.zip | |
else | |
curl https://dl.static-php.dev/static-php-cli/minimal/php-${{ matrix.micro-version }}-micro-${{ matrix.operating-system }}.tar.gz -o tmp.tgz | |
tar -zxvf tmp.tgz | |
fi | |
- name: "Generate Executable" | |
run: | | |
bin/spc micro:combine spc.phar -M micro.sfx -O spc -I "memory_limit=2G" | |
if [ "${{ matrix.operating-system }}" = "windows-x64" ]; then | |
mv spc spc.exe | |
else | |
chmod +x spc | |
fi | |
- name: "Archive Executable" | |
run: | | |
if [ "${{ matrix.operating-system }}" != "windows-x64" ]; then | |
tar -czf spc-${{ matrix.operating-system }}.tar.gz spc | |
echo "filename=spc-${{ matrix.operating-system }}.tar.gz" >> $GITHUB_ENV | |
echo "OS=${{ matrix.operating-system }}" >> $GITHUB_ENV | |
if [ "${{ matrix.operating-system }}" == "linux-x86_64" ]; then | |
./spc dev:extensions | |
fi | |
else | |
echo "filename=spc-${{ matrix.operating-system }}.exe" >> $GITHUB_ENV | |
echo "OS=${{ matrix.operating-system }}" >> $GITHUB_ENV | |
fi | |
- name: "Copy file" | |
run: | | |
if [ "${{ matrix.operating-system }}" != "windows-x64" ]; then | |
mkdir dist/ && cp ${{ env.filename }} dist/ && cp spc dist/spc-$OS | |
else | |
mkdir dist/ && cp spc.exe dist/${{ env.filename }} | |
echo "SUFFIX=.exe" >> $GITHUB_ENV | |
fi | |
- name: upload binaries to release | |
uses: softprops/action-gh-release@v1 | |
if: ${{startsWith(github.ref, 'refs/tags/') }} | |
with: | |
files: dist/${{ env.filename }} | |
- name: "Deploy to Self-Hosted Server" | |
if: github.repository == 'crazywhalecc/static-php-cli' | |
uses: easingthemes/ssh-deploy@main | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_SERVER_SECRET_KEY }} | |
ARGS: "-rltgoDzvO" | |
SOURCE: "dist/" | |
REMOTE_HOST: ${{ secrets.DEPLOY_SERVER_HOST }} | |
REMOTE_PORT: ${{ secrets.DEPLOY_SERVER_PORT }} | |
REMOTE_USER: ${{ secrets.DEPLOY_SERVER_USER }} | |
TARGET: ${{ secrets.DEPLOY_SERVER_TARGET_SPC_NIGHTLY }} | |
- name: "Upload Artifact" | |
uses: actions/upload-artifact@v3 | |
with: | |
path: spc${{ env.SUFFIX }} | |
name: spc-${{ matrix.operating-system }}${{ env.SUFFIX }} |