build-linux-arm.yml 3.9 KB

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