mac.yaml 3.1 KB
Newer Older
1
name: Mac Code Checker
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

# This workflow is triggered on pushes or pull request to the repository.
on:
  push:
    branches:
      - master
  pull_request:
    # file paths to consider in the event. Optional; defaults to all.
    paths:
      - 'scripts/**'
      - 'internal/**'
      - 'cmd/**'
      - 'build/**'
      - '.github/workflows/mac.yaml'
      - '.env'
      - docker-compose.yml
      - Makefile
      - '!**.md'
      - '!build/ci/jenkins/**'
      # FIXME(wxyu): not need to run code check, update the ci-passed rules and remove these two lines
      - go.mod
      - go.sum

jobs:
  mac:
    name: Code Checker MacOS 12
    runs-on: macos-12
E
Enwei Jiao 已提交
29
    timeout-minutes: 180
30 31 32
    steps:
      - name: Checkout
        uses: actions/checkout@v2
33
      - name: 'Generate CCache Hash'
34 35 36 37 38
        env:
          CORE_HASH: ${{ hashFiles( 'internal/core/**/*.cpp', 'internal/core/**/*.cc', 'internal/core/**/*.c', 'internal/core/**/*.h', 'internal/core/**/*.hpp', 'internal/core/**/CMakeLists.txt') }}
        run: |
          echo "corehash=${CORE_HASH}" >> $GITHUB_ENV
          echo "Set CCache hash to ${CORE_HASH}"
39
      - name: Mac Cache Third Party
E
Enwei Jiao 已提交
40 41
        # uses: actions/cache@v3
        uses: pat-s/always-upload-cache@v3
42 43
        with:
          path: |
44
            /tmp/thirdparty
45 46
          key: macos-thirdparty-${{ hashFiles('internal/core/thirdparty/**') }}
          restore-keys: macos-thirdparty-
47
      - name: Mac Cache Cmake Build
48 49 50 51 52 53
        uses: actions/cache@v3
        with:
          path: |
            cmake_build/3rdparty_download/download
          key: macos-cmake-build-${{ env.corehash }}
          restore-keys: macos-cmake-build-
54 55 56 57
      - name: Mac Cache CCache Volumes
        uses: actions/cache@v3
        with:
          path: /var/tmp/ccache
58
          key: macos-ccache-${{ env.corehash }}
59 60 61 62 63 64 65 66 67 68 69
          restore-keys: macos-ccache-
      - name: Setup Go environment
        uses: actions/setup-go@v2.2.0
        with:
          go-version: '~1.18.1'
      - name: Mac Cache Go Mod Volumes
        uses: actions/cache@v3
        with:
          path: ~/go/pkg/mod
          key: macos-go-mod-${{ hashFiles('**/go.sum') }}
          restore-keys: macos-go-mod-
70 71 72 73
      - name: Mac Cache Conan Packages
        uses: pat-s/always-upload-cache@v3
        with:
          path: ~/.conan
74
          key: macos-conan-${{ hashFiles('internal/core/conanfile.*') }}
75
          restore-keys: macos-conan-
76 77 78 79 80 81 82
      - name: Code Check
        env:
          CCACHE_DIR: /var/tmp/ccache
          CCACHE_COMPILERCHECK: content
          CCACHE_COMPRESS: 1
          CCACHE_COMPRESSLEVEL: 5
          CCACHE_MAXSIZE: 2G
E
Enwei Jiao 已提交
83
          CUSTOM_THIRDPARTY_PATH: /tmp/thirdparty
84 85 86 87
        run: |
          if [[ ! -d "/var/tmp/ccache" ]];then
            mkdir -p /var/tmp/ccache
          fi
88
          brew install libomp ninja openblas ccache conan pkg-config
89
          if [[ ! -d "/usr/local/opt/llvm" ]]; then
E
Enwei Jiao 已提交
90
            ln -s /usr/local/opt/llvm@14 /usr/local/opt/llvm
91
          fi
92
          make milvus
J
Jenny Li 已提交
93 94 95 96 97
      - name: Upload Cmake log
        uses: actions/upload-artifact@v3
        if: ${{ failure() }}
        with:
          name: cmake-log
98
          path: cmake_build/CMakeFiles/*.log