build-linux-x86_64.yml 3.5 KB

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