build-linux-x86_64.yml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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@v4
  40. # Cache composer dependencies
  41. - id: cache-composer-deps
  42. uses: actions/cache@v4
  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. - name: Generate hashed key for download cache
  50. run: |
  51. INPUT_HASH=$(echo "${{ runner.os }}-${{ inputs.version }}-${{ inputs.extensions }}" | sha256sum | awk '{print $1}')
  52. echo "INPUT_HASH=${INPUT_HASH}" >> $GITHUB_ENV
  53. # Cache downloaded source
  54. - id: cache-download
  55. uses: actions/cache@v4
  56. with:
  57. path: downloads
  58. key: php-${{ env.INPUT_HASH }}
  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: CACHE_API_EXEC=yes ./bin/spc-alpine-docker download --with-php=${{ inputs.version }} --for-extensions=${{ inputs.extensions }} ${{ env.SPC_BUILD_DEBUG }}
  72. # Run build command
  73. - run: ./bin/spc-alpine-docker 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@v4
  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@v4
  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@v4
  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@v4
  94. with:
  95. name: license-files
  96. path: buildroot/license/
  97. - uses: actions/upload-artifact@v4
  98. with:
  99. name: build-meta
  100. path: |
  101. buildroot/build-extensions.json
  102. buildroot/build-libraries.json