diff --git a/.github/workflows/build-arm.yml b/.github/workflows/build-linux-arm.yml similarity index 100% rename from .github/workflows/build-arm.yml rename to .github/workflows/build-linux-arm.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build-linux-x86_64.yml similarity index 84% rename from .github/workflows/build.yml rename to .github/workflows/build-linux-x86_64.yml index 616699f6..7e03aaa1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build-linux-x86_64.yml @@ -1,15 +1,8 @@ -name: CI on x86_64 +name: CI on x86_64 linux on: workflow_dispatch: inputs: - operating-system: - required: true - description: Compile target OS - type: choice - options: - - ubuntu-latest - - macos-latest version: required: true description: php version to compile @@ -42,20 +35,13 @@ env: jobs: build: - name: build ${{ inputs.version }} on ${{ inputs.operating-system }} - runs-on: ${{ inputs.operating-system }} + name: build ${{ inputs.version }} on Linux x86_64 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - # Install macOS missing packages and mark os suffix - - if: ${{ inputs.operating-system == 'macos-latest' }} - run: | - brew install automake gzip - echo "SPC_BUILD_OS=macos" >> $GITHUB_ENV - # Install Ubuntu missing packages and mark os suffix - - if: ${{ inputs.operating-system == 'ubuntu-latest' }} - run: | + - run: | sudo apt install musl-tools -y echo "SPC_BUILD_OS=linux" >> $GITHUB_ENV diff --git a/.github/workflows/build-macos-x86_64.yml b/.github/workflows/build-macos-x86_64.yml new file mode 100644 index 00000000..fffd135b --- /dev/null +++ b/.github/workflows/build-macos-x86_64.yml @@ -0,0 +1,115 @@ +name: CI on x86_64 macOS + +on: + workflow_dispatch: + inputs: + version: + required: true + description: php version to compile + default: '8.2' + type: choice + options: + - '8.2' + - '8.1' + - '8.0' + - '7.4' + build-cli: + description: build cli binary + default: true + type: boolean + build-micro: + description: build phpmicro binary + type: boolean + build-fpm: + description: build fpm binary + type: boolean + extensions: + description: extensions to compile (comma separated) + required: true + type: string + debug: + type: boolean + +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +jobs: + build: + name: build ${{ inputs.version }} on macOS x86_64 + runs-on: macos-latest + steps: + - uses: actions/checkout@v3 + + # Install macOS missing packages and mark os suffix + - run: | + brew install automake gzip + echo "SPC_BUILD_OS=macos" >> $GITHUB_ENV + + # Cache composer dependencies + - id: cache-composer-deps + uses: actions/cache@v3 + with: + path: vendor + key: composer-dependencies + + # If there's no Composer cache, install dependencies + - if: steps.cache-composer-deps.outputs.cache-hit != 'true' + run: composer update --no-dev + + # Cache downloaded source + - id: cache-download + uses: actions/cache@v3 + with: + path: downloads + key: php-${{ inputs.version }}-dependencies + + # With or without debug + - if: inputs.debug == true + run: echo "SPC_BUILD_DEBUG=--debug" >> $GITHUB_ENV + + # With target select: cli, micro or both + - if: ${{ inputs.build-cli == true }} + run: echo "SPC_BUILD_CLI=--build-cli" >> $GITHUB_ENV + - if: ${{ inputs.build-micro == true }} + run: echo "SPC_BUILD_MICRO=--build-micro" >> $GITHUB_ENV + - if: ${{ inputs.build-fpm == true }} + run: echo "SPC_BUILD_FPM=--build-fpm" >> $GITHUB_ENV + + # If there's no dependencies cache, fetch sources, with or without debug + - run: CACHE_API_EXEC=yes ./bin/spc download --with-php=${{ inputs.version }} --all ${{ env.SPC_BUILD_DEBUG }} + + # Run build command + - run: ./bin/spc build ${{ inputs.extensions }} ${{ env.SPC_BUILD_DEBUG }} ${{ env.SPC_BUILD_CLI }} ${{ env.SPC_BUILD_MICRO }} ${{ env.SPC_BUILD_FPM }} + + # Upload cli executable + - if: ${{ inputs.build-cli == true }} + uses: actions/upload-artifact@v3 + with: + name: php-${{ inputs.version }}-${{ env.SPC_BUILD_OS }} + path: buildroot/bin/php + + # Upload micro self-extracted executable + - if: ${{ inputs.build-micro == true }} + uses: actions/upload-artifact@v3 + with: + name: micro-${{ inputs.version }}-${{ env.SPC_BUILD_OS }} + path: buildroot/bin/micro.sfx + + # Upload fpm executable + - if: ${{ inputs.build-fpm == true }} + uses: actions/upload-artifact@v3 + with: + name: php-fpm-${{ inputs.version }}-${{ env.SPC_BUILD_OS }} + path: buildroot/bin/php-fpm + + # Upload extensions metadata + - uses: actions/upload-artifact@v3 + with: + name: license-files + path: buildroot/license/ + - uses: actions/upload-artifact@v3 + with: + name: build-meta + path: | + buildroot/build-extensions.json + buildroot/build-libraries.json