Skip to content

Commit e1b309b

Browse files
committed
Add Github Actions workflow for Golang checks, unit tests, and build
Signed-off-by: Christopher Desiniotis <[email protected]>
1 parent e9e1214 commit e1b309b

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

.github/workflow/golang.yaml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Copyright 2024 NVIDIA CORPORATION
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Golang
16+
17+
on:
18+
pull_request:
19+
types:
20+
- opened
21+
- synchronize
22+
branches:
23+
- master
24+
- release-*
25+
push:
26+
branches:
27+
- master
28+
- release-*
29+
30+
jobs:
31+
check:
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v4
35+
name: Checkout code
36+
- name: Get Golang version
37+
id: vars
38+
run: |
39+
GOLANG_VERSION=$( grep "GOLANG_VERSION ?=" versions.mk )
40+
echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION ?= }" >> $GITHUB_ENV
41+
- name: Install Go
42+
uses: actions/setup-go@v5
43+
with:
44+
go-version: ${{ env.GOLANG_VERSION }}
45+
- name: Lint
46+
uses: golangci/golangci-lint-action@v5
47+
with:
48+
version: latest
49+
args: -v --timeout 5m
50+
skip-cache: true
51+
- name: Check golang modules
52+
run: make check
53+
test:
54+
name: Unit test
55+
runs-on: ubuntu-latest
56+
steps:
57+
- name: Checkout code
58+
uses: actions/checkout@v4
59+
- name: Get Golang version
60+
id: vars
61+
run: |
62+
GOLANG_VERSION=$( grep "GOLANG_VERSION ?=" versions.mk )
63+
echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION ?= }" >> $GITHUB_ENV
64+
- name: Install Go
65+
uses: actions/setup-go@v5
66+
with:
67+
go-version: ${{ env.GOLANG_VERSION }}
68+
- run: make coverage
69+
build:
70+
runs-on: ubuntu-latest
71+
steps:
72+
- uses: actions/checkout@v4
73+
name: Checkout code
74+
75+
- name: Build
76+
run: make docker-build

0 commit comments

Comments
 (0)