build-macos-aarch64.yml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. name: CI on arm64 macOS
  2. on:
  3. workflow_dispatch:
  4. inputs:
  5. version:
  6. required: true
  7. description: php version to compile
  8. default: '8.2'
  9. type: choice
  10. options:
  11. - '8.3'
  12. - '8.2'
  13. - '8.1'
  14. - '8.0'
  15. - '7.4'
  16. build-cli:
  17. description: build cli binary
  18. default: true
  19. type: boolean
  20. build-micro:
  21. description: build phpmicro binary
  22. type: boolean
  23. build-fpm:
  24. description: build fpm binary
  25. type: boolean
  26. extensions:
  27. description: extensions to compile (comma separated)
  28. required: true
  29. type: string
  30. debug:
  31. type: boolean
  32. env:
  33. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  34. jobs:
  35. build:
  36. name: build ${{ inputs.version }} on macOS arm64
  37. runs-on: macos-14
  38. steps:
  39. - uses: actions/checkout@v4
  40. # Install macOS missing packages and mark os suffix
  41. - run: |
  42. brew install automake gzip
  43. echo "SPC_BUILD_OS=macos" >> $GITHUB_ENV
  44. - name: "Setup PHP"
  45. uses: shivammathur/setup-php@v2
  46. with:
  47. php-version: 8.1
  48. tools: pecl, composer
  49. extensions: curl, openssl, mbstring, tokenizer
  50. ini-values: memory_limit=-1
  51. # Cache composer dependencies
  52. - id: cache-composer-deps
  53. uses: actions/cache@v4
  54. with:
  55. path: vendor
  56. key: composer-dependencies
  57. # If there's no Composer cache, install dependencies
  58. - if: steps.cache-composer-deps.outputs.cache-hit != 'true'
  59. run: composer update --no-dev --classmap-authoritative
  60. - name: Generate hashed key for download cache
  61. run: |
  62. INPUT_HASH=$(echo "${{ runner.os }}-${{ inputs.version }}-${{ inputs.extensions }}" | sha256sum | awk '{print $1}')
  63. echo "INPUT_HASH=${INPUT_HASH}" >> $GITHUB_ENV
  64. # Cache downloaded source
  65. - id: cache-download
  66. uses: actions/cache@v4
  67. with:
  68. path: downloads
  69. key: php-${{ env.INPUT_HASH }}
  70. # With or without debug
  71. - if: inputs.debug == true
  72. run: echo "SPC_BUILD_DEBUG=--debug" >> $GITHUB_ENV
  73. # With target select: cli, micro or both
  74. - if: ${{ inputs.build-cli == true }}
  75. run: echo "SPC_BUILD_CLI=--build-cli" >> $GITHUB_ENV
  76. - if: ${{ inputs.build-micro == true }}
  77. run: echo "SPC_BUILD_MICRO=--build-micro" >> $GITHUB_ENV
  78. - if: ${{ inputs.build-fpm == true }}
  79. run: echo "SPC_BUILD_FPM=--build-fpm" >> $GITHUB_ENV
  80. # If there's no dependencies cache, fetch sources, with or without debug
  81. - if: steps.cache-download.outputs.cache-hit != 'true'
  82. run: ./bin/spc download --with-php=${{ inputs.version }} --for-extensions=${{ inputs.extensions }} ${{ env.SPC_BUILD_DEBUG }}
  83. # Run build command
  84. - run: ./bin/spc build ${{ inputs.extensions }} ${{ env.SPC_BUILD_DEBUG }} ${{ env.SPC_BUILD_CLI }} ${{ env.SPC_BUILD_MICRO }} ${{ env.SPC_BUILD_FPM }}
  85. # Upload cli executable
  86. - if: ${{ inputs.build-cli == true }}
  87. uses: actions/upload-artifact@v4
  88. with:
  89. name: php-${{ inputs.version }}-${{ env.SPC_BUILD_OS }}
  90. path: buildroot/bin/php
  91. # Upload micro self-extracted executable
  92. - if: ${{ inputs.build-micro == true }}
  93. uses: actions/upload-artifact@v4
  94. with:
  95. name: micro-${{ inputs.version }}-${{ env.SPC_BUILD_OS }}
  96. path: buildroot/bin/micro.sfx
  97. # Upload fpm executable
  98. - if: ${{ inputs.build-fpm == true }}
  99. uses: actions/upload-artifact@v4
  100. with:
  101. name: php-fpm-${{ inputs.version }}-${{ env.SPC_BUILD_OS }}
  102. path: buildroot/bin/php-fpm
  103. # Upload extensions metadata
  104. - uses: actions/upload-artifact@v4
  105. with:
  106. name: license-files
  107. path: buildroot/license/
  108. - uses: actions/upload-artifact@v4
  109. with:
  110. name: build-meta
  111. path: |
  112. buildroot/build-extensions.json
  113. buildroot/build-libraries.json