perf: avoid unnecessary connections for CLUSTER SHARDS when auto pipe… #931
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: Go Modules Test | |
on: [push, pull_request] | |
# https://docs.github.com/en/actions/learn-github-actions/expressions | |
# https://docs.github.com/en/actions/learn-github-actions/contexts#github-context | |
concurrency: | |
# Use github.run_id on main branch | |
# Use github.event.pull_request.number on pull requests, so it's unique per pull request | |
# Use github.ref on other branches, so it's unique per branch | |
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_id || github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
validate-modules: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Validate Required Modules | |
run: | | |
# Find all module directories: rueidis* (except rueidislock), om, and mock | |
# These directories should contain go.mod files | |
modules=$(find . -maxdepth 1 -type d \( -name "rueidis*" -o -name "om" -o -name "mock" \) | grep -v "./rueidislock") | |
# Check each module directory | |
for module in $modules; do | |
if [ ! -f "$module/go.mod" ]; then | |
echo "Error: Module directory '$module' is missing go.mod" | |
exit 1 | |
fi | |
done | |
prepare-matrix: | |
needs: validate-modules | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@v4 | |
- id: set-matrix | |
run: | | |
echo "matrix=$(find . -maxdepth 2 -type f -name 'go.mod' | xargs -n 1 dirname | sort -u | { echo "e2e"; cat; } | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT | |
build: | |
needs: prepare-matrix | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
module: ${{fromJson(needs.prepare-matrix.outputs.matrix)}} | |
go-version: ['1.22.0', '1.23.0', '1.24.0'] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Test Module | |
run: | | |
module_path=${{ matrix.module }} | |
if [ "$module_path" == "." ]; then | |
list=$(go list ./...) | |
echo "Test Packages: $list" | |
for n in {1..5}; do | |
./dockertest.sh -skip 'Integration' $list && break | |
done | |
elif [ "$module_path" == "e2e" ]; then | |
list=$(go list ./...) | |
echo "Test Packages: $list" | |
for n in {1..5}; do | |
./dockertest.sh -run 'Integration' $list && break | |
done | |
else | |
cd $module_path | |
list=$(go list ./...) | |
echo "Test Packages: $list" | |
for n in {1..5}; do | |
../dockertest.sh $list && break | |
done | |
fi | |
- uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
verbose: true |