Comment on the pull request #518
This file contains hidden or 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: Comment on the pull request | |
| # read-write repo token | |
| # access to secrets | |
| on: | |
| workflow_run: | |
| workflows: ["Receive PR"] | |
| types: | |
| - completed | |
| env: | |
| GOU_TEST_AES_KEY: "^*aNBue!loLTTiP*4i&BSK7s#QRbe0^g" | |
| GOU_TEST_REDIS_HOST: "127.0.0.1" | |
| GOU_TEST_REDIS_PORT: "6379" | |
| GOU_TEST_GITHUB_TOKEN: ${{ secrets.GOU_TEST_GITHUB_TOKEN }} | |
| GOU_TEST_GITHUB_REPO: github.com/YaoApp/workshop-tests-private | |
| GOU_TEST_DSL_TABLE_NAME: test_env | |
| GOU_TEST_APPLICATION: ${{ github.WORKSPACE }}/gou-dev-app | |
| GOU_TEST_PLUGIN: ${{ github.WORKSPACE }}/gou-dev-app/plugins/linux | |
| SEND_MAIL_WORKER_NUMS: 2 | |
| SEND_MAIL_TEST_MAIL: max@iqka.com | |
| REPO_APP: YaoApp/gou-dev-app | |
| MYSQL_TEST_HOST: "127.0.0.1" | |
| MYSQL_TEST_PORT: "3308" | |
| MYSQL_TEST_USER: test | |
| MYSQL_TEST_PASS: "123456" | |
| SQLITE_DB: "./app/db/yao.db" | |
| REDIS_TEST_HOST: "127.0.0.1" | |
| REDIS_TEST_PORT: "6379" | |
| REDIS_TEST_DB: "2" | |
| MONGO_TEST_HOST: "127.0.0.1" | |
| MONGO_TEST_PORT: "27017" | |
| MONGO_TEST_USER: "root" | |
| MONGO_TEST_PASS: "123456" | |
| OPENAI_TEST_KEY: ${{ secrets.OPENAI_TEST_KEY }} | |
| ANTHROPIC_TEST_KEY: "sk-ant-test-placeholder" | |
| RAG_LLM_TEST_URL: ${{ secrets.RAG_LLM_TEST_URL }} | |
| RAG_LLM_TEST_KEY: ${{ secrets.RAG_LLM_TEST_KEY }} | |
| RAG_LLM_TEST_SMODEL: ${{ secrets.RAG_LLM_TEST_SMODEL }} | |
| QDRANT_TEST_HOST: "127.0.0.1" | |
| QDRANT_TEST_PORT: "6334" | |
| QDRANT_TEST_HTTP_PORT: "6333" | |
| FASTEMBED_TEST_HOST: "127.0.0.1:6001" | |
| FASTEMBED_TEST_KEY: "Yao@2026" | |
| FASTEMBED_TEST_MODEL: "BAAI/bge-small-en-v1.5" | |
| NEO4J_TEST_URL: "neo4j://127.0.0.1:7687" | |
| NEO4J_TEST_USER: "neo4j" | |
| NEO4J_TEST_PASS: "Yao2026Neo4j" | |
| MCP_CLIENT_TEST_HTTP_URL: "http://127.0.0.1:3022/mcp" | |
| MCP_CLIENT_TEST_HTTP_AUTHORIZATION_TOKEN: "Bearer 123456" | |
| MCP_CLIENT_TEST_SSE_URL: "http://127.0.0.1:3021/sse" | |
| MCP_CLIENT_TEST_SSE_AUTHORIZATION_TOKEN: "Bearer 123456" | |
| jobs: | |
| unit-test: | |
| runs-on: ubuntu-latest | |
| services: | |
| qdrant: | |
| image: qdrant/qdrant:latest | |
| ports: | |
| - 6333:6333 # HTTP API | |
| - 6334:6334 # gRPC | |
| fastembed: | |
| image: yaoapp/fastembed:latest-amd64 | |
| env: | |
| FASTEMBED_PASSWORD: Yao@2026 | |
| ports: | |
| - 6001:8000 | |
| neo4j: | |
| image: neo4j:latest | |
| ports: | |
| - "7687:7687" | |
| env: | |
| NEO4J_AUTH: neo4j/Yao2026Neo4j | |
| mcp-everything: | |
| image: yaoapp/mcp-everything:latest | |
| ports: | |
| - "3021:3021" | |
| - "3022:3022" | |
| strategy: | |
| matrix: | |
| go: [1.24] | |
| db: [MySQL8.0, SQLite3, Postgres14] | |
| redis: [6] | |
| mongo: ["6.0"] | |
| steps: | |
| - name: "Download artifact" | |
| uses: actions/github-script@v6 | |
| with: | |
| script: | | |
| var artifacts = await github.rest.actions.listWorkflowRunArtifacts({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| run_id: ${{github.event.workflow_run.id }}, | |
| }); | |
| var matchArtifact = artifacts.data.artifacts.filter((artifact) => { | |
| return artifact.name == "pr" | |
| })[0]; | |
| var download = await github.rest.actions.downloadArtifact({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| artifact_id: matchArtifact.id, | |
| archive_format: 'zip', | |
| }); | |
| var fs = require('fs'); | |
| fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data)); | |
| - name: "Read NR & SHA" | |
| run: | | |
| unzip pr.zip | |
| cat NR | |
| cat SHA | |
| echo HEAD=$(cat SHA) >> $GITHUB_ENV | |
| echo NR=$(cat NR) >> $GITHUB_ENV | |
| - name: "Comment on PR" | |
| uses: actions/github-script@v6 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const { NR } = process.env | |
| var fs = require('fs'); | |
| var issue_number = NR; | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: issue_number, | |
| body: 'Thank you for the PR! The test workflow ( GO:${{ matrix.go }} DB:${{ matrix.db }} Redis:${{ matrix.redis }} ) is running, the results of the run will be commented later.' | |
| }); | |
| - name: Setup Cache | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ~/.cache/go-build | |
| ~/go/pkg/mod | |
| key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
| restore-keys: | | |
| ${{ runner.os }}-go- | |
| - name: Checkout Kun | |
| uses: actions/checkout@v3 | |
| with: | |
| repository: yaoapp/kun | |
| path: kun | |
| - name: Checkout Xun | |
| uses: actions/checkout@v3 | |
| with: | |
| repository: yaoapp/xun | |
| path: xun | |
| - name: Checkout Application | |
| uses: actions/checkout@v3 | |
| with: | |
| repository: ${{ env.REPO_APP }} | |
| path: gou-dev-app | |
| - name: Checkout V8Go | |
| uses: actions/checkout@v3 | |
| with: | |
| repository: yaoapp/v8go | |
| lfs: true | |
| path: v8go | |
| - name: Unzip libv8 | |
| run: | | |
| files=$(find ./v8go -name "libv8*.zip") | |
| for file in $files; do | |
| dir=$(dirname "$file") # Get the directory where the ZIP file is located | |
| echo "Extracting $file to directory $dir" | |
| unzip -o -d $dir $file | |
| rm -rf $dir/__MACOSX | |
| done | |
| - name: Checkout Demo WMS | |
| uses: actions/checkout@v3 | |
| with: | |
| repository: yaoapp/demo-wms | |
| path: demo-wms | |
| - name: Move Kun, Xun, V8go | |
| run: | | |
| mv kun ../ | |
| mv xun ../ | |
| mv v8go ../ | |
| mv gou-dev-app ../ | |
| mv demo-wms ../ | |
| ls -l . | |
| ls -l ../ | |
| - name: Checkout pull request HEAD commit | |
| uses: actions/checkout@v3 | |
| with: | |
| ref: ${{ env.HEAD }} | |
| - name: Move Application | |
| run: | | |
| mv ../gou-dev-app . | |
| ls -l . | |
| ls -l ../ | |
| - name: Start Redis | |
| uses: supercharge/redis-github-action@1.4.0 | |
| with: | |
| redis-version: ${{ matrix.redis }} | |
| - name: Start MongoDB | |
| uses: supercharge/mongodb-github-action@1.8.0 | |
| with: | |
| mongodb-version: ${{ matrix.mongo }} | |
| mongodb-username: root | |
| mongodb-password: 123456 | |
| mongodb-db: test | |
| - name: Setup MySQL8.0 (connector) | |
| uses: ./.github/actions/setup-db | |
| with: | |
| kind: "MySQL8.0" | |
| db: "test" | |
| user: "test" | |
| password: "123456" | |
| port: "3308" | |
| - name: Setup ${{ matrix.db }} | |
| uses: ./.github/actions/setup-db | |
| with: | |
| kind: "${{ matrix.db }}" | |
| db: "gou" | |
| user: "gou" | |
| password: "123456" | |
| - name: Setup Go ${{ matrix.go }} | |
| uses: actions/setup-go@v3 | |
| with: | |
| go-version: ${{ matrix.go }} | |
| - name: Install FFmpeg 7.x | |
| run: | | |
| wget https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linux64-gpl.tar.xz | |
| tar -xf ffmpeg-master-latest-linux64-gpl.tar.xz | |
| sudo cp ffmpeg-master-latest-linux64-gpl/bin/ffmpeg /usr/local/bin/ | |
| sudo cp ffmpeg-master-latest-linux64-gpl/bin/ffprobe /usr/local/bin/ | |
| sudo chmod +x /usr/local/bin/ffmpeg /usr/local/bin/ffprobe | |
| - name: Test FFmpeg | |
| run: ffmpeg -version | |
| - name: Install pdftoppm, mutool, imagemagick | |
| run: | | |
| sudo apt update | |
| sudo apt install -y poppler-utils mupdf-tools imagemagick | |
| - name: Test pdftoppm, mutool, imagemagick | |
| run: | | |
| pdftoppm -v | |
| mutool -v | |
| convert -version | |
| - name: Setup Go Tools | |
| run: | | |
| make tools | |
| - name: Setup ENV | |
| run: | | |
| echo "GOU_TEST_DSN=$DSN" >> $GITHUB_ENV | |
| echo "GOU_TEST_DB_DRIVER=$DB_DRIVER" >> $GITHUB_ENV | |
| echo "GOU_TEST_API_ROOT=$GITHUB_WORKSPACE/app/apis" >> $GITHUB_ENV | |
| echo "GOU_TEST_FLW_ROOT=$GITHUB_WORKSPACE/app/flows" >> $GITHUB_ENV | |
| echo "GOU_TEST_MOD_ROOT=$GITHUB_WORKSPACE/app/models" >> $GITHUB_ENV | |
| echo "GOU_TEST_PLG_ROOT=$HOME/data/gou-unit/plugins" >> $GITHUB_ENV | |
| echo "GOU_TEST_SCRIPT_ROOT=$GITHUB_WORKSPACE/app/scripts" >> $GITHUB_ENV | |
| echo "GOU_TEST_QUERY_ROOT=$GITHUB_WORKSPACE/query/assets" >> $GITHUB_ENV | |
| echo "GOU_TEST_PLG_LOG=$HOME/data/gou-unit/logs" >> $GITHUB_ENV | |
| echo "GOU_TEST_APP_ROOT=$GITHUB_WORKSPACE/tests/app" >> $GITHUB_ENV | |
| echo "YAO_PATH=$GITHUB_WORKSPACE/tests/yao" >> $GITHUB_ENV | |
| mkdir -p $HOME/.yao | |
| echo ${{ secrets.GOU_TEST_GITHUB_TOKEN }} > $HOME/.yao/github_token | |
| chmod 600 $HOME/.yao/github_token | |
| ls -l $HOME/.yao/github_token | |
| - name: Run Test | |
| run: | | |
| make vet | |
| make fmt-check | |
| make misspell-check | |
| make test | |
| # - name: Run Benchmark | |
| # run: | | |
| # make bench | |
| - name: Codecov Report | |
| uses: codecov/codecov-action@v3 | |
| # with: | |
| # token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos | |
| - name: "Comment on PR" | |
| uses: actions/github-script@v6 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const { NR } = process.env | |
| var fs = require('fs'); | |
| var issue_number = NR; | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: issue_number, | |
| body: '✨DONE✨ GO:${{ matrix.go }} DB:${{ matrix.db }} Redis:${{ matrix.redis }} passed.' | |
| }); |