Skip to content

Commit 42337d6

Browse files
Update GitHub actions and Makefiles to be inline with team projects
Signed-off-by: Carlos Eduardo Arango Gutierrez <[email protected]>
1 parent 86200d3 commit 42337d6

File tree

13 files changed

+1548
-118
lines changed

13 files changed

+1548
-118
lines changed

.github/workflows/ci.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Copyright 2025 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: CI Pipeline
16+
17+
on:
18+
push:
19+
branches:
20+
- "pull-request/[0-9]+"
21+
- main
22+
- release-*
23+
24+
jobs:
25+
code-scanning:
26+
uses: ./.github/workflows/code_scanning.yaml
27+
28+
variables:
29+
runs-on: ubuntu-latest
30+
outputs:
31+
version: ${{ steps.version.outputs.version }}
32+
steps:
33+
- name: Generate Commit Short SHA
34+
id: version
35+
run: echo "version=$(echo $GITHUB_SHA | cut -c1-8)" >> "$GITHUB_OUTPUT"
36+
37+
golang:
38+
uses: ./.github/workflows/golang.yaml
39+
40+
image:
41+
uses: ./.github/workflows/image.yaml
42+
needs: [variables, golang, code-scanning]
43+
secrets: inherit
44+
with:
45+
version: ${{ needs.variables.outputs.version }}
46+
build_multi_arch_images: ${{ github.ref_name == 'main' || startsWith(github.ref_name, 'release-') }}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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: "CodeQL"
16+
17+
on:
18+
workflow_call: {}
19+
pull_request:
20+
types:
21+
- opened
22+
- synchronize
23+
branches:
24+
- main
25+
- release-*
26+
27+
jobs:
28+
analyze:
29+
name: Analyze Go code with CodeQL
30+
runs-on: ubuntu-latest
31+
timeout-minutes: 360
32+
permissions:
33+
security-events: write
34+
packages: read
35+
steps:
36+
- name: Checkout repository
37+
uses: actions/checkout@v4
38+
39+
- name: Initialize CodeQL
40+
uses: github/codeql-action/init@v3
41+
with:
42+
languages: go
43+
build-mode: manual
44+
45+
- shell: bash
46+
run: |
47+
make build
48+
49+
- name: Perform CodeQL Analysis
50+
uses: github/codeql-action/analyze@v3
51+
with:
52+
category: "/language:go"

.github/workflows/golang.yaml

Lines changed: 61 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2024 NVIDIA CORPORATION
1+
# Copyright 2025 NVIDIA CORPORATION
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -15,52 +15,88 @@
1515
name: Golang
1616

1717
on:
18+
workflow_call: {}
1819
pull_request:
20+
types:
21+
- opened
22+
- synchronize
1923
branches:
20-
- main
21-
- release-*
22-
push:
23-
branches:
24-
- main
25-
- release-*
24+
- main
25+
- release-*
2626

2727
jobs:
28-
validate-go-modules:
28+
check:
2929
runs-on: ubuntu-latest
3030
steps:
31-
- name: Checkout code
32-
uses: actions/checkout@v4
31+
- uses: actions/checkout@v4
32+
name: Checkout code
3333

34-
- name: Install Go
35-
uses: actions/setup-go@v5
36-
- run: make validate-modules
34+
- name: Get Golang version
35+
id: vars
36+
run: |
37+
GOLANG_VERSION=$(./scripts/golang-version.sh)
38+
echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION := }" >> $GITHUB_ENV
3739
38-
lint:
39-
runs-on: ubuntu-latest
40-
steps:
41-
- uses: actions/checkout@v4
40+
- name: Install Go
41+
uses: actions/setup-go@v5
42+
with:
43+
go-version: ${{ env.GOLANG_VERSION }}
4244

4345
- name: Lint
44-
uses: golangci/golangci-lint-action@v6
46+
uses: golangci/golangci-lint-action@v8
4547
with:
4648
version: latest
4749
args: -v --timeout 5m
4850
skip-cache: true
4951

52+
- name: Check golang modules
53+
run: |
54+
make check-vendor
55+
make -C deployments/devel check-modules
56+
5057
test:
51-
name: Unit test
52-
runs-on: ubuntu-latest
53-
steps:
58+
name: Unit test
59+
runs-on: ubuntu-latest
60+
steps:
5461
- name: Checkout code
5562
uses: actions/checkout@v4
5663

64+
- name: Get Golang version
65+
id: vars
66+
run: |
67+
GOLANG_VERSION=$(./scripts/golang-version.sh)
68+
echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION := }" >> $GITHUB_ENV
69+
5770
- name: Install Go
5871
uses: actions/setup-go@v5
59-
- run: make test
72+
with:
73+
go-version: ${{ env.GOLANG_VERSION }}
74+
75+
- name: Run unit tests and generate coverage report
76+
run: make coverage
77+
78+
- name: Upload to Coveralls
79+
uses: coverallsapp/github-action@v2
80+
with:
81+
github-token: ${{ secrets.GITHUB_TOKEN }}
82+
file: coverage.out
83+
6084
build:
85+
name: Build
6186
runs-on: ubuntu-latest
6287
steps:
63-
- uses: actions/checkout@v4
88+
- name: Checkout code
89+
uses: actions/checkout@v4
90+
91+
- name: Get Golang version
92+
id: vars
93+
run: |
94+
GOLANG_VERSION=$(./scripts/golang-version.sh)
95+
echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION ?= }" >> $GITHUB_ENV
96+
97+
- name: Install Go
98+
uses: actions/setup-go@v5
99+
with:
100+
go-version: ${{ env.GOLANG_VERSION }}
64101

65-
- name: Build
66-
run: make docker-build
102+
- run: make build

.github/workflows/image.yaml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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: Image
16+
17+
# Run this workflow on pull requests
18+
on:
19+
workflow_call:
20+
inputs:
21+
version:
22+
required: true
23+
type: string
24+
build_multi_arch_images:
25+
required: true
26+
type: string
27+
28+
jobs:
29+
build-image:
30+
runs-on: ubuntu-latest
31+
strategy:
32+
matrix:
33+
dist: [ubi9]
34+
steps:
35+
- uses: actions/checkout@v4
36+
name: Check out code
37+
38+
- name: Set up QEMU
39+
uses: docker/setup-qemu-action@v3
40+
with:
41+
image: tonistiigi/binfmt:master
42+
43+
- name: Set up Docker Buildx
44+
uses: docker/setup-buildx-action@v3
45+
46+
- name: Login to GitHub Container Registry
47+
uses: docker/login-action@v3
48+
with:
49+
registry: ghcr.io
50+
username: ${{ github.actor }}
51+
password: ${{ secrets.GITHUB_TOKEN }}
52+
53+
- name: Build image
54+
env:
55+
IMAGE_NAME: ghcr.io/nvidia/k8s-driver-manager
56+
VERSION: ${{ inputs.version }}
57+
PUSH_ON_BUILD: "true"
58+
BUILD_MULTI_ARCH_IMAGES: ${{ inputs.build_multi_arch_images }}
59+
run: |
60+
echo "${VERSION}"
61+
make -f deployments/container/Makefile build-${{ matrix.target }}

.github/workflows/images.yaml

Lines changed: 0 additions & 77 deletions
This file was deleted.

0 commit comments

Comments
 (0)