build-windows-x86_64.yml 3.6 KB

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