Skip to content

Commit ec6b3c2

Browse files
authored
Add comprehensive macOS testing to PR workflow (#4857)
## Overview This PR adds macOS testing to the pull request workflow to monitor macOS-specific build issues without blocking development. The approach uses `continue-on-error: true` to collect failure data while maintaining a working CI/CD pipeline. ## Changes Made ### PR Workflow (test-pr.yml) - **Added `test-macos-build` job** that runs on `macos-15` - **Non-blocking execution**: Uses `continue-on-error: true` to prevent PR failures - **Comprehensive testing**: - Homebrew formula validation using `brew audit --strict` - Formula installation from source using `brew install --build-from-source` - Basic functionality testing with `kompile` for both LLVM and Haskell backends - Formula debugging artifacts uploaded for troubleshooting ### Release Workflow (release.yml) - **Made macOS jobs non-blocking**: Added `continue-on-error: true` to both: - `macos-build` job (Build MacOS Package) - `macos-test` job (Test MacOS Package) - **Prevents release blocking**: macOS failures won't prevent releases from completing ## Key Benefits - **Data Collection**: Monitor macOS build issues without breaking the pipeline - **Early Detection**: Catch macOS-specific problems in PRs before they reach releases - **Incremental Fixes**: Address issues over time without pressure to fix immediately - **Working CI/CD**: Maintain functional builds for all other platforms - **Debugging Support**: Upload artifacts for troubleshooting failed builds ## Current Status - ✅ **PR testing**: macOS tests run but don't block PR merges - ✅ **Release testing**: macOS builds don't block releases - ✅ **Clean codebase**: No complex workarounds or modifications to core build files - ✅ **Monitoring**: Can collect data on macOS-specific failures ## Remaining TODOs After further investigation of the collected failure data, the following items need to be addressed: ### High Priority - [ ] **Java 17 Compatibility**: Resolve Spotless/Google Java Format compatibility issues on macOS - [ ] **Maven Dependencies**: Fix dependency resolution problems in Homebrew build environment - [ ] **Build Environment**: Address macOS-specific build toolchain issues ### Medium Priority - [ ] **Homebrew Formula**: Optimize formula for better macOS compatibility - [ ] **Error Handling**: Improve error reporting and debugging capabilities - [ ] **Performance**: Optimize build times for macOS runners ### Future Enhancements - [ ] **CloudRepo Integration**: Enable proper Maven artifact publishing for PR testing - [ ] **Staging Repositories**: Integration with staging Maven repositories - [x] **Enhanced Monitoring**: Better failure analysis and reporting ## Testing Strategy The macOS testing job will: 1. Run on all PRs targeting the `develop` branch 2. Execute comprehensive Homebrew formula testing 3. Upload debugging artifacts on failure 4. **Not block PR merges** if it fails (due to `continue-on-error: true`) ## Related Issues - Addresses macOS build reliability issues in the release workflow - Provides foundation for incremental macOS build improvements - Establishes monitoring system for macOS-specific problems - Complements existing non-blocking macOS testing in release workflow ## Next Steps 1. Monitor macOS test results over several PR cycles 2. Analyze failure patterns and root causes 3. Implement targeted fixes based on collected data 4. Gradually improve macOS build reliability 5. Eventually remove `continue-on-error` when issues are resolved
1 parent 9dbdda3 commit ec6b3c2

File tree

2 files changed

+120
-1
lines changed

2 files changed

+120
-1
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ jobs:
302302
timeout-minutes: 120
303303
environment: production
304304
needs: [set-release-id, source-tarball]
305+
continue-on-error: true # Do not fail releases due to MacOS builds at this time. Oct. 6, 2025
305306
steps:
306307
- name: Check out code
307308
uses: actions/checkout@v4
@@ -400,7 +401,7 @@ jobs:
400401
timeout-minutes: 60
401402
environment: production
402403
needs: [macos-build, set-release-id]
403-
continue-on-error: true
404+
continue-on-error: true # Do not fail releases due to MacOS tests at this time. Oct. 6, 2025
404405
steps:
405406
- name: 'Check out matching homebrew repo branch'
406407
uses: actions/checkout@v4

.github/workflows/test-pr.yml

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,3 +337,121 @@ jobs:
337337
docker stop --time=0 k-pyk-regression-${{ github.sha }}
338338
339339
340+
test-macos-build:
341+
name: 'K: macOS Build & Test'
342+
runs-on: macos-15
343+
timeout-minutes: 60
344+
needs: code-quality
345+
continue-on-error: true # Do not fail PRs due to MacOS builds at this time. Oct. 6, 2025
346+
steps:
347+
- name: 'Check out code'
348+
uses: actions/checkout@v4
349+
with:
350+
submodules: recursive
351+
path: kframework
352+
353+
- name: 'Check out homebrew repo'
354+
uses: actions/checkout@v4
355+
with:
356+
repository: runtimeverification/homebrew-k
357+
path: homebrew-k
358+
ref: master
359+
360+
- name: 'Mac Dependencies'
361+
run: |
362+
# Via: https://github.com/ledger/ledger/commit/1eec9f86667cad3b0bbafb82a83739a0d30ca09f
363+
# Unlink and re-link to prevent errors when github mac runner images
364+
# install python outside of brew, for example:
365+
# https://github.com/orgs/Homebrew/discussions/3895
366+
# https://github.com/actions/setup-python/issues/577
367+
# https://github.com/actions/runner-images/issues/6459
368+
# https://github.com/actions/runner-images/issues/6507
369+
# https://github.com/actions/runner-images/issues/2322
370+
371+
# shellcheck disable=SC2162
372+
brew list -1 | grep python | while read formula; do brew unlink "$formula"; brew link --overwrite "$formula"; done
373+
374+
# uninstall pre-installed cmake
375+
brew uninstall cmake
376+
377+
- name: 'Build brew bottle'
378+
id: build
379+
env:
380+
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
381+
MAVEN_OPTS: >-
382+
-Dhttp.keepAlive=false
383+
-Dmaven.wagon.http.pool=false
384+
-Dmaven.wagon.httpconnectionManager.ttlSeconds=30
385+
run: |
386+
PACKAGE=kframework
387+
VERSION=$(cat kframework/package/version)
388+
ROOT_URL='https://github.com/runtimeverification/k/releases/download'
389+
390+
# For PR testing, we'll use the latest available source tarball
391+
# or create a test tarball from the current code
392+
if [ -f "$ROOT_URL/v${VERSION}/kframework-${VERSION}-src.tar.gz" ]; then
393+
wget "$ROOT_URL/v${VERSION}/kframework-${VERSION}-src.tar.gz"
394+
else
395+
# Create a test tarball from current code for PR testing
396+
echo "Creating test tarball for PR testing..."
397+
tar czf "kframework-${VERSION}-src.tar.gz" --exclude='.git' --exclude='homebrew-k' .
398+
fi
399+
400+
cd homebrew-k
401+
../kframework/package/macos/brew-update-to-local "${PACKAGE}" "${VERSION}"
402+
git commit "Formula/$PACKAGE.rb" -m "Update ${PACKAGE} to ${VERSION}: part 1"
403+
../kframework/package/macos/brew-build-and-update-to-local-bottle "${PACKAGE}" "${VERSION}" "${ROOT_URL}"
404+
git reset HEAD^
405+
LOCAL_BOTTLE_NAME=$(basename "$(find . -name "kframework--${VERSION}.arm64_sonoma.bottle*.tar.gz")")
406+
# shellcheck disable=2001
407+
BOTTLE_NAME=$(echo "${LOCAL_BOTTLE_NAME#./}" | sed 's!kframework--!kframework-!')
408+
../kframework/package/macos/brew-update-to-final "${PACKAGE}" "${VERSION}" "${ROOT_URL}"
409+
echo "path=${LOCAL_BOTTLE_NAME}" >> "${GITHUB_OUTPUT}"
410+
echo "path_remote=${BOTTLE_NAME}" >> "${GITHUB_OUTPUT}"
411+
412+
- name: 'Upload bottle'
413+
uses: actions/upload-artifact@v4
414+
with:
415+
name: homebrew-bottle
416+
path: homebrew-k
417+
retention-days: 1
418+
419+
- name: 'Test Homebrew formula validation'
420+
id: test
421+
env:
422+
# github actions sets the JAVA_HOME variable to Java 8 explicitly for
423+
# some reason. There doesn't seem to be a way to tell it to unset the
424+
# variable, so instead we just have to tell it to use Java 17
425+
# explicitly instead.
426+
JAVA_HOME: ${{ env.JAVA_HOME_17_X64 }}
427+
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
428+
MAVEN_OPTS: >-
429+
-Dhttp.keepAlive=false
430+
-Dmaven.wagon.http.pool=false
431+
-Dmaven.wagon.httpconnectionManager.ttlSeconds=30
432+
run: |
433+
# Test the Homebrew formula validation and basic functionality
434+
cd homebrew-k
435+
436+
# Validate the formula syntax by installing it as a local tap
437+
brew tap runtimeverification/k .
438+
brew audit --strict kframework
439+
440+
# Test formula installation from source
441+
brew install --build-from-source kframework -v
442+
443+
# Basic functionality test
444+
echo 'module TEST imports BOOL endmodule' > test.k
445+
kompile test.k --backend llvm
446+
kompile test.k --backend haskell
447+
echo "✅ macOS build and test completed successfully"
448+
449+
- name: 'Upload formula for debugging'
450+
if: always()
451+
uses: actions/upload-artifact@v4
452+
with:
453+
name: macos-formula-test
454+
path: homebrew-k/Formula/kframework.rb
455+
retention-days: 1
456+
457+

0 commit comments

Comments
 (0)