feat(components): add the milvus 2.x indexer and retriever implementation #625
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: EinoExt CI | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
unit-test: | |
runs-on: ubuntu-latest | |
env: | |
COVERAGE_FILE: coverage.out | |
BREAKDOWN_FILE: base.coverage | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: "1.22" | |
# - name: Go test for every module | |
# run: | | |
# modules=`find . -name "go.mod" -exec dirname {} \;` | |
# echo "all the modules in eino-ext: " | |
# echo "${modules}" | |
# coverprofiles="" | |
# for module in $modules; do | |
# echo "--------------------------------------------------" | |
# echo "run unit test for ${module}" | |
# cd ${module} | |
# go test -race -coverprofile=./${COVERAGE_FILE} -gcflags="all=-l -N" -coverpkg=./... ./... | |
# cd - | |
# coverprofiles="${module}/${COVERAGE_FILE},$coverprofiles" | |
# done | |
# # Remove trailing comma from coverprofiles | |
# coverprofiles=${coverprofiles%,} | |
# echo "COVERAGE_PROFILES=$coverprofiles" >> $GITHUB_ENV | |
- name: Go test in go workspace | |
run: | | |
modules=`find . -name "go.mod" -exec dirname {} \;` | |
echo "all the modules in eino-ext: " | |
echo "${modules}" | |
if [[ ! -f "go.work" ]];then go work init;fi | |
list="" | |
coverpkg="" | |
for module in $modules; do | |
go work use ${module} | |
list="${module}/... ${list}" | |
coverpkg="${module}/...,${coverpkg}" | |
done | |
# trim the last comma | |
coverpkg=${coverpkg%,} | |
go work sync | |
coverprofiles=${COVERAGE_FILE} | |
go test -race -coverprofile=coverage.out -gcflags="all=-l -N" -coverpkg=$coverpkg $list | |
echo "COVERAGE_PROFILES=$coverprofiles" >> $GITHUB_ENV | |
- name: Download base.coverage for diff coverage rate | |
id: download-base-coverage | |
uses: actions/download-artifact@v4 | |
continue-on-error: true | |
with: | |
name: ${{ env.BREAKDOWN_FILE }} | |
- name: Calculate coverage | |
id: calculate-coverage | |
uses: vladopajic/go-test-coverage@v2 | |
with: | |
profile: ${{env.COVERAGE_PROFILES}} | |
config: ./.testcoverage.yml | |
breakdown-file-name: ${{ github.ref_name == 'main' && env.BREAKDOWN_FILE || '' }} | |
diff-base-breakdown-file-name: ${{ steps.download-base-coverage.download-path != '' && env.BREAKDOWN_FILE || '' }} | |
- name: Upload base.coverage of main branch | |
uses: actions/upload-artifact@v4 | |
if: github.ref_name == 'main' | |
with: | |
name: ${{env.BREAKDOWN_FILE}} | |
path: ${{env.BREAKDOWN_FILE}} | |
if-no-files-found: error | |
- name: Find coverage report | |
if: ${{ always() && github.event.pull_request.number != null }} | |
uses: peter-evans/find-comment@v3 | |
continue-on-error: true | |
id: find-comment | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
comment-author: 'github-actions[bot]' | |
body-includes: 'go-test-coverage report:' | |
- name: Post coverage report | |
if: ${{ always() && github.event.pull_request.number != null }} | |
uses: peter-evans/create-or-update-comment@v4 | |
continue-on-error: true | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
comment-id: ${{ steps.find-comment.outputs.comment-id || '' }} | |
edit-mode: replace | |
body: | | |
go-test-coverage report: | |
``` | |
${{ steps.calculate-coverage.outputs.report && fromJSON(steps.calculate-coverage.outputs.report) || 'No coverage report available' }} ``` | |
reactions: heart | |
reactions-edit-mode: append | |
unit-benchmark-test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: stable | |
- name: Go BenchMark | |
run: | | |
modules=`find . -name "go.mod" -exec dirname {} \;` | |
echo $modules | |
list="" | |
coverpkg="" | |
if [[ ! -f "go.work" ]];then go work init;fi | |
for module in $modules; do go work use $module; list=$module"/... "$list; coverpkg=$module"/...,"$coverpkg; done | |
go work sync | |
go test -bench=. -run=none -gcflags="all=-N -l" $list |