build-windows-x86_64.yml 3.2 KB

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