forked from kiali/kiali
-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (41 loc) · 1.23 KB
/
build-backend.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
name: Build Backend
on:
workflow_call:
inputs:
build_branch:
required: true
type: string
jobs:
build_backend:
name: Build and unit test backend
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ inputs.build_branch }}
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
cache-dependency-path: go.sum
- name: Lint Install
run: make lint-install
- name: Verify code linting
run: make lint
- name: Build
run: make -e GO_BUILD_FLAGS=${{ env.GO_BUILD_FLAGS }} -e CGO_ENABLED=${{ env.CGO_ENABLED }} clean-all build
env:
# Build with -race flag if this is a PR, otherwise it is a release and
# we don't want to build with race detection because of the perf penalty.
GO_BUILD_FLAGS: ${{ github.base_ref && '-race' }}
# The -race flag requires CGO_ENABLED
CGO_ENABLED: ${{ github.base_ref && '1' }}
- name: Run backend unit tests
run: make -e GO_TEST_FLAGS="-race" test
- name: Upload go binary
uses: actions/upload-artifact@v4
with:
name: kiali
path: ~/go/bin/kiali