2020-10-19 02:36:40 +00:00
|
|
|
name: Build and test
|
|
|
|
|
|
|
|
# This workflow is triggered on pushes or pull request to the repository.
|
|
|
|
on:
|
2021-07-20 07:34:14 +00:00
|
|
|
push:
|
|
|
|
# file paths to consider in the event. Optional; defaults to all.
|
|
|
|
paths:
|
|
|
|
- 'scripts/**'
|
|
|
|
- 'internal/**'
|
2023-04-11 02:32:31 +00:00
|
|
|
- 'pkg/**'
|
2021-07-20 07:34:14 +00:00
|
|
|
- 'cmd/**'
|
|
|
|
- 'build/**'
|
2023-05-23 13:09:28 +00:00
|
|
|
- 'tests/integration/**' # run integration test
|
2021-07-20 07:34:14 +00:00
|
|
|
- '.github/workflows/main.yaml'
|
|
|
|
- '.env'
|
|
|
|
- docker-compose.yml
|
|
|
|
- Makefile
|
2021-09-01 07:59:11 +00:00
|
|
|
- go.mod
|
2021-07-20 07:34:14 +00:00
|
|
|
- '!**.md'
|
|
|
|
- '!build/ci/jenkins/**'
|
2020-10-19 02:36:40 +00:00
|
|
|
pull_request:
|
|
|
|
# file paths to consider in the event. Optional; defaults to all.
|
|
|
|
paths:
|
2020-10-24 03:36:42 +00:00
|
|
|
- 'scripts/**'
|
2020-10-19 02:36:40 +00:00
|
|
|
- 'internal/**'
|
2023-04-11 02:32:31 +00:00
|
|
|
- 'pkg/**'
|
2020-10-19 02:36:40 +00:00
|
|
|
- 'cmd/**'
|
2020-11-16 13:11:52 +00:00
|
|
|
- 'build/**'
|
2023-05-23 13:09:28 +00:00
|
|
|
- 'tests/integration/**' # run integration test
|
2020-10-27 07:51:16 +00:00
|
|
|
- '.github/workflows/main.yaml'
|
2020-11-14 08:01:12 +00:00
|
|
|
- '.env'
|
2020-10-19 02:36:40 +00:00
|
|
|
- docker-compose.yml
|
2020-11-03 03:25:47 +00:00
|
|
|
- Makefile
|
2021-09-01 07:59:11 +00:00
|
|
|
- go.mod
|
2020-10-19 02:36:40 +00:00
|
|
|
- '!**.md'
|
2021-05-14 10:23:30 +00:00
|
|
|
- '!build/ci/jenkins/**'
|
2020-10-19 02:36:40 +00:00
|
|
|
|
2023-12-14 03:30:38 +00:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
2024-01-09 10:28:48 +00:00
|
|
|
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
2023-12-14 03:30:38 +00:00
|
|
|
|
2020-10-19 02:36:40 +00:00
|
|
|
jobs:
|
2023-04-06 07:56:28 +00:00
|
|
|
Build:
|
2024-01-11 10:20:52 +00:00
|
|
|
name: Build and test AMD64 Ubuntu 20.04
|
2023-12-28 07:48:48 +00:00
|
|
|
runs-on: ubuntu-latest
|
2023-02-16 09:26:35 +00:00
|
|
|
timeout-minutes: 180
|
2020-10-19 02:36:40 +00:00
|
|
|
steps:
|
2023-11-15 07:08:18 +00:00
|
|
|
- name: Setup mold
|
|
|
|
uses: rui314/setup-mold@v1
|
2023-11-01 01:00:14 +00:00
|
|
|
- name: Maximize build space
|
|
|
|
uses: easimon/maximize-build-space@master
|
2023-12-14 09:44:39 +00:00
|
|
|
if: ${{ ! startsWith(runner.name, 'self') }} # skip this step if it is self-hosted runner
|
2023-11-01 01:00:14 +00:00
|
|
|
with:
|
2023-12-08 08:14:07 +00:00
|
|
|
root-reserve-mb: 20480
|
2023-11-01 01:00:14 +00:00
|
|
|
swap-size-mb: 1024
|
|
|
|
remove-dotnet: 'true'
|
|
|
|
remove-android: 'true'
|
|
|
|
remove-haskell: 'true'
|
2020-10-19 02:36:40 +00:00
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
2023-01-19 05:43:44 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
- name: 'Check Changed files'
|
|
|
|
id: changed-files-cpp
|
2023-12-27 03:58:47 +00:00
|
|
|
uses: tj-actions/changed-files@v41
|
2023-01-19 05:43:44 +00:00
|
|
|
with:
|
|
|
|
since_last_remote_commit: 'true'
|
|
|
|
files: |
|
|
|
|
**/*.cpp
|
|
|
|
**/*.cc
|
|
|
|
**/*.c
|
|
|
|
**/*.h
|
|
|
|
**/*.hpp
|
|
|
|
**/*.CMakeLists.txt
|
2023-02-16 09:26:35 +00:00
|
|
|
**/conanfile.*
|
2023-01-19 05:43:44 +00:00
|
|
|
- name: 'Setup Use USE_ASAN'
|
|
|
|
if: steps.changed-files-cpp.outputs.any_changed == 'true'
|
|
|
|
run: |
|
2023-10-11 12:45:35 +00:00
|
|
|
echo "useasan=ON" >> $GITHUB_ENV
|
2023-02-16 09:26:35 +00:00
|
|
|
echo "Setup USE_ASAN to true since cpp file(s) changed"
|
2023-12-27 03:56:57 +00:00
|
|
|
- name: Download Caches
|
|
|
|
uses: ./.github/actions/cache
|
2020-12-09 12:07:27 +00:00
|
|
|
with:
|
2023-12-27 03:56:57 +00:00
|
|
|
os: 'ubuntu20.04'
|
|
|
|
kind: 'cpp'
|
2023-04-06 07:56:28 +00:00
|
|
|
- name: Build
|
|
|
|
run: |
|
2023-04-21 06:16:33 +00:00
|
|
|
./build/builder.sh /bin/bash -c "make USE_ASAN=${{env.useasan}} build-cpp-with-coverage"
|
2024-02-01 02:15:04 +00:00
|
|
|
- run: |
|
|
|
|
zip -r code.zip . -x "./.docker/*" -x "./cmake_build/thirdparty/**" -x ".git/**"
|
|
|
|
- name: Archive code
|
|
|
|
uses: actions/upload-artifact@v3
|
2023-04-06 07:56:28 +00:00
|
|
|
with:
|
|
|
|
name: code
|
2024-02-01 02:15:04 +00:00
|
|
|
path: code.zip
|
2023-04-06 07:56:28 +00:00
|
|
|
UT-Cpp:
|
|
|
|
name: UT for Cpp
|
|
|
|
needs: Build
|
2023-12-28 07:48:48 +00:00
|
|
|
runs-on: ubuntu-latest
|
2023-04-10 00:24:30 +00:00
|
|
|
timeout-minutes: 60
|
2023-04-06 07:56:28 +00:00
|
|
|
steps:
|
2024-02-01 02:15:04 +00:00
|
|
|
- name: Download code
|
|
|
|
uses: actions/download-artifact@v3.0.1
|
2023-04-06 07:56:28 +00:00
|
|
|
with:
|
|
|
|
name: code
|
2024-02-01 02:15:04 +00:00
|
|
|
- run: |
|
|
|
|
unzip code.zip
|
|
|
|
rm code.zip
|
2023-12-27 03:56:57 +00:00
|
|
|
- name: Download Caches
|
|
|
|
uses: ./.github/actions/cache
|
2022-11-23 02:39:11 +00:00
|
|
|
with:
|
2023-12-27 03:56:57 +00:00
|
|
|
os: 'ubuntu20.04'
|
|
|
|
kind: 'cpp'
|
2023-09-19 02:01:23 +00:00
|
|
|
- name: Start Service
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
docker-compose up -d azurite
|
2023-04-06 07:56:28 +00:00
|
|
|
- name: UT
|
|
|
|
run: |
|
|
|
|
chmod +x build/builder.sh
|
|
|
|
chmod +x scripts/*
|
|
|
|
chmod +x internal/core/output/unittest/*
|
|
|
|
./build/builder.sh /bin/bash -c ./scripts/run_cpp_codecov.sh
|
|
|
|
- name: Archive result
|
2023-12-28 01:46:45 +00:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-04-06 07:56:28 +00:00
|
|
|
with:
|
|
|
|
name: cpp-result
|
|
|
|
path: |
|
|
|
|
./go_coverage.txt
|
|
|
|
./lcov_output.info
|
|
|
|
*.info
|
|
|
|
*.out
|
|
|
|
UT-Go:
|
|
|
|
name: UT for Go
|
|
|
|
needs: Build
|
2023-12-28 07:48:48 +00:00
|
|
|
runs-on: ubuntu-latest
|
2023-04-10 00:24:30 +00:00
|
|
|
timeout-minutes: 60
|
2023-04-06 07:56:28 +00:00
|
|
|
steps:
|
2024-02-01 02:15:04 +00:00
|
|
|
- name: Download code
|
|
|
|
uses: actions/download-artifact@v3.0.1
|
2023-04-06 07:56:28 +00:00
|
|
|
with:
|
|
|
|
name: code
|
2024-02-01 02:15:04 +00:00
|
|
|
- run: |
|
|
|
|
unzip code.zip
|
|
|
|
rm code.zip
|
2023-12-27 03:56:57 +00:00
|
|
|
- name: Download Caches
|
|
|
|
uses: ./.github/actions/cache
|
2023-04-06 07:56:28 +00:00
|
|
|
with:
|
2023-12-27 03:56:57 +00:00
|
|
|
os: 'ubuntu20.04'
|
|
|
|
kind: 'go'
|
2020-11-09 10:47:37 +00:00
|
|
|
- name: Start Service
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2023-09-19 02:01:23 +00:00
|
|
|
docker-compose up -d pulsar etcd minio azurite
|
2023-04-06 07:56:28 +00:00
|
|
|
- name: UT
|
2020-10-19 02:36:40 +00:00
|
|
|
run: |
|
2023-04-06 07:56:28 +00:00
|
|
|
chmod +x build/builder.sh
|
|
|
|
chmod +x scripts/run_go_codecov.sh
|
|
|
|
./build/builder.sh /bin/bash -c ./scripts/run_go_codecov.sh
|
|
|
|
- name: Archive result
|
2023-12-28 01:46:45 +00:00
|
|
|
uses: actions/upload-artifact@v4
|
2022-11-08 11:59:03 +00:00
|
|
|
with:
|
2023-04-06 07:56:28 +00:00
|
|
|
name: go-result
|
2022-11-08 11:59:03 +00:00
|
|
|
path: |
|
|
|
|
./go_coverage.txt
|
|
|
|
./lcov_output.info
|
|
|
|
*.info
|
|
|
|
*.out
|
2023-05-09 11:18:41 +00:00
|
|
|
integration-test:
|
|
|
|
name: Integration Test
|
|
|
|
needs: Build
|
2023-12-28 07:48:48 +00:00
|
|
|
runs-on: ubuntu-latest
|
2023-05-09 11:18:41 +00:00
|
|
|
timeout-minutes: 60
|
|
|
|
steps:
|
2024-02-01 02:15:04 +00:00
|
|
|
- name: Download code
|
|
|
|
uses: actions/download-artifact@v3.0.1
|
2023-05-09 11:18:41 +00:00
|
|
|
with:
|
|
|
|
name: code
|
2024-02-01 02:15:04 +00:00
|
|
|
- run: |
|
|
|
|
unzip code.zip
|
|
|
|
rm code.zip
|
2023-12-27 03:56:57 +00:00
|
|
|
- name: Download Caches
|
|
|
|
uses: ./.github/actions/cache
|
2023-05-09 11:18:41 +00:00
|
|
|
with:
|
2023-12-27 03:56:57 +00:00
|
|
|
os: 'ubuntu20.04'
|
|
|
|
kind: 'go'
|
2023-05-09 11:18:41 +00:00
|
|
|
- name: Start Service
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
docker-compose up -d pulsar etcd minio
|
|
|
|
- name: IntegrationTest
|
|
|
|
run: |
|
|
|
|
chmod +x build/builder.sh
|
|
|
|
chmod +x scripts/run_intergration_test.sh
|
|
|
|
./build/builder.sh /bin/bash -c ./scripts/run_intergration_test.sh
|
2023-05-26 05:45:26 +00:00
|
|
|
- name: Archive result
|
2023-12-28 01:46:45 +00:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-05-26 05:45:26 +00:00
|
|
|
with:
|
|
|
|
name: it-result
|
|
|
|
path: |
|
|
|
|
./it_coverage.txt
|
|
|
|
*.info
|
|
|
|
*.out
|
2022-11-08 11:59:03 +00:00
|
|
|
codecov:
|
|
|
|
name: Upload Code Coverage
|
2023-05-26 05:45:26 +00:00
|
|
|
needs: [UT-Cpp, UT-Go, integration-test]
|
2022-11-08 11:59:03 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
timeout-minutes: 5
|
|
|
|
steps:
|
2024-01-16 05:56:53 +00:00
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2023-04-06 07:56:28 +00:00
|
|
|
- name: Download Cpp code coverage results
|
2023-12-28 01:46:45 +00:00
|
|
|
uses: actions/download-artifact@v4.1.0
|
2023-04-06 07:56:28 +00:00
|
|
|
with:
|
|
|
|
name: cpp-result
|
|
|
|
- name: Download Go code coverage results
|
2023-12-28 01:46:45 +00:00
|
|
|
uses: actions/download-artifact@v4.1.0
|
2022-11-08 11:59:03 +00:00
|
|
|
with:
|
2023-04-06 07:56:28 +00:00
|
|
|
name: go-result
|
2023-05-26 05:45:26 +00:00
|
|
|
- name: Download Integration Test coverage results
|
2023-12-28 01:46:45 +00:00
|
|
|
uses: actions/download-artifact@v4.1.0
|
2023-05-26 05:45:26 +00:00
|
|
|
with:
|
|
|
|
name: it-result
|
2022-11-08 11:59:03 +00:00
|
|
|
- name: Display structure of code coverage results
|
2022-11-23 01:53:21 +00:00
|
|
|
run: |
|
|
|
|
ls -lah
|
2021-07-16 06:52:21 +00:00
|
|
|
- name: Upload coverage to Codecov
|
2021-11-23 22:49:15 +00:00
|
|
|
if: "github.repository == 'milvus-io/milvus'"
|
2022-09-27 03:36:55 +00:00
|
|
|
uses: codecov/codecov-action@v3.1.1
|
2022-06-16 01:52:10 +00:00
|
|
|
id: upload_cov
|
2021-07-16 06:52:21 +00:00
|
|
|
with:
|
|
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
2023-05-26 05:45:26 +00:00
|
|
|
files: ./go_coverage.txt,./lcov_output.info,./it_coverage.txt
|
2022-11-08 11:59:03 +00:00
|
|
|
name: ubuntu-20.04-unittests
|
2022-09-06 04:39:11 +00:00
|
|
|
fail_ci_if_error: true
|
2022-11-23 02:39:11 +00:00
|
|
|
- name: Retry Upload coverage to Codecov
|
|
|
|
if: "${{ failure() }} && github.repository == 'milvus-io/milvus'"
|
|
|
|
uses: codecov/codecov-action@v3.1.1
|
|
|
|
id: retry_upload_cov
|
|
|
|
with:
|
|
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
2023-05-26 05:45:26 +00:00
|
|
|
files: ./go_coverage.txt,./lcov_output.info,./it_coverage.txt
|
2024-01-11 10:20:52 +00:00
|
|
|
name: ubuntu-20.04-unittests
|
2022-11-23 02:39:11 +00:00
|
|
|
fail_ci_if_error: true
|