Skip to content

Conversation

@yoramdelangen
Copy link
Contributor

@yoramdelangen yoramdelangen commented Apr 15, 2025

What does this PR do?

Allow the workflow to be called "programmically" from another workflow.

This allows us to call the "job" within our main workflow pipeline in bundling all staps separately without copying and/or forking the project.

These changes are partially with changes #687.

Example usage:

name: Build Production stack
on:
  workflow_dispatch:
    inputs:
      selectos:
        required: true
        description: Build target OS
        default: 'linux-x86_64'
        type: choice
        options:
          - 'linux-x86_64'
          - 'linux-aarch64'
          - 'linux-x86_64-glibc'
          - 'linux-aarch64-glibc'
          - 'macos-x86_64'
          - 'macos-aarch64'
      php-version:
        required: true
        description: PHP version to compile
        default: '8.4'
        type: choice
        options:
          - '8.4'
          - '8.3'
          - '8.2'
          - '8.1'
      create-docker:
        description: 'Create a docker image'
        type: boolean
        default: true

jobs:
  unix-static-build:
    uses: crazywhalecc/static-php-cli/.github/workflows/build-unix.yml@main
    with:
      os: ${{ inputs.selectos }}
      php-version: ${{ inputs.php-version }}
      extensions: 'odbc,pdo_odbc,bcmath,calendar,ctype,curl,dba,exif,fileinfo,filter,gd,intl,libxml,mbregex,mbstring,msgpack,mysqli,mysqlnd,opcache,openssl,pcntl,pdo,pdo_mysql,pdo_pgsql,pdo_sqlite,pdo_sqlsrv,pgsql,phar,posix,readline,redis,session,simplexml,sockets,sodium,sqlite3,sqlsrv,tokenizer,xml,xmlreader,xmlwriter,zip,zlib'
  
  main-application:
    needs: unix-static-build
    ....
    
  create-docker-image:
    needs: [main-application, other-jobs]
    ....

Checklist before merging

If your PR involves the changes mentioned below and completed the action, please tick the corresponding option.
If a modification is not involved, please skip it directly.

  • If you modified *.php, run composer cs-fix at local machine.
  • If it's an extension or dependency update, make sure adding related extensions in src/global/test-extensions.php.
  • If you changed the behavior of static-php-cli, update docs in ./docs/.
  • If you updated config/xxx.json content, run bin/spc dev:sort-config xxx.

@crazywhalecc crazywhalecc added new feature New feature or request kind/workflow Issues related to workflow or environment labels Apr 19, 2025
@crazywhalecc crazywhalecc merged commit b21c62c into crazywhalecc:main Apr 22, 2025
@yoramdelangen yoramdelangen deleted the feat/workflow-call branch April 22, 2025 10:32
yoramdelangen added a commit to yoramdelangen/static-php-cli that referenced this pull request May 12, 2025
* add workflow_call

* change type choice string

* remove options for type string

* when vendor-mode run composer install

* move vendor-mode composer install

* debug

* move out vendor-mode inputs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/workflow Issues related to workflow or environment new feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants