build.yml 5.8 KB

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