build-macos-x86_64.yml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. name: CI on x86_64 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.2'
  12. - '8.1'
  13. - '8.0'
  14. - '7.4'
  15. build-cli:
  16. description: build cli binary
  17. default: true
  18. type: boolean
  19. build-micro:
  20. description: build phpmicro binary
  21. type: boolean
  22. build-fpm:
  23. description: build fpm binary
  24. type: boolean
  25. extensions:
  26. description: extensions to compile (comma separated)
  27. required: true
  28. type: string
  29. debug:
  30. type: boolean
  31. env:
  32. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  33. jobs:
  34. build:
  35. name: build ${{ inputs.version }} on macOS x86_64
  36. runs-on: macos-latest
  37. steps:
  38. - uses: actions/checkout@v3
  39. # Install macOS missing packages and mark os suffix
  40. - run: |
  41. brew install automake gzip
  42. echo "SPC_BUILD_OS=macos" >> $GITHUB_ENV
  43. # Cache composer dependencies
  44. - id: cache-composer-deps
  45. uses: actions/cache@v3
  46. with:
  47. path: vendor
  48. key: composer-dependencies
  49. # If there's no Composer cache, install dependencies
  50. - if: steps.cache-composer-deps.outputs.cache-hit != 'true'
  51. run: composer update --no-dev
  52. # Cache downloaded source
  53. - id: cache-download
  54. uses: actions/cache@v3
  55. with:
  56. path: downloads
  57. key: php-${{ inputs.version }}-dependencies
  58. # With or without debug
  59. - if: inputs.debug == true
  60. run: echo "SPC_BUILD_DEBUG=--debug" >> $GITHUB_ENV
  61. # With target select: cli, micro or both
  62. - if: ${{ inputs.build-cli == true }}
  63. run: echo "SPC_BUILD_CLI=--build-cli" >> $GITHUB_ENV
  64. - if: ${{ inputs.build-micro == true }}
  65. run: echo "SPC_BUILD_MICRO=--build-micro" >> $GITHUB_ENV
  66. - if: ${{ inputs.build-fpm == true }}
  67. run: echo "SPC_BUILD_FPM=--build-fpm" >> $GITHUB_ENV
  68. # If there's no dependencies cache, fetch sources, with or without debug
  69. - if: steps.cache-download.outputs.cache-hit != 'true'
  70. run: ./bin/spc download --with-php=${{ inputs.version }} --all ${{ env.SPC_BUILD_DEBUG }}
  71. # Run build command
  72. - run: ./bin/spc build ${{ inputs.extensions }} ${{ env.SPC_BUILD_DEBUG }} ${{ env.SPC_BUILD_CLI }} ${{ env.SPC_BUILD_MICRO }} ${{ env.SPC_BUILD_FPM }}
  73. # Upload cli executable
  74. - if: ${{ inputs.build-cli == true }}
  75. uses: actions/upload-artifact@v3
  76. with:
  77. name: php-${{ inputs.version }}-${{ env.SPC_BUILD_OS }}
  78. path: buildroot/bin/php
  79. # Upload micro self-extracted executable
  80. - if: ${{ inputs.build-micro == true }}
  81. uses: actions/upload-artifact@v3
  82. with:
  83. name: micro-${{ inputs.version }}-${{ env.SPC_BUILD_OS }}
  84. path: buildroot/bin/micro.sfx
  85. # Upload fpm executable
  86. - if: ${{ inputs.build-fpm == true }}
  87. uses: actions/upload-artifact@v3
  88. with:
  89. name: php-fpm-${{ inputs.version }}-${{ env.SPC_BUILD_OS }}
  90. path: buildroot/bin/php-fpm
  91. # Upload extensions metadata
  92. - uses: actions/upload-artifact@v3
  93. with:
  94. name: license-files
  95. path: buildroot/license/
  96. - uses: actions/upload-artifact@v3
  97. with:
  98. name: build-meta
  99. path: |
  100. buildroot/build-extensions.json
  101. buildroot/build-libraries.json