|
| 1 | +name: Build Vim for Windows ARM |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + |
| 7 | +permissions: |
| 8 | + id-token: write # needed for attestion |
| 9 | + attestations: write |
| 10 | + contents: write # needed for release update |
| 11 | + |
| 12 | +jobs: |
| 13 | + build-and-release-arm: |
| 14 | + runs-on: windows-11-arm |
| 15 | + env: |
| 16 | + ARCH: x64 |
| 17 | + DEPENDENCIES: c:\dependencies |
| 18 | + GH_TAG_NAME: ${{ github.ref_name }} |
| 19 | + |
| 20 | + steps: |
| 21 | + - name: Checkout repository |
| 22 | + uses: actions/checkout@v4 |
| 23 | + |
| 24 | + - name: Set up MSVC Dev tools |
| 25 | + uses: ilammy/msvc-dev-cmd@v1 |
| 26 | + with: |
| 27 | + arch: amd64_arm64 |
| 28 | + |
| 29 | + - name: Cache dependencies |
| 30 | + uses: actions/cache@v4 |
| 31 | + with: |
| 32 | + path: | |
| 33 | + c:\dependencies |
| 34 | + c:\vcpkg |
| 35 | + downloads |
| 36 | + key: ${{ runner.os }} |
| 37 | + |
| 38 | + - name: Prepare Vim Build |
| 39 | + shell: cmd |
| 40 | + run: | |
| 41 | + set "PATH=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build;%PATH%" |
| 42 | + call vcvarsall.bat x64_arm64 |
| 43 | + set "VCPKG_ROOT=c:\vcpkg" |
| 44 | + call appveyor.bat install |
| 45 | +
|
| 46 | + - name: Build Vim (ARM) |
| 47 | + shell: cmd |
| 48 | + run: | |
| 49 | + set "PATH=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build;%PATH%" |
| 50 | + call vcvarsall.bat x64_arm64 |
| 51 | + call appveyor.bat build |
| 52 | +
|
| 53 | + # Skip the test for now, it still fails |
| 54 | +# - name: Test Vim |
| 55 | +# shell: cmd |
| 56 | +# run: | |
| 57 | +# call appveyor.bat test |
| 58 | + |
| 59 | + - name: Package Vim |
| 60 | + shell: cmd |
| 61 | + run: | |
| 62 | + set "VCPKG_ROOT=c:\vcpkg" |
| 63 | + call appveyor.bat package |
| 64 | +
|
| 65 | + - name: upload Installer |
| 66 | + id: upload-installer |
| 67 | + uses: actions/upload-artifact@v4 |
| 68 | + env: |
| 69 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 70 | + with: |
| 71 | + name: arm64-windows-installer.exe |
| 72 | + path: | |
| 73 | + gvim*.exe |
| 74 | +
|
| 75 | + - name: Attest Installer |
| 76 | + uses: actions/attest-build-provenance@v2 |
| 77 | + with: |
| 78 | + subject-name: arm64-windows-installer.exe |
| 79 | + subject-digest: sha256:${{ steps.upload-installer.outputs.artifact-digest }} |
| 80 | + |
| 81 | + - name: upload Zip File |
| 82 | + id: upload-zip |
| 83 | + uses: actions/upload-artifact@v4 |
| 84 | + env: |
| 85 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 86 | + with: |
| 87 | + name: arm64-windows-zip-archive.zip |
| 88 | + path: | |
| 89 | + gvim*.zip |
| 90 | +
|
| 91 | + - name: Attest Zip File |
| 92 | + uses: actions/attest-build-provenance@v2 |
| 93 | + with: |
| 94 | + subject-name: arm64-windows-zip-archive.zip |
| 95 | + subject-digest: sha256:${{ steps.upload-zip.outputs.artifact-digest }} |
| 96 | + |
| 97 | + # the release will be created by the appveyor CI, so we need to wait |
| 98 | + # until it exists before trying to push our release artifacts |
| 99 | + - name: Wait for Github Release |
| 100 | + shell: bash |
| 101 | + env: |
| 102 | + TAG_NAME: ${{ github.ref_name }} |
| 103 | + run: | |
| 104 | + echo "Waiting for release with tag $TAG_NAME..." |
| 105 | + for i in {1..30}; do |
| 106 | + STATUS=$(curl -s -o /dev/null -w "%{http_code}" \ |
| 107 | + -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ |
| 108 | + https://api.github.com/repos/${{ github.repository }}/releases/tags/$TAG_NAME) |
| 109 | +
|
| 110 | + if [ "$STATUS" -eq 200 ]; then |
| 111 | + echo "✅ Release $TAG_NAME exists!" |
| 112 | + exit 0 |
| 113 | + else |
| 114 | + echo "⏳ Attempt $i: Release not found yet. Waiting 60s..." |
| 115 | + sleep 60 |
| 116 | + fi |
| 117 | + done |
| 118 | +
|
| 119 | + echo "❌ Timed out waiting for release $TAG_NAME" |
| 120 | + exit 1 |
| 121 | +
|
| 122 | + - name: Upload to Github Release |
| 123 | + shell: bash |
| 124 | + env: |
| 125 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 126 | + run: | |
| 127 | + for i in gvim*.exe gvim*.zip; do |
| 128 | + gh release upload "$GH_TAG_NAME" "$i" --clobber |
| 129 | + done |
| 130 | +
|
| 131 | + - name: Post Summary |
| 132 | + run: | |
| 133 | + echo "## ✅ Windows ARM Build Summary" >> $GITHUB_STEP_SUMMARY |
| 134 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 135 | + echo "**Tag:** \`$GH_TAG_NAME\`" >> $GITHUB_STEP_SUMMARY |
| 136 | + echo "**Repository:** \`${{ github.repository }}\`" >> $GITHUB_STEP_SUMMARY |
| 137 | + echo "**Artifacts Uploaded:**" >> $GITHUB_STEP_SUMMARY |
| 138 | + echo "- 🟩 [arm64-windows-installer.exe](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})" >> $GITHUB_STEP_SUMMARY |
| 139 | + echo "- 🟦 [arm64-windows-zip-archive.zip](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})" >> $GITHUB_STEP_SUMMARY |
| 140 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 141 | + echo "**Release Status:**" >> $GITHUB_STEP_SUMMARY |
| 142 | + echo "- 🔁 Waited for tag \`$GH_TAG_NAME\` to become available as a release" >> $GITHUB_STEP_SUMMARY |
| 143 | + echo "- 📦 Uploaded artifacts to the release via \`gh release upload\`" >> $GITHUB_STEP_SUMMARY |
| 144 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 145 | + echo "**Security Provenance:**" >> $GITHUB_STEP_SUMMARY |
| 146 | + echo "- 🔒 Attested \`arm64-windows-installer.exe\` and \`arm64-windows-zip-archive.zip\` using [actions/attest-build-provenance](https://github.com/actions/attest-build-provenance)" >> $GITHUB_STEP_SUMMARY |
0 commit comments