summaryrefslogtreecommitdiff
path: root/Meta/Azure/Lagom.yml
blob: 5384e03ec8ff4928720ca691f0b7bcfa338766d5 (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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
parameters:
  os: 'Linux'
  fuzzer: 'NoFuzz'
  lagom_lints: false

jobs:
  - job: 'Lagom_${{ parameters.os }}_${{ parameters.fuzzer }}'
    timeoutInMinutes: 0 # Setting to 0 means the maximum allowed timeout is used.

    variables:
    - name: SERENITY_CCACHE_DIR
      value: $(Build.SourcesDirectory)/.ccache

    - name: job_pool
      ${{ if or(eq(parameters.os, 'Linux'), eq(parameters.os, 'Android')) }}:
        value: ubuntu-22.04
      ${{ if eq(parameters.os, 'macOS') }}:
        value: macos-12

    - name: toolchain
      ${{ if eq(parameters.fuzzer, 'Fuzz') }}:
        value: clang
      ${{ if eq(parameters.fuzzer, 'NoFuzz') }}:
        value: gcc

    - name: host-cc
      ${{ if eq(parameters.os, 'macOS') }}:
        value: $(brew --prefix llvm@15)/bin/clang
      ${{ if not(eq(parameters.os, 'macOS')) }}:
        value: gcc-12

    - name: host-cxx
      ${{ if eq(parameters.os, 'macOS') }}:
        value: $(brew --prefix llvm@15)/bin/clang++
      ${{ if not(eq(parameters.os, 'macOS')) }}:
        value: g++-12

    - name: ndk_version # only relevant for Android
      value: '24.0.8215888'

    pool:
      vmImage: $(job_pool)

    steps:
    - template: Setup.yml
      parameters:
        os: '${{ parameters.os }}'

    - template: Caches.yml
      parameters:
        os: '${{ parameters.os }}'
        arch: 'Lagom'
        toolchain: '$(toolchain)'
        download_cache_path: 'Meta/Lagom/Build'
        serenity_ccache_path: '$(SERENITY_CCACHE_DIR)'
        with_remote_data_caches: true
        ${{ if eq(parameters.os, 'macOS') }}:
          ccache_version: 2
          serenity_ccache_size: '2G'

    - ${{ if eq(parameters.os, 'Android') }}:
      - script: |
          yes | $ANDROID_SDK_ROOT/tools/bin/sdkmanager "ndk;$(ndk_version)"
        displayName: "Install NDK $(ndk_version)"

      - script: |
          cmake -GNinja -B tools-build \
            -DBUILD_LAGOM=OFF \
            -DENABLE_LAGOM_CCACHE=ON \
            -DCMAKE_C_COMPILER=$(host-cc) \
            -DCMAKE_CXX_COMPILER=$(host-cxx) \
            -DCMAKE_INSTALL_PREFIX=tool-install \
            -Dpackage=LagomTools
          ninja -C tools-build install
          cmake -GNinja -B Build \
            -DBUILD_LAGOM=ON \
            -DENABLE_LAGOM_LADYBIRD=ON \
            -DENABLE_LAGOM_CCACHE=ON \
            -DBUILD_SHARED_LIBS=OFF \
            -DANDROID_ABI=arm64-v8a \
            -DANDROID_NATIVE_API_LEVEL=30 \
            -DANDROID_NDK=$ANDROID_SDK_ROOT/ndk/$(ndk_version) \
            -DANDROID_STL=c++_shared \
            -DCMAKE_TOOLCHAIN_FILE=$ANDROID_SDK_ROOT/ndk/$(ndk_version)/build/cmake/android.toolchain.cmake \
            -DLagomTools_DIR=$(Build.SourcesDirectory)/Meta/Lagom/tool-install/share/LagomTools
        displayName: 'Create Build Environment'
        workingDirectory: $(Build.SourcesDirectory)/Meta/Lagom
        env:
          CCACHE_DIR: '$(SERENITY_CCACHE_DIR)'

    - ${{ elseif eq(parameters.fuzzer, 'Fuzz') }}:
      - script: |
          cmake -GNinja -B tools-build \
              -DBUILD_LAGOM=OFF \
              -DENABLE_LAGOM_CCACHE=ON \
              -DCMAKE_INSTALL_PREFIX=tool-install \
              -Dpackage=LagomTools
          ninja -C tools-build install
          cmake -GNinja -B Build \
            -DBUILD_LAGOM=ON \
            -DENABLE_LAGOM_CCACHE=ON \
            -DENABLE_FUZZERS_LIBFUZZER=ON \
            -DENABLE_ADDRESS_SANITIZER=ON \
            -DCMAKE_C_COMPILER=clang \
            -DCMAKE_CXX_COMPILER=clang++ \
            -DCMAKE_PREFIX_PATH=tool-install
        displayName: 'Create Build Environment'
        workingDirectory: $(Build.SourcesDirectory)/Meta/Lagom
        env:
          CCACHE_DIR: '$(SERENITY_CCACHE_DIR)'
    - ${{ elseif eq(parameters.fuzzer, 'NoFuzz') }}:
      - script: |
          cmake -GNinja -B Build \
            -DBUILD_LAGOM=ON \
            -DENABLE_LAGOM_CCACHE=ON \
            -DENABLE_LAGOM_LADYBIRD=ON \
            -DINCLUDE_WASM_SPEC_TESTS=ON \
            -DWASM_SPEC_TEST_SKIP_FORMATTING=ON \
            -DENABLE_UNDEFINED_SANITIZER=ON \
            -DENABLE_ADDRESS_SANITIZER=ON \
            -DCMAKE_C_COMPILER=$(host-cc) \
            -DCMAKE_CXX_COMPILER=$(host-cxx)
        displayName: 'Create Build Environment'
        workingDirectory: $(Build.SourcesDirectory)/Meta/Lagom
        env:
          PATH: '$(PATH):$(Build.SourcesDirectory)/wabt-1.0.23/bin'
          CCACHE_DIR: '$(SERENITY_CCACHE_DIR)'

    - script: |
        cmake --build .
        cmake --install . --prefix $(Build.SourcesDirectory)/Meta/Lagom/Install
      displayName: 'Build'
      workingDirectory: $(Build.SourcesDirectory)/Meta/Lagom/Build
      env:
        CCACHE_DIR: '$(SERENITY_CCACHE_DIR)'

    - ${{ if and(eq(parameters.fuzzer, 'NoFuzz'), not(eq(parameters.os, 'Android')) ) }}:
      - script: |
          ninja test
        displayName: 'Test'
        workingDirectory: $(Build.SourcesDirectory)/Meta/Lagom/Build
        env:
          SERENITY_SOURCE_DIR: '$(Build.SourcesDirectory)'
          CTEST_OUTPUT_ON_FAILURE: 1
          # FIXME: enable detect_stack_use_after_return=1 #7420
          ASAN_OPTIONS: 'strict_string_checks=1:check_initialization_order=1:strict_init_order=1'
          UBSAN_OPTIONS: 'print_stacktrace=1:print_summary=1:halt_on_error=1'

    - ${{ if eq(parameters.lagom_lints, true) }}:
      - script: |
          set -e
          ./Meta/check-markdown.sh
          ./Meta/lint-gml-format.sh
          git ls-files '*.ipc' | xargs ./Meta/Lagom/Build/Tools/IPCMagicLinter/IPCMagicLinter
        displayName: 'Run lints that require Lagom'
        workingDirectory: $(Build.SourcesDirectory)/
        env:
          MARKDOWN_CHECK_BINARY: ./Meta/Lagom/Build/markdown-check
          GML_FORMAT: ./Meta/Lagom/Build/gml-format
          # FIXME: enable detect_stack_use_after_return=1 #7420
          ASAN_OPTIONS: 'strict_string_checks=1:check_initialization_order=1:strict_init_order=1'
          UBSAN_OPTIONS: 'print_stacktrace=1:print_summary=1:halt_on_error=1'

    - script: |
        CCACHE_DIR='$(SERENITY_CCACHE_DIR)' ccache -s
      displayName: 'Cache Stats'