summaryrefslogtreecommitdiff
path: root/.github/workflows/macos.yml
blob: 37422bc4d185880a19fd88e6ab04cfa5b012c6fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: macos

concurrency:
  group: macos-${{ github.head_ref }}
  cancel-in-progress: true

on:
  push:
    paths:
      - "mesonbuild/**"
      - "test cases/**"
      - "unittests/**"
      - ".github/workflows/macos.yml"
      - "run_unittests.py"
  pull_request:
    paths:
      - "mesonbuild/**"
      - "test cases/**"
      - "unittests/**"
      - ".github/workflows/macos.yml"
      - "run_unittests.py"

permissions:
  contents: read

jobs:
  unittests-appleclang:
    runs-on: macos-latest
    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-python@v2
      with:
        python-version: '3.x'
    - run: |
        python -m pip install --upgrade pip
        python -m pip install pytest pytest-xdist pytest-subtests jsonschema coverage codecov
    # Use llvm-14 for now to fix llvm framework static tests, see
    # https://github.com/Homebrew/discussions/discussions/3666#discussioncomment-3681821
    - run: brew install pkg-config ninja llvm@14 qt@5
    - env:
        CPPFLAGS: "-I/usr/local/include"
        LDFLAGS: "-L/usr/local/lib"
        MESON_CI_JOBNAME: unittests-appleclang
        MESON_UNIT_TEST_BACKEND: ninja
        # These cannot evaluate anything, so we cannot set PATH or SDKROOT here
      run: |
        export SDKROOT="$(xcodebuild -version -sdk macosx Path)"
        export PATH="$HOME/tools:/usr/local/opt/qt@5/bin:$PATH:$(brew --prefix llvm@14)/bin"
        export PKG_CONFIG_PATH="/usr/local/opt/qt@5/lib/pkgconfig:$PKG_CONFIG_PATH"
        ./tools/run_with_cov.py ./run_unittests.py
    - name: Upload coverage report
      run: ./ci/upload_cov.sh "appleclang [unit tests]"


  project-tests-appleclang:
    runs-on: macos-latest
    strategy:
      fail-fast: false
      matrix:
        include:
        - NAME: macos-clang
          unity: off
        - NAME: macos-clang-unity
          unity: on

    name: ${{ matrix.NAME }}
    env:
      MESON_CI_JOBNAME: ${{ matrix.NAME }}

    steps:
    - uses: actions/checkout@v2
    # use python3 from homebrew because it is a valid framework, unlike the actions one:
    # https://github.com/actions/setup-python/issues/58
    # Use llvm-14 for now to fix llvm framework static tests, see
    # https://github.com/Homebrew/discussions/discussions/3666#discussioncomment-3681821
    - run: brew install pkg-config ninja llvm@14 qt@5 boost ldc hdf5 openmpi lapack scalapack sdl2 python3 boost-python3 gtk-doc
    - run: |
        python3 -m pip install --upgrade setuptools
        python3 -m pip install --upgrade pip
        python3 -m pip install cython coverage codecov
    - env:
        CPPFLAGS: "-I/usr/local/include"
        LDFLAGS: "-L/usr/local/lib"
        MESON_ARGS: --unity=${{ matrix.unity }}
        CI: 1
        # These cannot evaluate anything, so we cannot set PATH or SDKROOT here
      run: |
        export SDKROOT="$(xcodebuild -version -sdk macosx Path)"
        export PATH="$HOME/tools:/usr/local/opt/qt@5/bin:$PATH:$(brew --prefix llvm@14)/bin"
        export PKG_CONFIG_PATH="/usr/local/opt/qt@5/lib/pkgconfig:$PKG_CONFIG_PATH"
        export XML_CATALOG_FILES="/usr/local/etc/xml/catalog"
        ./tools/run_with_cov.py ./run_project_tests.py --backend=ninja
    - name: Upload coverage report
      run: ./ci/upload_cov.sh "appleclang [project tests; unity=${{ matrix.unity }}]"

  Qt4_LLVM15_macos:
    runs-on: macos-latest
    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-python@v2
      with:
        python-version: '3.x'
    - run: python -m pip install -e .
    - run: brew install pkg-config ninja gcc llvm
    - run: brew tap cartr/qt4
    - run: brew install qt@4
    - run: brew link qt@4
    # qt4 tap seems to be broken
    - run: ln -sfn /usr/local/Cellar/qt@4/4.8.7_6.reinstall /usr/local/Cellar/qt@4/4.8.7_6
    - run: meson setup "test cases/frameworks/4 qt" build_qt -Drequired=qt4
    - run: meson compile -C build_qt
    - uses: actions/upload-artifact@v1
      if: failure()
      with:
        name: Qt4_Mac_build
        path: build_qt/meson-logs/meson-log.txt
    - run: meson test -C build_qt -v
    - uses: actions/upload-artifact@v1
      if: failure()
      with:
        name: Qt4_Mac_test
        path: build_qt/meson-logs/testlog.txt
    # llvm-15 is broken, due to which static linking doesn't work
    # https://github.com/mesonbuild/meson/pull/10879#issuecomment-1264524936
    - run: |
        export PATH="$PATH:$(brew --prefix llvm)/bin"
        meson setup "test cases/frameworks/15 llvm" build_llvm -Dlink-static=false -Dmethod=config-tool
    - run: meson compile -C build_llvm
    - uses: actions/upload-artifact@v1
      if: failure()
      with:
        name: LLVM15_Mac_build
        path: build_llvm/meson-logs/meson-log.txt