-
Notifications
You must be signed in to change notification settings - Fork 13
53 lines (47 loc) · 1.37 KB
/
build.yml
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
name: Go Modules Test
on: [push, pull_request]
jobs:
prepare-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- id: set-matrix
run: |
echo "::set-output name=matrix::$(find . -maxdepth 2 -type f -name 'go.mod' | xargs -n 1 dirname | sort -u | jq -R -s -c 'split("\n")[:-1]')"
build:
needs: prepare-matrix
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
module: ${{fromJson(needs.prepare-matrix.outputs.matrix)}}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21.0'
- 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 $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