|
15 | 15 | name: Golang |
16 | 16 |
|
17 | 17 | on: |
18 | | - pull_request: |
19 | | - types: |
20 | | - - opened |
21 | | - - synchronize |
22 | | - branches: |
23 | | - - main |
24 | | - - release-* |
25 | | - push: |
26 | | - branches: |
27 | | - - main |
28 | | - - release-* |
| 18 | + workflow_call: |
| 19 | + inputs: |
| 20 | + golang_version: |
| 21 | + required: true |
| 22 | + type: string |
29 | 23 |
|
30 | 24 | jobs: |
31 | 25 | check: |
32 | 26 | runs-on: ubuntu-latest |
33 | 27 | steps: |
34 | 28 | - uses: actions/checkout@v4 |
35 | 29 | name: Checkout code |
36 | | - - name: Get Golang version |
37 | | - id: vars |
38 | | - run: | |
39 | | - GOLANG_VERSION=$(./hack/golang-version.sh) |
40 | | - echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION := }" >> $GITHUB_ENV |
| 30 | + |
41 | 31 | - name: Install Go |
42 | 32 | uses: actions/setup-go@v5 |
43 | 33 | with: |
44 | | - go-version: ${{ env.GOLANG_VERSION }} |
| 34 | + go-version: ${{ inputs.golang_versions }} |
| 35 | + |
45 | 36 | - name: Lint |
46 | 37 | uses: golangci/golangci-lint-action@v6 |
47 | 38 | with: |
48 | 39 | version: latest |
49 | 40 | args: -v --timeout 5m |
50 | 41 | skip-cache: true |
| 42 | + |
51 | 43 | - name: Check golang modules |
52 | 44 | run: | |
53 | 45 | make check-modules |
54 | 46 | make -C deployments/devel check-modules |
| 47 | +
|
55 | 48 | test: |
56 | 49 | name: Unit test |
57 | 50 | runs-on: ubuntu-latest |
58 | 51 | steps: |
59 | | - - name: Checkout code |
60 | | - uses: actions/checkout@v4 |
61 | | - - name: Get Golang version |
62 | | - id: vars |
63 | | - run: | |
64 | | - GOLANG_VERSION=$(./hack/golang-version.sh) |
65 | | - echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION ?= }" >> $GITHUB_ENV |
66 | | - - name: Install Go |
67 | | - uses: actions/setup-go@v5 |
68 | | - with: |
69 | | - go-version: ${{ env.GOLANG_VERSION }} |
70 | | - - run: make test |
| 52 | + - name: Checkout code |
| 53 | + uses: actions/checkout@v4 |
| 54 | + - name: Install Go |
| 55 | + uses: actions/setup-go@v5 |
| 56 | + with: |
| 57 | + go-version: ${{ inputs.golang_version }} |
| 58 | + - run: make test |
| 59 | + |
71 | 60 | build: |
72 | 61 | name: Build |
73 | 62 | runs-on: ubuntu-latest |
74 | 63 | steps: |
75 | | - - name: Checkout code |
76 | | - uses: actions/checkout@v4 |
77 | | - - name: Get Golang version |
78 | | - id: vars |
79 | | - run: | |
80 | | - GOLANG_VERSION=$(./hack/golang-version.sh) |
81 | | - echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION ?= }" >> $GITHUB_ENV |
82 | | - - name: Install Go |
83 | | - uses: actions/setup-go@v5 |
84 | | - with: |
85 | | - go-version: ${{ env.GOLANG_VERSION }} |
86 | | - - run: make build |
| 64 | + - name: Checkout code |
| 65 | + uses: actions/checkout@v4 |
| 66 | + - name: Install Go |
| 67 | + uses: actions/setup-go@v5 |
| 68 | + with: |
| 69 | + go-version: ${{ inputs.golang_version }} |
| 70 | + - run: make build |
0 commit comments