Explorar o código

CI: Use Azure caching for Lagom build

Adds a compiler cache and a cache for the UCD files.
Timothy Flynn %!s(int64=4) %!d(string=hai) anos
pai
achega
5eba8c948d
Modificáronse 3 ficheiros con 40 adicións e 2 borrados
  1. 24 0
      Meta/Azure/Caches.yml
  2. 14 0
      Meta/Azure/Lagom.yml
  3. 2 2
      Meta/Azure/Setup.yml

+ 24 - 0
Meta/Azure/Caches.yml

@@ -0,0 +1,24 @@
+parameters:
+  os: 'Linux'
+  arch: 'i686'
+  toolchain: 'gcc'
+  build_directory: ''
+  ccache_version: 1 # Increment this number if CI has trouble with ccache.
+
+steps:
+  - task: Cache@2
+    inputs:
+      key: '"ccache" | "${{ parameters.os }}" | "${{ parameters.arch }}" | "${{ parameters.toolchain }}" | "${{ parameters.ccache_version }}"'
+      path: $(CCACHE_DIR)
+    displayName: 'Compiler Cache'
+
+  - task: Cache@2
+    inputs:
+      key: '"unicode_data" | Userland/Libraries/LibUnicode/unicode_data.cmake'
+      path: $(Build.SourcesDirectory)/${{ parameters.build_directory }}/UCD
+    displayName: 'UnicodeData Cache'
+
+  - script: |
+      ccache -M 5G
+      ccache -s
+    displayName: 'Configure ccache'

+ 14 - 0
Meta/Azure/Lagom.yml

@@ -6,6 +6,8 @@ jobs:
   - job: 'Lagom_${{ parameters.os }}'
   - job: 'Lagom_${{ parameters.os }}'
 
 
     variables:
     variables:
+    - name: CCACHE_DIR
+      value: $(Build.SourcesDirectory)/.ccache
     - ${{ if eq(parameters.os, 'Linux') }}:
     - ${{ if eq(parameters.os, 'Linux') }}:
       - name: job_pool
       - name: job_pool
         value: ubuntu-20.04
         value: ubuntu-20.04
@@ -21,6 +23,13 @@ jobs:
       parameters:
       parameters:
         os: '${{ parameters.os }}'
         os: '${{ parameters.os }}'
 
 
+    - template: Caches.yml
+      parameters:
+        os: '${{ parameters.os }}'
+        arch: 'Lagom'
+        toolchain: 'gcc'
+        build_directory: 'Meta/Lagom/Build'
+
     - script: |
     - script: |
         mkdir -p Meta/Lagom/Build
         mkdir -p Meta/Lagom/Build
       displayName: 'Create Build Directory'
       displayName: 'Create Build Directory'
@@ -28,6 +37,7 @@ jobs:
     - script: |
     - script: |
         cmake -GNinja \
         cmake -GNinja \
           -DBUILD_LAGOM=ON \
           -DBUILD_LAGOM=ON \
+          -DENABLE_LAGOM_CCACHE=ON \
           -DINCLUDE_WASM_SPEC_TESTS=ON \
           -DINCLUDE_WASM_SPEC_TESTS=ON \
           -DWASM_SPEC_TEST_SKIP_FORMATTING=ON \
           -DWASM_SPEC_TEST_SKIP_FORMATTING=ON \
           -DENABLE_UNDEFINED_SANITIZER=ON \
           -DENABLE_UNDEFINED_SANITIZER=ON \
@@ -57,3 +67,7 @@ jobs:
         # FIXME: enable detect_stack_use_after_return=1 #7420
         # FIXME: enable detect_stack_use_after_return=1 #7420
         ASAN_OPTIONS: 'strict_string_checks=1:check_initialization_order=1:strict_init_order=1'
         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'
         UBSAN_OPTIONS: 'print_stacktrace=1:print_summary=1:halt_on_error=1'
+
+    - script: |
+        ccache -s
+      displayName: 'Cache Stats'

+ 2 - 2
Meta/Azure/Setup.yml

@@ -9,7 +9,7 @@ steps:
     - script: |
     - script: |
         sudo apt-get purge -y clang-11
         sudo apt-get purge -y clang-11
         sudo apt-get update
         sudo apt-get update
-        sudo apt-get install ninja-build
+        sudo apt-get install ninja-build ccache
 
 
         sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-12 100
         sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-12 100
         sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-12 100
         sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-12 100
@@ -21,5 +21,5 @@ steps:
 
 
   - ${{ if eq(parameters.os, 'macOS') }}:
   - ${{ if eq(parameters.os, 'macOS') }}:
     - script: |
     - script: |
-        brew install ninja wabt
+        brew install ninja wabt ccache
       displayName: 'Install Dependencies'
       displayName: 'Install Dependencies'