diff --git a/.github/actions/cache/action.yaml b/.github/actions/cache/action.yaml new file mode 100644 index 0000000000..0c57db9847 --- /dev/null +++ b/.github/actions/cache/action.yaml @@ -0,0 +1,49 @@ +name: 'Milvus Cache' +description: '' +inputs: + os: + description: 'OS name' + required: true + default: 'ubuntu20.04' + kind: + description: 'Cache kind' + required: false + default: 'all' +runs: + using: "composite" + steps: + - name: Generate CCache Hash + 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}" + shell: bash + - name: Cache CCache Volumes + if: ${{ inputs.kind == 'all' || inputs.kind == 'cpp' }} + uses: actions/cache@v3 + with: + path: .docker/amd64-${{ inputs.os }}-ccache + key: ${{ inputs.os }}-ccache-${{ env.corehash }} + restore-keys: ${{ inputs.os }}-ccache- + - name: Cache Conan Packages + if: ${{ inputs.kind == 'all' || inputs.kind == 'cpp' }} + uses: actions/cache@v3 + with: + path: .docker/amd64-${{ inputs.os }}-conan + key: ${{ inputs.os }}-conan-${{ hashFiles('internal/core/conanfile.*') }} + restore-keys: ${{ inputs.os }}-conan- + - name: Cache Third Party + if: ${{ inputs.kind == 'all' || inputs.kind == 'thirdparty' }} + uses: actions/cache@v3 + with: + path: .docker/thirdparty + key: ${{ inputs.os }}-thirdparty-${{ hashFiles('internal/core/thirdparty/**') }} + restore-keys: ${{ inputs.os }}-thirdparty- + - name: Cache Go Mod Volumes + if: ${{ inputs.kind == 'all' || inputs.kind == 'go' }} + uses: actions/cache@v3 + with: + path: .docker/amd64-${{ inputs.os }}-go-mod + key: ${{ inputs.os }}-go-mod-${{ hashFiles('go.sum, */go.sum') }} + restore-keys: ${{ inputs.os }}-go-mod- \ No newline at end of file diff --git a/.github/workflows/code-checker.yaml b/.github/workflows/code-checker.yaml index a5450c4b2d..2f06cd1cb0 100644 --- a/.github/workflows/code-checker.yaml +++ b/.github/workflows/code-checker.yaml @@ -50,37 +50,16 @@ jobs: remove-haskell: 'true' - name: Checkout uses: actions/checkout@v2 - - name: 'Generate CCache Hash' - 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}" - - name: Cache CCache Volumes - uses: actions/cache@v3 + - name: Download Caches + uses: ./.github/actions/cache with: - path: .docker/amd64-ubuntu20.04-ccache - key: ubuntu20.04-ccache-${{ env.corehash }} - restore-keys: ubuntu20.04-ccache- - - name: Cache Go Mod Volumes - uses: actions/cache@v3 - with: - path: .docker/amd64-ubuntu20.04-go-mod - key: ubuntu20.04-go-mod-${{ hashFiles('go.sum, */go.sum') }} - restore-keys: ubuntu20.04-go-mod- - - name: Cache Conan Packages - uses: actions/cache@v3 - with: - path: .docker/amd64-ubuntu20.04-conan - key: ubuntu20.04-conan-${{ hashFiles('internal/core/conanfile.*') }} - restore-keys: ubuntu20.04-conan- - # - name: Setup upterm session - # uses: lhotari/action-upterm@v1 + os: 'ubuntu20.04' - name: Code Check env: OS_NAME: 'ubuntu20.04' run: | ./build/builder.sh /bin/bash -c "make check-proto-product && make verifiers" + amazonlinux: name: Code Checker Amazonlinux 2023 # Run in amazonlinux docker @@ -98,36 +77,10 @@ jobs: remove-haskell: 'true' - name: Checkout uses: actions/checkout@v2 - - name: 'Generate CCache Hash' - 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}" - - name: Cache CCache Volumes - uses: actions/cache@v3 + - name: Download Caches + uses: ./.github/actions/cache with: - path: .docker/amd64-amazonlinux2023-ccache - key: amazonlinux2023-ccache-${{ env.corehash }} - restore-keys: amazonlinux2023-ccache- - - name: Cache Third Party - uses: actions/cache@v3 - with: - path: .docker/thirdparty - key: amazonlinux2023-thirdparty-${{ hashFiles('internal/core/thirdparty/**') }} - restore-keys: amazonlinux2023-thirdparty- - - name: Cache Go Mod Volumes - uses: actions/cache@v3 - with: - path: .docker/amd64-amazonlinux2023-go-mod - key: amazonlinux2023-go-mod-${{ hashFiles('go.sum, */go.sum') }} - restore-keys: amazonlinux2023-go-mod- - - name: Cache Conan Packages - uses: actions/cache@v3 - with: - path: .docker/amd64-amazonlinux2023-conan - key: amazonlinux2023-conan-${{ hashFiles('internal/core/conanfile.*') }} - restore-keys: amazonlinux2023-conan- + os: 'amazonlinux2023' - name: Code Check run: | sed -i 's/ubuntu20.04/amazonlinux2023/g' .env diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 1f1d576a05..d88d92760d 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -85,25 +85,11 @@ jobs: run: | echo "useasan=ON" >> $GITHUB_ENV echo "Setup USE_ASAN to true since cpp file(s) changed" - - name: 'Generate CCache Hash' - env: - CORE_HASH: ${{ hashFiles( 'internal/core/**/*.cpp', 'internal/core/**/*.cc', 'internal/core/**/*.c', 'internal/core/**/*.h', 'internal/core/**/*.hpp', 'internal/core/**/CMakeLists.txt', 'internal/core/conanfile.py') }} - run: | - echo "corehash=${CORE_HASH}" >> $GITHUB_ENV - echo "Set CCache hash to ${CORE_HASH}" - - name: Cache CCache Volumes - # uses: actions/cache@v3 - uses: actions/cache@v3 + - name: Download Caches + uses: ./.github/actions/cache with: - path: .docker/amd64-ubuntu${{ matrix.ubuntu }}-ccache - key: ubuntu${{ matrix.ubuntu }}-ccache-${{ env.corehash }} - restore-keys: ubuntu${{ matrix.ubuntu }}-ccache- - - name: Cache Conan Packages - uses: actions/cache@v3 - with: - path: .docker/amd64-ubuntu${{ matrix.ubuntu }}-conan - key: ubuntu${{ matrix.ubuntu }}-conan-${{ hashFiles('internal/core/conanfile.*') }} - restore-keys: ubuntu${{ matrix.ubuntu }}-conan- + os: 'ubuntu20.04' + kind: 'cpp' - name: Build run: | ./build/builder.sh /bin/bash -c "make USE_ASAN=${{env.useasan}} build-cpp-with-coverage" @@ -133,12 +119,11 @@ jobs: - run: | unzip code.zip rm code.zip - - name: Cache Conan Packages - uses: actions/cache@v3 + - name: Download Caches + uses: ./.github/actions/cache with: - path: .docker/amd64-ubuntu${{ matrix.ubuntu }}-conan - key: ubuntu${{ matrix.ubuntu }}-conan-${{ hashFiles('internal/core/conanfile.*') }} - restore-keys: ubuntu${{ matrix.ubuntu }}-conan- + os: 'ubuntu20.04' + kind: 'cpp' - name: Start Service shell: bash run: | @@ -177,12 +162,11 @@ jobs: - run: | unzip code.zip rm code.zip - - name: Cache Go Mod Volumes - uses: actions/cache@v3 + - name: Download Caches + uses: ./.github/actions/cache with: - path: .docker/amd64-ubuntu${{ matrix.ubuntu }}-go-mod - key: ubuntu${{ matrix.ubuntu }}-go-mod-${{ hashFiles('**/go.sum') }} - restore-keys: ubuntu${{ matrix.ubuntu }}-go-mod- + os: 'ubuntu20.04' + kind: 'go' - name: Start Service shell: bash run: | @@ -221,12 +205,11 @@ jobs: - run: | unzip code.zip rm code.zip - - name: Cache Go Mod Volumes - uses: actions/cache@v3 + - name: Download Caches + uses: ./.github/actions/cache with: - path: .docker/amd64-ubuntu${{ matrix.ubuntu }}-go-mod - key: ubuntu${{ matrix.ubuntu }}-go-mod-${{ hashFiles('**/go.sum') }} - restore-keys: ubuntu${{ matrix.ubuntu }}-go-mod- + os: 'ubuntu20.04' + kind: 'go' - name: Start Service shell: bash run: |