build-windows-x86_64.yml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. name: CI on x86_64 Windows
  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.4'
  12. - '8.3'
  13. - '8.2'
  14. - '8.1'
  15. - '8.0'
  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. extensions:
  24. description: extensions to compile (comma separated)
  25. required: true
  26. type: string
  27. prefer-pre-built:
  28. description: prefer pre-built binaries (reduce build time)
  29. type: boolean
  30. default: true
  31. debug:
  32. description: enable debug logs
  33. type: boolean
  34. env:
  35. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  36. jobs:
  37. build:
  38. name: build ${{ inputs.version }} on Windows x86_64
  39. runs-on: windows-latest
  40. steps:
  41. - uses: actions/checkout@v4
  42. # Cache composer dependencies
  43. - id: cache-composer-deps
  44. uses: actions/cache@v4
  45. with:
  46. path: vendor
  47. key: composer-dependencies
  48. # If there's no Composer cache, install dependencies
  49. - if: steps.cache-composer-deps.outputs.cache-hit != 'true'
  50. run: composer update --no-dev --classmap-authoritative
  51. - name: Generate hashed key for download cache
  52. shell: bash
  53. run: |
  54. INPUT_HASH=$(echo "${{ runner.os }}-${{ inputs.version }}-${{ inputs.extensions }}" | sha256sum | awk '{print $1}')
  55. echo "INPUT_HASH=${INPUT_HASH}" >> "$GITHUB_ENV"
  56. # Cache downloaded source
  57. - id: cache-download
  58. uses: actions/cache@v4
  59. with:
  60. path: downloads
  61. key: php-${{ env.INPUT_HASH }}
  62. # With or without debug
  63. - if: inputs.debug == true
  64. run: echo "SPC_BUILD_DEBUG=--debug" >> $env:GITHUB_ENV
  65. - if: inputs.prefer-pre-built == true
  66. run: echo "SPC_PRE_BUILT=--prefer-pre-built" >> $env:GITHUB_ENV
  67. # With target select: cli, micro or both
  68. - if: ${{ inputs.build-cli == true }}
  69. run: echo "SPC_BUILD_CLI=--build-cli" >> $env:GITHUB_ENV
  70. - if: ${{ inputs.build-micro == true }}
  71. run: echo "SPC_BUILD_MICRO=--build-micro" >> $env:GITHUB_ENV
  72. - run: ./bin/spc doctor
  73. # If there's no dependencies cache, fetch sources, with or without debug
  74. - if: steps.cache-download.outputs.cache-hit != 'true'
  75. run: ./bin/spc download --with-php="${{ inputs.version }}" --for-extensions="${{ inputs.extensions }}" ${{ env.SPC_BUILD_DEBUG }} ${{ env.SPC_PRE_BUILT }}
  76. # Run build command
  77. - run: ./bin/spc build "${{ inputs.extensions }}" ${{ env.SPC_BUILD_DEBUG }} ${{ env.SPC_BUILD_CLI }} ${{ env.SPC_BUILD_MICRO }} ${{ env.SPC_BUILD_FPM }}
  78. # Upload cli executable
  79. - if: ${{ inputs.build-cli == true }}
  80. uses: actions/upload-artifact@v4
  81. with:
  82. name: php-${{ inputs.version }}
  83. path: buildroot/bin/php.exe
  84. # Upload micro self-extracted executable
  85. - if: ${{ inputs.build-micro == true }}
  86. uses: actions/upload-artifact@v4
  87. with:
  88. name: micro-${{ inputs.version }}
  89. path: buildroot/bin/micro.sfx
  90. # Upload extensions metadata
  91. - uses: actions/upload-artifact@v4
  92. with:
  93. name: license-files
  94. path: buildroot/license/
  95. - uses: actions/upload-artifact@v4
  96. with:
  97. name: build-meta
  98. path: |
  99. buildroot/build-extensions.json
  100. buildroot/build-libraries.json