build-macos-x86_64.yml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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.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 x86_64
  37. runs-on: macos-latest
  38. steps:
  39. - uses: actions/checkout@v3
  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. # Cache composer dependencies
  45. - id: cache-composer-deps
  46. uses: actions/cache@v3
  47. with:
  48. path: vendor
  49. key: composer-dependencies
  50. # If there's no Composer cache, install dependencies
  51. - if: steps.cache-composer-deps.outputs.cache-hit != 'true'
  52. run: composer update --no-dev --classmap-authoritative
  53. # Cache downloaded source
  54. - id: cache-download
  55. uses: actions/cache@v3
  56. with:
  57. path: downloads
  58. key: php-${{ inputs.version }}-dependencies-${{ inputs.extensions }}
  59. # With or without debug
  60. - if: inputs.debug == true
  61. run: echo "SPC_BUILD_DEBUG=--debug" >> $GITHUB_ENV
  62. # With target select: cli, micro or both
  63. - if: ${{ inputs.build-cli == true }}
  64. run: echo "SPC_BUILD_CLI=--build-cli" >> $GITHUB_ENV
  65. - if: ${{ inputs.build-micro == true }}
  66. run: echo "SPC_BUILD_MICRO=--build-micro" >> $GITHUB_ENV
  67. - if: ${{ inputs.build-fpm == true }}
  68. run: echo "SPC_BUILD_FPM=--build-fpm" >> $GITHUB_ENV
  69. # If there's no dependencies cache, fetch sources, with or without debug
  70. - if: steps.cache-download.outputs.cache-hit != 'true'
  71. run: ./bin/spc download --with-php=${{ inputs.version }} --for-extensions=${{ inputs.extensions }} ${{ env.SPC_BUILD_DEBUG }}
  72. # Run build command
  73. - run: ./bin/spc build ${{ inputs.extensions }} ${{ env.SPC_BUILD_DEBUG }} ${{ env.SPC_BUILD_CLI }} ${{ env.SPC_BUILD_MICRO }} ${{ env.SPC_BUILD_FPM }}
  74. # Upload cli executable
  75. - if: ${{ inputs.build-cli == true }}
  76. uses: actions/upload-artifact@v3
  77. with:
  78. name: php-${{ inputs.version }}-${{ env.SPC_BUILD_OS }}
  79. path: buildroot/bin/php
  80. # Upload micro self-extracted executable
  81. - if: ${{ inputs.build-micro == true }}
  82. uses: actions/upload-artifact@v3
  83. with:
  84. name: micro-${{ inputs.version }}-${{ env.SPC_BUILD_OS }}
  85. path: buildroot/bin/micro.sfx
  86. # Upload fpm executable
  87. - if: ${{ inputs.build-fpm == true }}
  88. uses: actions/upload-artifact@v3
  89. with:
  90. name: php-fpm-${{ inputs.version }}-${{ env.SPC_BUILD_OS }}
  91. path: buildroot/bin/php-fpm
  92. # Upload extensions metadata
  93. - uses: actions/upload-artifact@v3
  94. with:
  95. name: license-files
  96. path: buildroot/license/
  97. - uses: actions/upload-artifact@v3
  98. with:
  99. name: build-meta
  100. path: |
  101. buildroot/build-extensions.json
  102. buildroot/build-libraries.json