fix: fix go.yml error #24
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: CI | |
| on: | |
| push: | |
| branches: [ "main", "master" ] | |
| pull_request: | |
| branches: [ "*" ] | |
| jobs: | |
| lint: | |
| name: Lint check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Set up Go | |
| uses: actions/setup-go@v3 | |
| with: | |
| go-version: 1.18 | |
| - name: Check out code into the Go module directory | |
| uses: actions/checkout@v3 | |
| - name: Golangci Lint | |
| # https://golangci-lint.run/ | |
| uses: golangci/golangci-lint-action@v3 | |
| with: | |
| version: latest | |
| args: "--out-format colored-line-number" | |
| build: | |
| name: Build and test - Go ${{ matrix.go_version }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| # If you want to matrix build , you can append the following list. | |
| matrix: | |
| go_version: | |
| - 1.18 | |
| - 1.19 | |
| os: | |
| - ubuntu-latest | |
| steps: | |
| - name: Set up Go ${{ matrix.go_version }} | |
| uses: actions/setup-go@v3 | |
| with: | |
| go-version: ${{ matrix.go_version }} | |
| id: go | |
| - name: Check out code into the Go module directory | |
| uses: actions/checkout@v3 | |
| - name: Cache build dependence | |
| uses: actions/cache@v3 | |
| with: | |
| # Cache | |
| path: ~/go/pkg/mod | |
| # Cache key | |
| key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
| # An ordered list of keys to use for restoring the cache if no cache hit occurred for key | |
| restore-keys: ${{ runner.os }}-go- | |
| - name: Test | |
| run: | | |
| go test -v -race ./... -coverprofile=coverage.txt -covermode=atomic | |
| cd ./pkg/datasource/consul | |
| go test -race -count=1 ./... -coverprofile=coverage.txt -covermode=atomic | |
| cd ../etcdv3 | |
| go test -race -count=1 ./... -coverprofile=coverage.txt -covermode=atomic | |
| cd ../k8s | |
| go test -race -count=1 ./... -coverprofile=coverage.txt -covermode=atomic | |
| cd ../nacos | |
| go test -race -count=1 ./... -coverprofile=coverage.txt -covermode=atomic | |
| cd ../apollo | |
| go test -race -count=1 ./... -coverprofile=coverage.txt -covermode=atomic | |
| cd ../../adapters/echo | |
| go test -race -count=1 ./... -coverprofile=coverage.txt -covermode=atomic | |
| cd ../gear | |
| go test -race -count=1 ./... -coverprofile=coverage.txt -covermode=atomic | |
| cd ../gin | |
| go test -race -count=1 ./... -coverprofile=coverage.txt -covermode=atomic | |
| cd ../grpc | |
| go test -race -count=1 ./... -coverprofile=coverage.txt -covermode=atomic | |
| cd ../micro | |
| go test -race -count=1 ./... -coverprofile=coverage.txt -covermode=atomic | |
| - name: Coverage | |
| run: bash <(curl -s https://codecov.io/bash) | |
| build-llm-token-ratelimit: | |
| name: Build and test LLM Token Ratelimit - Go ${{ matrix.go_version }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| # If you want to matrix build , you can append the following list. | |
| matrix: | |
| go_version: | |
| - 1.22.0 | |
| os: | |
| - ubuntu-latest | |
| services: | |
| redis-node1: | |
| image: redis:6.2-alpine | |
| options: >- | |
| --entrypoint redis-server | |
| --cluster-enabled yes | |
| --cluster-config-file nodes-node1.conf | |
| --cluster-node-timeout 5000 | |
| --port 6379 | |
| ports: | |
| - 6379:6379 | |
| redis-node2: | |
| image: redis:6.2-alpine | |
| options: >- | |
| --entrypoint redis-server | |
| --cluster-enabled yes | |
| --cluster-config-file nodes-node2.conf | |
| --cluster-node-timeout 5000 | |
| --port 6380 | |
| ports: | |
| - 6380:6380 | |
| redis-node3: | |
| image: redis:6.2-alpine | |
| options: >- | |
| --entrypoint redis-server | |
| --cluster-enabled yes | |
| --cluster-config-file nodes-node3.conf | |
| --cluster-node-timeout 5000 | |
| --port 6381 | |
| ports: | |
| - 6381:6381 | |
| steps: | |
| - name: Set up Go ${{ matrix.go_version }} | |
| uses: actions/setup-go@v3 | |
| with: | |
| go-version: ${{ matrix.go_version }} | |
| id: go | |
| - name: Check out code into the Go module directory | |
| uses: actions/checkout@v3 | |
| - name: Cache build dependence | |
| uses: actions/cache@v3 | |
| with: | |
| # Cache | |
| path: ~/go/pkg/mod | |
| # Cache key | |
| key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
| # An ordered list of keys to use for restoring the cache if no cache hit occurred for key | |
| restore-keys: ${{ runner.os }}-go- | |
| - name: Setup Redis Cluster | |
| run: | | |
| sleep 10 | |
| echo "yes" | redis-cli --cluster create \ | |
| 127.0.0.1:6379 \ | |
| 127.0.0.1:6380 \ | |
| 127.0.0.1:6381 \ | |
| --cluster-replicas 0 | |
| redis-cli -h 127.0.0.1 -c -p 6379 cluster info | |
| redis-cli -h 127.0.0.1 -c -p 6379 cluster nodes | |
| - name: LLM Token Ratelimit Adapter Test | |
| env: | |
| LLM_API_KEY: ${{ secrets.LLM_API_KEY }} | |
| LLM_BASE_URL: ${{ secrets.LLM_BASE_URL }} | |
| LLM_MODEL: ${{ secrets.LLM_MODEL }} | |
| run: | | |
| cd ./pkg/adapters/langchaingo | |
| go test -race -count=1 ./... -coverprofile=coverage.txt -covermode=atomic | |
| cd ../eino | |
| go test -race -count=1 ./... -coverprofile=coverage.txt -covermode=atomic | |
| - name: Coverage | |
| run: bash <(curl -s https://codecov.io/bash) |