66 package_name :
77 description : " Package name to build"
88 type : string
9- needs :
10- description : " Parent workflow job dependencies"
11- type : string
12- dependencies :
13- description : " Install additional dependencies"
14- type : string
15- default : " "
169 packages_repository :
1710 description : " MSYS2 packages repository to build from"
1811 type : string
2114 description : " MSYS2 packages branch to build from"
2215 type : string
2316 default : " woarm64"
17+ runner_arch :
18+ description : " Architecture to build on"
19+ type : string
20+ default : " x86_64"
21+ needs :
22+ description : " Parent workflow job dependencies"
23+ type : string
24+ dependencies :
25+ description : " Install additional dependencies"
26+ type : string
27+ default : " "
2428
2529defaults :
2630 run :
2731 shell : msys2 {0}
2832
2933env :
3034 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
35+ CROSS_BUILD : ${{ inputs.runner_arch == 'aarch64' && '1' || '0' }}
36+ CLEAN_BUILD : 1
3137
3238jobs :
3339 build :
3440 name : Build ${{ inputs.package_name }}
35- runs-on : windows-latest
41+ runs-on : >-
42+ ${{ fromJson(inputs.runner_arch == 'aarch64'
43+ && '["Windows", "ARM64", "Blackhex"]'
44+ || '["windows-latest"]') }}
3645
3746 steps :
38- - uses : msys2/setup-msys2@v2
47+ - name : Kill hanging processes
48+ if : ${{ inputs.runner_arch == 'aarch64' }}
49+ shell : powershell
50+ run : |
51+ tasklist
52+ taskkill /F /FI 'MODULES eq msys-2.0.dll'
53+ tasklist
54+ Set-Location "${{ github.workspace }}"
55+ Remove-Item -Recurse -Force -ErrorAction SilentlyContinue -Path packages
56+ exit 0
57+
58+ - name : Fix Git long paths
59+ if : ${{ inputs.runner_arch == 'aarch64' }}
60+ shell : powershell
61+ run : |
62+ git config --global core.longpaths true
63+
64+ - name : Fix $PATH
65+ if : ${{ inputs.runner_arch == 'aarch64' }}
66+ shell : powershell
67+ run : |
68+ Write-Output "GITHUB_PATH: $env:GITHUB_PATH"
69+ Write-Output "C:\Program Files\Git\usr\bin\" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
70+
71+ - uses : Windows-on-ARM-Experiments/setup-msys2@main
72+ timeout-minutes : 10
3973 with :
40- msystem : ${{ contains(inputs.packages_repository, 'MINGW') && 'MINGW64' || 'MSYS' }}
41- update : true
42- cache : true
74+ msystem : >-
75+ ${{ contains(inputs.packages_repository, 'MINGW')
76+ && ((inputs.runner_arch == 'aarch64') && 'MINGWARM64' || 'MINGW64')
77+ || 'MSYS' }}
78+ update : ${{ inputs.runner_arch == 'x86_64' }}
79+ cache : ${{ inputs.runner_arch == 'x86_64' }}
4380
4481 - name : Checkout repository
4582 uses : actions/checkout@v4
4683
84+ - name : Checkout ${{ inputs.packages_repository }} repository
85+ uses : actions/checkout@v4
86+ with :
87+ repository : ${{ inputs.packages_repository }}
88+ ref : ${{ inputs.packages_branch }}
89+ sparse-checkout : ${{ inputs.package_name }}
90+ path : ${{ github.workspace }}/packages
91+
92+ - name : Pacman hang workaround
93+ if : ${{ inputs.runner_arch == 'aarch64' }}
94+ run : |
95+ `cygpath "${{ github.workspace }}"`/.github/scripts/pacman-workaround.sh
96+
97+ - name : First MSYS2 update
98+ if : ${{ inputs.runner_arch == 'aarch64' }}
99+ shell : powershell
100+ run : |
101+ msys2 -c 'pacman -Syuu --noconfirm'
102+ exit 0
103+
104+ - name : Second MSYS2 update
105+ if : ${{ inputs.runner_arch == 'aarch64' }}
106+ shell : powershell
107+ run : |
108+ msys2 -c 'pacman -Syuu --noconfirm'
109+
110+ - name : Setup packages repository
111+ if : ${{ inputs.runner_arch == 'aarch64' }}
112+ run : |
113+ `cygpath "${{ github.workspace }}"`/.github/scripts/setup-repository.sh
114+
47115 - name : Install dependencies
48116 run : |
49117 pacman -S --noconfirm \
50118 git \
51119 mingw-w64-x86_64-github-cli \
52120 mingw-w64-x86_64-jq \
53121 base-devel \
54- ${{ contains(inputs.packages_repository, 'MINGW') && 'mingw-w64-cross-gcc mingw-w64-x86_64-ccache ' || ' ccache ' }} \
122+ ${{ contains(inputs.packages_repository, 'MINGW') && 'mingw-w64-cross-mingwarm64- gcc mingw-w64-cross-mingwarm64-windows-default-manifest mingw-w64- x86_64-gcc-libs ' || '' }} \
55123 ${{ inputs.dependencies }}
56124
57125 - name : Download artifacts
@@ -69,51 +137,46 @@ jobs:
69137 run : |
70138 `cygpath "${{ github.workspace }}"`/.github/scripts/pthread-headers-hack-before.sh
71139
72- - name : Checkout ${{ inputs.packages_repository }} repository
73- uses : actions/checkout@v4
74- with :
75- repository : ${{ inputs.packages_repository }}
76- ref : ${{ inputs.packages_branch }}
77- sparse-checkout : ${{ inputs.package_name }}
78- path : ${{ github.workspace }}/packages
140+ - name : Setup MINGWARM64 environment
141+ if : ${{ inputs.runner_arch == 'aarch64' }}
142+ run : |
143+ `cygpath "${{ github.workspace }}"`/.github/scripts/setup-mingwarm64.sh
79144
80145 - name : Enable Ccache
81146 id : enable-ccache
82147 run : |
83148 `cygpath "${{ github.workspace }}"`/.github/scripts/enable-ccache.sh
84149
85150 - name : Restore Ccache
86- uses : actions/cache/restore@v4
151+ uses : actions/cache/restore@v4
87152 with :
88153 path : ${{ github.workspace }}/ccache
89- key : main -ccache-${{ steps.enable-ccache.outputs.timestamp }}
90- restore-keys : main-ccache -
154+ key : ${{ inputs.package_name }} -ccache-${{ steps.enable-ccache.outputs.timestamp }}
155+ restore-keys : ${{ inputs.package_name }} -
91156
92157 - name : Build ${{ inputs.package_name }}
93158 working-directory : ${{ github.workspace }}/packages/${{ inputs.package_name }}
94159 run : |
95- ccache -svv || true
96160 `cygpath "${{ github.workspace }}"`/.github/scripts/build-package.sh ${{ inputs.packages_repository }}
97- ccache -svv || true
98161
99162 - name : Save Ccache
100163 if : always()
101- uses : actions/cache/save@v4
164+ uses : actions/cache/save@v4
102165 with :
103166 path : ${{ github.workspace }}/ccache
104- key : main -ccache-${{ steps.enable-ccache.outputs.timestamp }}
167+ key : ${{ inputs.package_name }} -ccache-${{ steps.enable-ccache.outputs.timestamp }}
105168
106169 - name : Upload ${{ inputs.package_name }}
107170 uses : actions/upload-artifact@v4
108171 with :
109172 name : ${{ inputs.package_name }}
110- retention-days : 1
173+ retention-days : 7
111174 path : ${{ github.workspace }}/packages/${{ inputs.package_name }}/*.pkg.tar.zst
112175
113176 - name : Upload build folder
114177 if : failure()
115178 uses : actions/upload-artifact@v4
116179 with :
117180 name : ${{ inputs.package_name }}-build
118- retention-days : 1
181+ retention-days : 3
119182 path : ${{ github.workspace }}/packages/${{ inputs.package_name }}/src
0 commit comments