1- name : WindowsMacOS
1+ name : MacOS
22
33on :
44 workflow_call :
@@ -10,7 +10,7 @@ permissions:
1010 contents : read
1111
1212concurrency :
13- group : windows- macos-${{ github.workflow }}-${{ github.event.number && format('pr{0}', github.event.number) || github.run_id }}
13+ group : macos-${{ github.workflow }}-${{ github.event.number && format('pr{0}', github.event.number) || github.run_id }}
1414 cancel-in-progress : true
1515
1616env :
@@ -33,18 +33,11 @@ jobs:
3333 steps :
3434 - name : Determine build matrix
3535 id : set-matrix
36- uses : actions/github-script@v8
36+ uses : actions/github-script@v9
3737 with :
3838 script : |
3939 const matrix = { include: [] };
4040
41- // Windows targets
42- matrix.include.push({
43- "name": "Windows Server 2025",
44- "runs-on": "windows-2025"
45- });
46-
47- // macOS targets
4841 matrix.include.push({
4942 "name": "macOS Latest (Apple Silicon)",
5043 "runs-on": "macos-latest"
7568 mac-arm-package-artifact-name : ${{ steps.publish-data.outputs.macos-latest-package-artifact-name }}
7669 mac-x86-package-file-name : ${{ steps.publish-data.outputs.macos-15-intel-package-file-name }}
7770 mac-arm-package-file-name : ${{ steps.publish-data.outputs.macos-latest-package-file-name }}
78- windows-pkg-url : ${{ steps.publish-data.outputs.windows-2025-s3-url }}
7971
8072 name : Build and Test (${{ matrix.name }})
8173 runs-on : ${{ matrix.runs-on }}
@@ -101,20 +93,11 @@ jobs:
10193 with :
10294 xcode-version : ' 16.2'
10395
104- - name : Enable symlinks
105- if : ${{ runner.os == 'Windows' }}
106- run : git config --local core.symlinks true
107-
108- - name : Disable auto CRLF on Windows
109- if : ${{ runner.os == 'Windows' }}
110- run : git config --local core.autocrlf false
111-
11296 - name : Determine build parameters
11397 id : build-params
11498 uses : ./.github/actions/build-params
11599
116100 - name : Set preferred tar
117- if : ${{ runner.os == 'macOS' }}
118101 id : preferred-tar
119102 run : |
120103 # Prepend gnu-tar's (future) location to the path, to prioritize it over system tar
@@ -123,13 +106,11 @@ jobs:
123106
124107 # TODO: find a friendlier approach for installing pip packages on GitHub runners
125108 - name : Force pip to allow break-system-packages via pip.conf
126- if : ${{ runner.os == 'macOS' }}
127109 run : |
128110 mkdir -p ~/.pip
129111 echo -e "[install]\nbreak-system-packages = true" > ~/.pip/pip.conf
130112
131113 - name : Install dependencies from brew
132- if : ${{ runner.os == 'macOS' }}
133114 run : |
134115 # Avoid reinstalling cmake
135116 brew list cmake > /dev/null || brew install cmake
@@ -158,22 +139,9 @@ jobs:
158139 brew link --overwrite nuget
159140
160141 - name : Install dependencies from pip
161- if : ${{ runner.os == 'macOS' }}
162142 run : |
163143 python3 -m pip install --user --upgrade distlib
164144
165- - name : Install specific QEMU from Choco
166- if : ${{ runner.os == 'Windows' }}
167- uses : crazy-max/ghaction-chocolatey@v4
168- with :
169- args : install --yes qemu --version=2023.4.24
170-
171- - name : Install other packages from Choco
172- if : ${{ runner.os == 'Windows' }}
173- uses : crazy-max/ghaction-chocolatey@v4
174- with :
175- args : install --yes wget unzip
176-
177145 - name : Set up vcpkg
178146 id : setup-vcpkg
179147 uses : lukka/run-vcpkg@v11
@@ -192,13 +160,12 @@ jobs:
192160 NUGET_PATH="$($VCPKG_ROOT/vcpkg fetch nuget | tail -n 1)"
193161 MONO_WRAPPER=""
194162
195- if [[ "$RUNNER_OS" == "macOS" ]]; then
196- # Check if we actually need to call NuGet through mono.
197- # That would be the case if NuGet is the real PE32 executable
198- # instead of a shim.
199- if file "$NUGET_PATH" | grep -q "PE32"; then
200- MONO_WRAPPER="mono"
201- fi
163+
164+ # Check if we actually need to call NuGet through mono.
165+ # That would be the case if NuGet is the real PE32 executable
166+ # instead of a shim.
167+ if file "$NUGET_PATH" | grep -q "PE32"; then
168+ MONO_WRAPPER="mono"
202169 fi
203170
204171 $MONO_WRAPPER "$NUGET_PATH" \
@@ -248,20 +215,6 @@ jobs:
248215 with :
249216 version : " v0.12.0"
250217
251- - name : Install Windows ADK
252- if : ${{ runner.os == 'Windows' }}
253- uses : crazy-max/ghaction-chocolatey@v4
254- with :
255- args : install --yes windows-adk-deploy
256-
257- - name : Install cmake
258- if : ${{ runner.os == 'Windows' }}
259- 260-
261- - name : Set up MSVC
262- if : ${{ runner.os == 'Windows' }}
263- uses : ilammy/msvc-dev-cmd@v1
264-
265218 - name : Configure
266219 run : >
267220 cmake
@@ -270,42 +223,67 @@ jobs:
270223 -GNinja
271224 -DMULTIPASS_UPSTREAM=origin
272225 -DMULTIPASS_BUILD_LABEL=${{ steps.build-params.outputs.label }}
273- ${{ runner.os == 'Windows' && '-DCMAKE_C_COMPILER=cl.exe -DCMAKE_CXX_COMPILER=cl.exe' || '' }}
274226 ${{ github.event_name == 'schedule' && '-DMP_ALLOW_OPTIONAL_FEATURES=OFF' || '' }}
275227 ${{ github.workspace }}
276228
277229 - name : Build
278230 run : cmake --build ${{ env.BUILD_DIR }}
279231
232+ - name : Enable core dump generation
233+ working-directory : ${{ env.BUILD_DIR }}
234+ shell : bash
235+ run : |
236+ # Allow core dumps
237+ sudo sysctl -w kern.coredump=1
238+ # This entitlement is needed for a proc to produce a coredump
239+ /usr/libexec/PlistBuddy -c "Add :com.apple.security.get-task-allow bool true" segv.entitlements
240+ # Code-sign the test executable to grant core dump entitlement
241+ codesign -s - -f --entitlements segv.entitlements bin/multipass_tests
242+ # Ensure destination exists and is writable
243+ sudo mkdir -p /cores || true
244+ sudo chmod 1777 /cores
245+ # Print syctl coredump parameters
246+ sysctl kern.coredump kern.corefile
247+ ulimit -a
248+ ulimit -Hc
249+
280250 - name : Run unit tests
281251 working-directory : ${{ env.BUILD_DIR }}
282252 run : |
253+ # Catch and save the test executable's exit code
254+ trap 'echo "MULTIPASS_TESTS_EXIT_CODE=$?" >> $GITHUB_ENV' EXIT
255+ # Set soft limit for the core file size (512MiB)
256+ ulimit -c 1048576
283257 bin/multipass_tests
284258
285259 - name : Run integration tests
286260 working-directory : ${{ env.BUILD_DIR }}
287261 run : |
288262 bin/multipass_integration_tests
289263
264+ - name : Upload test coredump
265+ uses : actions/upload-artifact@v7
266+ if : ${{ failure() && env.MULTIPASS_TESTS_EXIT_CODE != '0' }}
267+ with :
268+ name : buildandtest-test-crash-${{ matrix.runs-on }}-${{ matrix.build-type }}
269+ retention-days : 7
270+ path : |
271+ /cores/**
272+ ${{ env.BUILD_DIR }}/bin/multipass_tests
273+
290274 - name : Package
291275 id : cmake-package
292276 working-directory : ${{ env.BUILD_DIR }}
293277 run : >
294278 cmake --build . --target package
295279
296- echo "name=$( ${{ runner.os != 'Windows' && 'basename *.pkg' ||
297- '( Get-ChildItem .\packages\en-US\multipass-*.msi ).Name' }} ) " >>
298- ${{ runner.os != 'Windows' && '$GITHUB_OUTPUT' || '$env:GITHUB_OUTPUT' }}
280+ echo "name=$( basename *.pkg )" >> $GITHUB_OUTPUT
299281
300- echo "path=$( ${{ runner.os != 'Windows' && 'greadlink -f *.pkg' ||
301- '( Get-ChildItem .\packages\en-US\multipass-*.msi ).FullName' }} )" >>
302- ${{ runner.os != 'Windows' && '$GITHUB_OUTPUT' || '$env:GITHUB_OUTPUT' }}
282+ echo "path=$( greadlink -f *.pkg )" >> $GITHUB_OUTPUT
303283
304284 - name : Get package logs
305285 if : ${{ failure() && steps.cmake-package.outcome == 'failure' }}
306- run : >
307- ${{ format('cat {0}/_CPack_Packages/{1}', env.BUILD_DIR,
308- runner.os == 'Windows' && 'win64/External/WiXOutput.log' || 'Darwin/productbuild/InstallOutput.log') }}
286+ run : cat ${{ env.BUILD_DIR }}/_CPack_Packages/Darwin/productbuild/InstallOutput.log
309287
310288 - name : Upload package
311289 uses : actions/upload-artifact@v7
@@ -371,7 +349,6 @@ jobs:
371349
372350 # TODO: find a friendlier approach for installing pip packages on GitHub runners
373351 - name : Force pip to allow break-system-packages via pip.conf
374- if : ${{ runner.os == 'macOS' }}
375352 run : |
376353 mkdir -p ~/.pip
377354 echo -e "[install]\nbreak-system-packages = true" > ~/.pip/pip.conf
@@ -435,21 +412,7 @@ jobs:
435412 run : |
436413 echo "##[warning] Public URL: ${{ steps.s3-upload.outputs.url }}"
437414
438- DispatchCLITestsWorkflowWin :
439- name : " Dispatch CLI Tests (Windows)"
440- permissions :
441- contents : read
442- actions : read
443- checks : write
444- secrets : inherit
445- needs :
446- - BuildAndTest
447- uses : ./.github/workflows/cli-tests.yml
448- with :
449- windows-pkg-url : ${{ needs.BuildAndTest.outputs.windows-pkg-url }}
450- backend-driver : hyperv_api
451-
452- DispatchCLITestsWorkflowMac :
415+ DispatchCLITestsWorkflow :
453416 name : " Dispatch CLI Tests (macOS)"
454417 permissions :
455418 contents : read
@@ -492,6 +455,6 @@ jobs:
492455 MATTERMOST_CHANNEL : multipass
493456 TEXT : |
494457 :red_circle: @mp
495- Scheduled [WindowsMacOS ](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) workflow exited before completing.
458+ Scheduled [MacOS ](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) workflow exited before completing.
496459 MATTERMOST_USERNAME : ${{ github.triggering_actor }}
497460 MATTERMOST_ICON_URL : https://www.flaticon.com/free-icon/github-logo_25231
0 commit comments