build-linux-arm.yml 4.3 KB

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