| 
 | 1 | +name: Meson  | 
 | 2 | + | 
 | 3 | +on:  | 
 | 4 | +  pull_request:  | 
 | 5 | +  push:  | 
 | 6 | + | 
 | 7 | +jobs:  | 
 | 8 | +  meson-build-and-tests:  | 
 | 9 | +    runs-on: ${{ matrix.platform }}  | 
 | 10 | +    name: ${{ matrix.platform }}, ${{ matrix.mode.name }} ${{ matrix.flavor }}  | 
 | 11 | +    strategy:  | 
 | 12 | +      fail-fast: false  | 
 | 13 | +      matrix:  | 
 | 14 | +        flavor:  | 
 | 15 | +          - debug  | 
 | 16 | +          - release  | 
 | 17 | +        mode:  | 
 | 18 | +          - name: default  | 
 | 19 | +            extra_envs: {}  | 
 | 20 | + | 
 | 21 | +          # Alternative compiler setups  | 
 | 22 | +          - name: gcc  | 
 | 23 | +            extra_envs:  | 
 | 24 | +              CC: gcc  | 
 | 25 | +              CXX: g++  | 
 | 26 | +          - name: clang  | 
 | 27 | +            extra_envs:  | 
 | 28 | +              CC: clang  | 
 | 29 | +              CXX: clang++  | 
 | 30 | + | 
 | 31 | +          - name: sanitize  | 
 | 32 | +            args: >-  | 
 | 33 | +              "-Db_sanitize=address,undefined"  | 
 | 34 | +            extra_envs: {}  | 
 | 35 | + | 
 | 36 | +          # This is for MSVC, which only supports AddressSanitizer.  | 
 | 37 | +          # https://learn.microsoft.com/en-us/cpp/sanitizers/  | 
 | 38 | +          - name: sanitize+asanonly  | 
 | 39 | +            args: -Db_sanitize=address  | 
 | 40 | +            extra_envs:  | 
 | 41 | +              ASAN_OPTIONS: report_globals=0:halt_on_error=1:abort_on_error=1:print_summary=1  | 
 | 42 | + | 
 | 43 | +          - name: clang+sanitize  | 
 | 44 | +            args: >-  | 
 | 45 | +              "-Db_sanitize=address,undefined"  | 
 | 46 | +            extra_envs:  | 
 | 47 | +              CC: clang  | 
 | 48 | +              CXX: clang++  | 
 | 49 | + | 
 | 50 | +          # default clang on GitHub hosted runners is from MSYS2.  | 
 | 51 | +          # Use Visual Studio supplied clang-cl instead.  | 
 | 52 | +          - name: clang-cl+sanitize  | 
 | 53 | +            args: >-  | 
 | 54 | +              "-Db_sanitize=address,undefined"  | 
 | 55 | +            extra_envs:  | 
 | 56 | +              CC: clang-cl  | 
 | 57 | +              CXX: clang-cl  | 
 | 58 | +        platform:  | 
 | 59 | +          - ubuntu-22.04  | 
 | 60 | +          - windows-2022  | 
 | 61 | +          - macos-latest  | 
 | 62 | + | 
 | 63 | +        exclude:  | 
 | 64 | +          # clang-cl only makes sense on windows.  | 
 | 65 | +          - platform: ubuntu-22.04  | 
 | 66 | +            mode:  | 
 | 67 | +              name: clang-cl+sanitize  | 
 | 68 | +          - platform: macos-latest  | 
 | 69 | +            mode:  | 
 | 70 | +              name: clang-cl+sanitize  | 
 | 71 | + | 
 | 72 | +          # Use clang-cl instead of MSYS2 clang.  | 
 | 73 | +          #  | 
 | 74 | +          # we already tested clang+sanitize on linux,  | 
 | 75 | +          # if this doesn't work, it should be an issue for MSYS2 team to consider.  | 
 | 76 | +          - platform: windows-2022  | 
 | 77 | +            mode:  | 
 | 78 | +              name: clang  | 
 | 79 | +          - platform: windows-2022  | 
 | 80 | +            mode:  | 
 | 81 | +              name: clang+sanitize  | 
 | 82 | + | 
 | 83 | +          # MSVC-only sanitizers  | 
 | 84 | +          - platform: ubuntu-22.04  | 
 | 85 | +            mode:  | 
 | 86 | +              name: sanitize+asanonly  | 
 | 87 | +          - platform: macos-latest  | 
 | 88 | +            mode:  | 
 | 89 | +              name: sanitize+asanonly  | 
 | 90 | +          - platform: windows-2022  | 
 | 91 | +            mode:  | 
 | 92 | +              name: sanitize  | 
 | 93 | + | 
 | 94 | +          # clang is the default on macos  | 
 | 95 | +          # also gcc is an alias to clang  | 
 | 96 | +          - platform: macos-latest  | 
 | 97 | +            mode:  | 
 | 98 | +              name: clang  | 
 | 99 | +          - platform: macos-latest  | 
 | 100 | +            mode:  | 
 | 101 | +              name: gcc  | 
 | 102 | + | 
 | 103 | +          # gcc is the default on linux  | 
 | 104 | +          - platform: ubuntu-22.04  | 
 | 105 | +            mode:  | 
 | 106 | +              name: gcc  | 
 | 107 | + | 
 | 108 | +          # only run sanitizer tests on linux  | 
 | 109 | +          #  | 
 | 110 | +          # gcc/clang's codegen shouldn't massively change across platforms,  | 
 | 111 | +          # and linux supports most of the sanitizers.  | 
 | 112 | +          - platform: macos-latest  | 
 | 113 | +            mode:  | 
 | 114 | +              name: clang+sanitize  | 
 | 115 | +          - platform: macos-latest  | 
 | 116 | +            mode:  | 
 | 117 | +              name: sanitize  | 
 | 118 | +    steps:  | 
 | 119 | +      - name: Setup meson  | 
 | 120 | +        run: |  | 
 | 121 | +          pipx install meson ninja  | 
 | 122 | +      - name: Checkout  | 
 | 123 | +        uses: actions/checkout@v4  | 
 | 124 | +      - name: Activate MSVC and Configure  | 
 | 125 | +        if: ${{ matrix.platform == 'windows-2022' }}  | 
 | 126 | +        env: ${{ matrix.mode.extra_envs }}  | 
 | 127 | +        run: |  | 
 | 128 | +          meson setup build-${{ matrix.flavor }} --buildtype=${{ matrix.flavor }} -Ddefault_library=static ${{ matrix.mode.args }} --vsenv  | 
 | 129 | +      - name: Configuring  | 
 | 130 | +        if: ${{ matrix.platform != 'windows-2022' }}  | 
 | 131 | +        env: ${{ matrix.mode.extra_envs }}  | 
 | 132 | +        run: |  | 
 | 133 | +          meson setup build-${{ matrix.flavor }} --buildtype=${{ matrix.flavor }} -Db_lundef=false ${{ matrix.mode.args }}  | 
 | 134 | +      - name: Building  | 
 | 135 | +        run: |  | 
 | 136 | +          meson compile -C build-${{ matrix.flavor }}  | 
 | 137 | +      - name: Running tests  | 
 | 138 | +        env: ${{ matrix.mode.extra_envs }}  | 
 | 139 | +        run: |  | 
 | 140 | +          meson test -C build-${{ matrix.flavor }} --timeout-multiplier 0  | 
 | 141 | +      - uses: actions/upload-artifact@v4  | 
 | 142 | +        if: failure()  | 
 | 143 | +        with:  | 
 | 144 | +          name: ${{ matrix.platform }}-${{ matrix.mode.name }}-${{ matrix.flavor }}-logs  | 
 | 145 | +          path: build-${{ matrix.flavor }}/meson-logs  | 
0 commit comments