|
| 1 | +name: Build Windows Release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: # Allows manual triggering from Actions tab |
| 5 | + |
| 6 | +jobs: |
| 7 | + build-windows: |
| 8 | + runs-on: windows-latest |
| 9 | + |
| 10 | + steps: |
| 11 | + - name: Checkout divrep repository |
| 12 | + uses: actions/checkout@v4 |
| 13 | + with: |
| 14 | + fetch-depth: 0 # Get full history for SHA |
| 15 | + |
| 16 | + - name: Set up Cygwin |
| 17 | + uses: cygwin/cygwin-install-action@master |
| 18 | + with: |
| 19 | + packages: gcc-core,libgmp-devel,make,git,binutils |
| 20 | + |
| 21 | + - name: Clone Math-Prime-Util-GMP |
| 22 | + shell: C:\cygwin\bin\bash.exe --login -o igncr '{0}' |
| 23 | + run: | |
| 24 | + cd /cygdrive/c/cygwin/home |
| 25 | + git clone https://github.com/hvds/Math-Prime-Util-GMP.git |
| 26 | + cd Math-Prime-Util-GMP |
| 27 | + git checkout simpqs-full |
| 28 | +
|
| 29 | + - name: Build pcoul |
| 30 | + shell: C:\cygwin\bin\bash.exe --login -o igncr '{0}' |
| 31 | + run: | |
| 32 | + cd "$GITHUB_WORKSPACE" |
| 33 | + MPUGMP=/cygdrive/c/cygwin/home/Math-Prime-Util-GMP MPUGMP_VER=2389dcbc44 make pcoul |
| 34 | +
|
| 35 | + - name: Strip executable |
| 36 | + shell: C:\cygwin\bin\bash.exe --login -o igncr '{0}' |
| 37 | + run: | |
| 38 | + cd "$GITHUB_WORKSPACE" |
| 39 | + strip pcoul.exe |
| 40 | +
|
| 41 | + - name: Get short SHA |
| 42 | + id: vars |
| 43 | + shell: C:\cygwin\bin\bash.exe --login -o igncr '{0}' |
| 44 | + run: | |
| 45 | + cd "$GITHUB_WORKSPACE" |
| 46 | + git config --global --add safe.directory "$(pwd)" |
| 47 | + SHORT_SHA=$(git rev-parse --short HEAD) |
| 48 | + echo "short_sha=$SHORT_SHA" >> "$GITHUB_OUTPUT" |
| 49 | + echo "Captured SHA: $SHORT_SHA" |
| 50 | +
|
| 51 | + - name: Package executable with dependencies |
| 52 | + shell: C:\cygwin\bin\bash.exe --login -o igncr '{0}' |
| 53 | + run: | |
| 54 | + cd "$GITHUB_WORKSPACE" |
| 55 | + mkdir -p release |
| 56 | + cp pcoul.exe release/ |
| 57 | + cp /cygdrive/c/cygwin/bin/cygwin1.dll release/ |
| 58 | + cp /cygdrive/c/cygwin/bin/cyggmp-10.dll release/ |
| 59 | + cp /cygdrive/c/cygwin/bin/cyggcc_s-seh-1.dll release/ |
| 60 | + cd release |
| 61 | + 7z a ../pcoul-windows-${{ steps.vars.outputs.short_sha }}.zip * |
| 62 | +
|
| 63 | + # Option 1: Upload as workflow artifact (downloadable for 90 days) |
| 64 | + # Set to 'false' to disable |
| 65 | + - name: Upload artifact |
| 66 | + if: true |
| 67 | + uses: actions/upload-artifact@v4 |
| 68 | + with: |
| 69 | + name: pcoul-windows-${{ steps.vars.outputs.short_sha }} |
| 70 | + path: pcoul-windows-${{ steps.vars.outputs.short_sha }}.zip |
| 71 | + retention-days: 90 |
| 72 | + |
| 73 | + # Option 2: Create or update draft release |
| 74 | + # Set to 'true' to enable |
| 75 | + - name: Create or update draft release |
| 76 | + if: false |
| 77 | + uses: softprops/action-gh-release@v1 |
| 78 | + with: |
| 79 | + tag_name: latest-windows |
| 80 | + name: "Windows Build (latest)" |
| 81 | + draft: true |
| 82 | + prerelease: false |
| 83 | + files: pcoul-windows-${{ steps.vars.outputs.short_sha }}.zip |
| 84 | + body: | |
| 85 | + Automated Windows build of pcoul |
| 86 | +
|
| 87 | + Built from commit: ${{ github.sha }} |
| 88 | + Short SHA: ${{ steps.vars.outputs.short_sha }} |
| 89 | +
|
| 90 | + This archive contains: |
| 91 | + - pcoul.exe |
| 92 | + - cygwin1.dll |
| 93 | + - cyggmp-10.dll |
| 94 | + - cyggcc_s-seh-1.dll |
| 95 | +
|
| 96 | + Extract all files to the same directory before running pcoul.exe. |
| 97 | + env: |
| 98 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments