-
Notifications
You must be signed in to change notification settings - Fork 259
95 lines (85 loc) · 3.34 KB
/
Copy pathbuild.yml
File metadata and controls
95 lines (85 loc) · 3.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: Go Modules Test
permissions:
contents: read
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@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- 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@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- 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.25.0', '1.26.0']
steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Set up Go
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
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
if [ "$module_path" == "./rueidisrdma" ]; then
sudo apt-get update -y
sudo apt-get install -y libibverbs-dev librdmacm-dev rdma-core
fi
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@ad3126e916f78f00edff4ed0317cf185271ccc2d # v5.4.2
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true