build.yml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. name: build
  2. on:
  3. push:
  4. workflow_dispatch:
  5. env:
  6. HOME: "${{github.workspace}}\\home"
  7. jobs:
  8. build:
  9. # Only set the topic `has-issrc-build-env` if the secrets are available
  10. if: contains(github.event.repository.topics, 'has-issrc-build-env') && github.ref != 'refs/heads/copilot-review'
  11. runs-on: windows-latest
  12. steps:
  13. - name: Checkout
  14. uses: actions/checkout@v3
  15. with:
  16. submodules: true
  17. - name: Setup MSBuild
  18. uses: microsoft/setup-msbuild@v2
  19. - name: Initialize build environment
  20. env:
  21. ISSRC_BUILD_ENV_ZIP_PASSWORD: ${{ secrets.ISSRC_BUILD_ENV_ZIP_PASSWORD }}
  22. ISSRC_BUILD_ENV_ZIP_URL: ${{ secrets.ISSRC_BUILD_ENV_ZIP_URL }}
  23. run: |
  24. (New-Object Net.WebClient).DownloadFile($env:ISSRC_BUILD_ENV_ZIP_URL, "issrc-build-env.zip")
  25. & "C:\\Program Files\\7-Zip\\7z.exe" x -oissrc-build-env -p"$env:ISSRC_BUILD_ENV_ZIP_PASSWORD" issrc-build-env.zip
  26. if (!(Test-Path issrc-build-env\bin\dcc32.exe)) {
  27. Write-Host "Failed to extract dcc32.exe"
  28. Exit 1
  29. }
  30. Remove-Item issrc-build-env.zip
  31. $DELPHIXEROOT = (Get-Item .\issrc-build-env).FullName
  32. "DELPHIXEROOT=$DELPHIXEROOT" | Out-File -NoNewline -Encoding ascii -Append "$env:GITHUB_ENV"
  33. "set BDS=$DELPHIXEROOT" | Out-File -Encoding ascii issrc-build-env\bin\rsvars.bat
  34. "set BDSCOMMONDIR=$DELPHIXEROOT" | Out-File -NoNewline -Encoding ascii -Append issrc-build-env\bin\rsvars.bat
  35. - name: Configure build
  36. run: |
  37. "set DELPHIXEROOT=$env:DELPHIXEROOT" | Out-File -Encoding ascii compilesettings.bat
  38. "set ISSIGTOOL_KEY_FILE=${{github.workspace}}\mykey.isprivatekey" | Out-File -NoNewline -Encoding ascii -Append compilesettings.bat
  39. "set HHCEXE=%ProgramFiles(x86)%\HTML Help Workshop\hhc.exe" | Out-File -NoNewline -Encoding ascii ISHelp\compilesettings.bat
  40. - name: Build issrc
  41. run: |
  42. .\build.bat
  43. - name: Clean up temporary files
  44. if: always()
  45. shell: bash
  46. run: |
  47. rm -rf mykey.isprivatekey
  48. - name: Copy license.txt into all artifacts
  49. run: |
  50. copy license.txt Files
  51. copy license.txt Output
  52. copy license.txt ISHelp/Staging
  53. - name: Upload Files/
  54. uses: actions/upload-artifact@v4
  55. with:
  56. name: Files
  57. path: Files/
  58. - name: Upload Output/
  59. uses: actions/upload-artifact@v4
  60. with:
  61. name: Output
  62. path: Output/
  63. - name: Upload ISHelp/
  64. uses: actions/upload-artifact@v4
  65. with:
  66. name: ISHelp
  67. path: |
  68. ISHelp/Staging/
  69. ISHelp/Staging-dark/
  70. - name: Find mt.exe
  71. if: contains(github.event.repository.topics, 'issrc-build-verify')
  72. shell: bash
  73. run: |
  74. set -x &&
  75. mt=$(ls -t /c/Program\ Files*/Windows\ Kits/10/bin/*/x64/mt.exe) &&
  76. test -n "$mt" &&
  77. echo "${mt%%/mt.exe*}" >>$GITHUB_PATH
  78. - name: Verify installer
  79. if: contains(github.event.repository.topics, 'issrc-build-verify')
  80. shell: bash
  81. run: |
  82. set -x &&
  83. ver="$(sed -n 's/^set VER=//p' <build.bat)" &&
  84. mt '-inputresource:Output\innosetup-'$ver.exe -out:innosetup-$ver.manifest &&
  85. cat innosetup-$ver.manifest &&
  86. mkdir -p Output/innosetup-$ver.exe.Local &&
  87. cp -R "$(cygpath -au "$SYSTEMROOT")"/WinSxS/x86_microsoft.windows.common-controls_* Output/innosetup-$ver.exe.Local/ &&
  88. mkdir Output/innosetup-$ver.en-US &&
  89. mkdir Output/innosetup-$ver.en &&
  90. mkdir Output/innosetup-$ver.ENU &&
  91. mkdir -p trace &&
  92. echo "$ver" >trace/ver &&
  93. curl -LO https://download.sysinternals.com/files/ProcessMonitor.zip &&
  94. unzip ProcessMonitor.zip &&
  95. # Need to start the background process via PowerShell because it would
  96. # block for some reason if started as a Bash background process.
  97. powershell -command 'start-process -NoNewWindow -FilePath .\Procmon.exe -ArgumentList "-AcceptEula -Quiet -BackingFile trace/procmon.pml -RunTime 60"' &&
  98. test $? = 0 &&
  99. ps -W &&
  100. ./Procmon.exe -AcceptEula -WaitForIdle &&
  101. ./Output/innosetup-$ver.exe //verysilent //dir=InnoSetup //noicons \
  102. //tasks= //portable=1 &&
  103. test -x InnoSetup/ISCC.exe &&
  104. ./Procmon.exe -Terminate -Quiet &&
  105. powershell -command 'start-process -NoNewWindow -Wait -FilePath .\Procmon.exe -ArgumentList "-OpenLog trace\procmon.pml -SaveAs trace\procmon.csv"'
  106. - name: Upload trace
  107. if: contains(github.event.repository.topics, 'issrc-build-verify')
  108. uses: actions/upload-artifact@v4
  109. with:
  110. name: trace
  111. path: trace/
  112. - name: Check trace
  113. if: contains(github.event.repository.topics, 'issrc-build-verify')
  114. shell: bash
  115. run: |
  116. set -x &&
  117. curdir="$(cygpath -aw Output | sed 's/\\/&&/g')" &&
  118. ver="$(sed 's/\./\\&/g' <trace/ver)" &&
  119. sed -ne '/"'$curdir'\\innosetup-'$ver'\.\(exe\|exe\.Config\|en-US\|en\|ENU\|EN\)"/d' \
  120. -e '/"System","[0-9]*","\(CreateFileMapping\|FASTIO_[A-Z_]*\)"/d' -e '/"'$curdir'\\/p' \
  121. trace/procmon.csv >trace/filtered.csv &&
  122. if test -s trace/filtered.csv
  123. then
  124. echo ":error:Unexpected filesystem access" >&2
  125. cat trace/filtered.csv >&2
  126. exit 1
  127. fi