macos.yml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. name: macos
  2. concurrency:
  3. group: macos-${{ github.head_ref || github.ref }}
  4. cancel-in-progress: true
  5. on:
  6. push:
  7. paths:
  8. - "mesonbuild/**"
  9. - "test cases/**"
  10. - "unittests/**"
  11. - ".github/workflows/macos.yml"
  12. - "run_unittests.py"
  13. pull_request:
  14. paths:
  15. - "mesonbuild/**"
  16. - "test cases/**"
  17. - "unittests/**"
  18. - ".github/workflows/macos.yml"
  19. - "run_unittests.py"
  20. permissions:
  21. contents: read
  22. jobs:
  23. unittests-appleclang:
  24. runs-on: macos-latest
  25. steps:
  26. - uses: actions/checkout@v3
  27. - uses: actions/setup-python@v4
  28. with:
  29. python-version: '3.x'
  30. - run: |
  31. python -m pip install --upgrade pip
  32. python -m pip install pytest pytest-xdist pytest-subtests jsonschema coverage codecov
  33. - run: brew install pkg-config ninja llvm qt@5
  34. - env:
  35. CPPFLAGS: "-I/usr/local/include"
  36. LDFLAGS: "-L/usr/local/lib"
  37. MESON_CI_JOBNAME: unittests-appleclang
  38. MESON_UNIT_TEST_BACKEND: ninja
  39. # These cannot evaluate anything, so we cannot set PATH or SDKROOT here
  40. run: |
  41. export SDKROOT="$(xcodebuild -version -sdk macosx Path)"
  42. export PATH="$HOME/tools:/usr/local/opt/qt@5/bin:$PATH:$(brew --prefix llvm)/bin"
  43. export PKG_CONFIG_PATH="/usr/local/opt/qt@5/lib/pkgconfig:$PKG_CONFIG_PATH"
  44. ./tools/run_with_cov.py ./run_unittests.py
  45. - name: Upload coverage report
  46. run: ./ci/upload_cov.sh "appleclang [unit tests]"
  47. project-tests-appleclang:
  48. runs-on: macos-latest
  49. strategy:
  50. fail-fast: false
  51. matrix:
  52. include:
  53. - NAME: macos-clang
  54. unity: off
  55. - NAME: macos-clang-unity
  56. unity: on
  57. name: ${{ matrix.NAME }}
  58. env:
  59. MESON_CI_JOBNAME: ${{ matrix.NAME }}
  60. steps:
  61. - uses: actions/checkout@v3
  62. # Avoid picking up an older version of LLVM that does not work.
  63. - run: brew update
  64. # github actions overwrites brew's python. Force it to reassert itself, by running in a separate step.
  65. - name: unbreak python in github actions
  66. run: |
  67. find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete
  68. sudo rm -rf /Library/Frameworks/Python.framework/
  69. brew install --force python3 && brew unlink python3 && brew unlink python3 && brew link --overwrite python3
  70. # use python3 from homebrew because it is a valid framework, unlike the actions one:
  71. # https://github.com/actions/setup-python/issues/58
  72. - run: brew install pkg-config ninja llvm qt@5 boost ldc hdf5 openmpi lapack scalapack sdl2 boost-python3 gtk-doc
  73. - run: |
  74. python3 -m pip install --upgrade setuptools
  75. python3 -m pip install --upgrade pip
  76. python3 -m pip install cython coverage codecov
  77. - env:
  78. CPPFLAGS: "-I/usr/local/include"
  79. LDFLAGS: "-L/usr/local/lib"
  80. MESON_ARGS: --unity=${{ matrix.unity }}
  81. CI: 1
  82. # These cannot evaluate anything, so we cannot set PATH or SDKROOT here
  83. run: |
  84. export SDKROOT="$(xcodebuild -version -sdk macosx Path)"
  85. export PATH="$HOME/tools:/usr/local/opt/qt@5/bin:$PATH:$(brew --prefix llvm)/bin"
  86. export PKG_CONFIG_PATH="/usr/local/opt/qt@5/lib/pkgconfig:$PKG_CONFIG_PATH"
  87. export XML_CATALOG_FILES="/usr/local/etc/xml/catalog"
  88. ./tools/run_with_cov.py ./run_project_tests.py --backend=ninja
  89. - name: Upload coverage report
  90. run: ./ci/upload_cov.sh "appleclang [project tests; unity=${{ matrix.unity }}]"
  91. Qt4macos:
  92. runs-on: macos-latest
  93. steps:
  94. - uses: actions/checkout@v3
  95. - uses: actions/setup-python@v4
  96. with:
  97. python-version: '3.x'
  98. - run: python -m pip install -e .
  99. - run: brew install pkg-config ninja gcc
  100. - run: brew tap cartr/qt4
  101. - run: brew install qt@4
  102. - run: brew link qt@4
  103. # qt4 tap seems to be broken
  104. - run: ln -sfn /usr/local/Cellar/qt@4/4.8.7_6.reinstall /usr/local/Cellar/qt@4/4.8.7_6
  105. - run: meson setup "test cases/frameworks/4 qt" build -Drequired=qt4
  106. - run: meson compile -C build
  107. - uses: actions/upload-artifact@v3
  108. if: failure()
  109. with:
  110. name: Qt4_Mac_build
  111. path: build/meson-logs/meson-log.txt
  112. - run: meson test -C build -v
  113. - uses: actions/upload-artifact@v3
  114. if: failure()
  115. with:
  116. name: Qt4_Mac_test
  117. path: build/meson-logs/testlog.txt