redis / rueidis

A fast Golang Redis client that supports Client Side Caching, Auto Pipelining, Generics OM, RedisJSON, RedisBloom, RediSearch, etc.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Refine the .circleci/config.yml by using dynamic config

rueian opened this issue · comments

Currently, we have these hard coded and repeated sections in the .circleci/config.yml for testing each go.mod.

- run: # test ./go.mod
command: |
list=$(go list ./... | circleci tests split --split-by=timings)
echo "Test Packages: $list"
for n in {1..5}; do ./dockertest.sh $list && break; done
no_output_timeout: 15m
- run: # test ./rueidishook/go.mod
command: |
cd $CIRCLE_WORKING_DIRECTORY/rueidishook
list=$(go list ./... | circleci tests split --split-by=timings)
echo "Test Packages: $list"
for n in {1..5}; do ../dockertest.sh $list && break; done
no_output_timeout: 15m
- run: # test ./mock/go.mod
command: |
cd $CIRCLE_WORKING_DIRECTORY/mock
list=$(go list ./... | circleci tests split --split-by=timings)
echo "Test Packages: $list"
for n in {1..5}; do ../dockertest.sh $list && break; done
no_output_timeout: 15m

It will be better if we can detect every go.mod files automatically and generate .circleci/config.yml dynamically through the
https://circleci.com/docs/dynamic-config/.

Here is an example of how we can detect every go.mod files:

find . -maxdepth 2 -type f -name "go.mod" | while read -r line; do
DIR_NAME=$(dirname "$line")
PREFIX=${DIR_NAME#"./"} # Remove leading "./"

Thank you @moonorange!