run_test_case.yaml 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. name: Run test cases
  2. concurrency:
  3. group: test-${{ github.event_name }}-${{ github.ref }}
  4. cancel-in-progress: true
  5. on:
  6. push:
  7. tags:
  8. - "*"
  9. branches:
  10. - master
  11. pull_request:
  12. paths-ignore:
  13. - "docs/**"
  14. release:
  15. types:
  16. - published
  17. jobs:
  18. run_unit_tests:
  19. runs-on: ubuntu-latest
  20. steps:
  21. - uses: actions/checkout@v3
  22. - uses: actions/setup-go@v4
  23. with:
  24. go-version: '1.20'
  25. - uses: actions/setup-python@v4
  26. with:
  27. python-version: '3.x'
  28. - name: Install dependencies
  29. env:
  30. DEBIAN_FRONTEND: noninteractive
  31. run: |
  32. pip3 install pynng && sudo apt-get update && sudo apt-get install libzmq3-dev -y
  33. - name: Build plugins
  34. run: |
  35. curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash -s -- -v 0.12.1 > /dev/null
  36. curl -sSfL -O https://github.com/second-state/wasmedge_rustls_plugin/releases/download/0.1.0/wasmedge_rustls_plugin_ubuntu-22.04.zip
  37. unzip wasmedge_rustls_plugin_ubuntu-22.04.zip
  38. mv target/release/libwasmedge_rustls.so ~/.wasmedge/plugin/
  39. mkdir -p plugins/wasm
  40. set -e -u -x
  41. mkdir -p data
  42. mkdir -p log
  43. mkdir -p plugins/sinks
  44. sed -i -r "s/debug: .*/debug: true/1" etc/kuiper.yaml
  45. go build --buildmode=plugin -o plugins/sources/Random@v2.0.0.so extensions/sources/random/random.go
  46. cp extensions/sources/random/random.yaml etc/sources/random.yaml
  47. go build --buildmode=plugin -o plugins/functions/Echo.so extensions/functions/echo/echo.go
  48. go build --buildmode=plugin -o plugins/functions/CountPlusOne@v1.0.0.so extensions/functions/countPlusOne/countPlusOne.go
  49. go build --buildmode=plugin -o plugins/functions/AccumulateWordCount@v1.0.0.so extensions/functions/accumulateWordCount/accumulateWordCount.go
  50. go build --buildmode=plugin -o data/test/helloworld.so internal/converter/protobuf/test/*.go
  51. go build --buildmode=plugin -o data/myFormat.so internal/converter/custom/test/*.go
  52. cp data/myFormat.so data/test/myFormat.so
  53. mkdir -p plugins/portable/mirror
  54. cd sdk/go/example/mirror
  55. go build -o ../../../../plugins/portable/mirror/mirror .
  56. cp mirror.json ../../../../plugins/portable/mirror
  57. cd ../../../../
  58. cp -r sdk/python/example/pysam plugins/portable/pysam
  59. cp -r sdk/python/ekuiper plugins/portable/pysam/
  60. - name: Run topotest case
  61. run: |
  62. go test --tags="edgex msgpack script test" --cover -covermode=atomic -coverpkg=github.com/lf-edge/ekuiper/internal/topo -coverprofile=topotest-plugin.xml github.com/lf-edge/ekuiper/internal/topo/topotest/plugin
  63. - name: Run test case
  64. run: |
  65. source $HOME/.wasmedge/env
  66. go test --tags="edgex msgpack script test" --cover -covermode=atomic -coverpkg=./... -coverprofile=coverage.xml $(go list ./... | grep -v "github.com/lf-edge/ekuiper/internal/topo/topotest/plugin")
  67. - name: Upload coverage to Codecov
  68. uses: codecov/codecov-action@v3
  69. with:
  70. files: coverage.xml,topotest-plugin.xml
  71. token: ${{ secrets.CODECOV_TOKEN }}
  72. fail_ci_if_error: false
  73. verbose: true
  74. - name: Run plugins test case
  75. run: |
  76. mkdir -p data/test/uploads
  77. cp extensions/functions/dependencies/tensorflow/models/* data/test/uploads/
  78. export CGO_CFLAGS=-I$(pwd)/extensions/functions/dependencies/tensorflow
  79. export CGO_LDFLAGS=-L$(pwd)/extensions/functions/dependencies/tensorflow/amd64
  80. export LD_LIBRARY_PATH=$(pwd)/extensions/functions/dependencies/tensorflow/amd64:$LD_LIBRARY_PATH
  81. cd extensions
  82. go test ./functions/...
  83. - uses: actions/upload-artifact@v3
  84. if: failure()
  85. with:
  86. name: stream.log
  87. path: log/stream.log
  88. run_fvt_tests:
  89. needs:
  90. - run_unit_tests
  91. uses: ./.github/workflows/run_fvt_tests.yaml