PoC - Add new GH action to build binary SPC#183
Closed
stloyd wants to merge 1 commit intocrazywhalecc:mainfrom
Closed
PoC - Add new GH action to build binary SPC#183stloyd wants to merge 1 commit intocrazywhalecc:mainfrom
stloyd wants to merge 1 commit intocrazywhalecc:mainfrom
Conversation
Owner
|
I've written one on my fork, it works for my current release situation (I'm used to releasing manually), I tested on my own fork repo, and it seems to work fine: https://github.com/phpchoir/static-php-cli/actions/runs/6174412661 name: Build Release Artifacts
on:
release:
types:
- published
workflow_dispatch:
jobs:
build-release-artifacts:
name: "Build Release Artifacts"
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
php-version:
- "8.1"
operating-system:
- "ubuntu-latest"
- "macos-latest"
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
- name: "Install PHP"
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 phpmicro"
run: |
bin/spc fetch --all --with-php=8.1
SPC_USE_SUDO=yes bin/spc doctor --auto-fix
bin/spc build pcntl,posix,mbstring,tokenizer,phar --build-micro --debug
- name: "Build PHAR file"
run: "composer build:phar"
- name: "Generate Executable"
run: "bin/spc micro:combine spc.phar"
- name: "Archive Executable"
run: |
mv my-app spc
OS=""
if [ "${{ matrix.operating-system }}" = "ubuntu-latest" ]; then
OS="linux-x86_64"
elif [ "${{ matrix.operating-system }}" = "macos-latest" ]; then
OS="macos-x86_64"
fi
tar -czf spc-$OS.tar.gz spc
echo "filename=spc-$OS.tar.gz" >> $GITHUB_ENV
echo "OS=$OS" >> $GITHUB_ENV
- name: "Test Micro file"
run: "./spc dev:extensions"
- name: upload binaries to release
uses: softprops/action-gh-release@v1
if: ${{startsWith(github.ref, 'refs/tags/') }}
with:
files: ${{ env.filename }}
- name: "Upload Artifact"
uses: actions/upload-artifact@v3
with:
path: spc
name: spc-${{ env.OS }}
|
Contributor
Author
|
@crazywhalecc Can you make it as PR? It's easier to comment ;) But, you can remove Also you should cache download files as it takes time (we should refactor it too ;)) |
Contributor
Author
|
Closing, as there are changes around the corner from @crazywhalecc . |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.