Skip to content

Commit 4bab696

Browse files
Update GitHub Actions
Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
1 parent 47dddc6 commit 4bab696

File tree

6 files changed

+198
-80
lines changed

6 files changed

+198
-80
lines changed

.github/workflows/basic-checks.yaml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,6 @@ name: "basic checks"
1515

1616
on:
1717
workflow_call:
18-
outputs:
19-
version:
20-
description: "The short SHA to use as a version string"
21-
value: ${{ jobs.variables.outputs.version }}
22-
golang_version:
23-
description: "The golang version for this project"
24-
value: ${{ jobs.variables.outputs.golang_version }}
2518
pull_request:
2619
types:
2720
- opened

.github/workflows/ci.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,21 @@ on:
2121
- release-*
2222

2323
jobs:
24+
variables:
25+
uses: ./.github/workflows/variables.yaml
26+
2427
basic:
2528
uses: ./.github/workflows/basic-checks.yaml
29+
needs:
30+
- variables
31+
secrets: inherit
32+
33+
image:
34+
uses: ./.github/workflows/image.yaml
35+
needs:
36+
- variables
37+
- basic
38+
secrets: inherit
39+
with:
40+
version: ${{ needs.variables.outputs.version }}
41+
golang_version: ${{ needs.variables.outputs.golang_version }}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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: GPU Mockctl Image
16+
17+
on:
18+
workflow_call:
19+
inputs:
20+
version:
21+
required: true
22+
type: string
23+
golang_version:
24+
required: true
25+
type: string
26+
27+
jobs:
28+
build:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v5
32+
name: Check out code
33+
34+
- name: Set up Go
35+
uses: actions/setup-go@v6
36+
with:
37+
go-version: ${{ inputs.golang_version }}
38+
39+
- name: Set up QEMU
40+
uses: docker/setup-qemu-action@v3
41+
42+
- name: Set up Docker Buildx
43+
uses: docker/setup-buildx-action@v3
44+
45+
- name: Login to GitHub Container Registry
46+
if: github.event_name == 'push'
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 and push gpu-mockctl image
54+
env:
55+
IMAGE: ghcr.io/nvidia/k8s-test-infra/gpu-mockctl
56+
VERSION: ${{ inputs.version }}
57+
PUSH: ${{ github.event_name == 'push' && 'true' || 'false' }}
58+
run: |
59+
cd deployments/devel/gpu-mock
60+
make build-image IMAGE="${IMAGE}:${VERSION}"
61+
if [[ "${PUSH}" == "true" ]]; then
62+
docker push "${IMAGE}:${VERSION}"
63+
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
64+
docker tag "${IMAGE}:${VERSION}" "${IMAGE}:latest"
65+
docker push "${IMAGE}:latest"
66+
fi
67+
fi

.github/workflows/image.yaml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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: Image
16+
17+
on:
18+
workflow_call:
19+
inputs:
20+
version:
21+
required: true
22+
type: string
23+
golang_version:
24+
required: true
25+
type: string
26+
27+
jobs:
28+
build:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v5
32+
name: Check out code
33+
34+
- name: Set up Go
35+
uses: actions/setup-go@v6
36+
with:
37+
go-version-file: go.mod
38+
39+
- name: Set up QEMU
40+
uses: docker/setup-qemu-action@v3
41+
42+
- name: Set up Docker Buildx
43+
uses: docker/setup-buildx-action@v3
44+
45+
- name: Login to GitHub Container Registry
46+
if: github.event_name == 'push'
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 and push image
54+
env:
55+
IMAGE: ghcr.io/nvidia/k8s-test-infra/gpu-mockctl
56+
VERSION: ${{ inputs.version }}
57+
PUSH: ${{ github.event_name == 'push' && 'true' || 'false' }}
58+
run: |
59+
cd deployments/devel/gpu-mock
60+
make build-image IMAGE="${IMAGE}:${VERSION}"
61+
if [[ "${PUSH}" == "true" ]]; then
62+
docker push "${IMAGE}:${VERSION}"
63+
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
64+
docker tag "${IMAGE}:${VERSION}" "${IMAGE}:latest"
65+
docker push "${IMAGE}:latest"
66+
fi
67+
fi
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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: Test Mock NVML
16+
17+
on:
18+
workflow_call:
19+
20+
jobs:
21+
test:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@v5
26+
27+
- name: Install dependencies
28+
run: |
29+
sudo apt-get update
30+
sudo apt-get install -y gcc make valgrind
31+
32+
- name: Run tests
33+
run: |
34+
cd pkg/gpu/mocknvml
35+
./test/run_tests.sh
36+
37+
- name: Build in release mode
38+
run: |
39+
cd pkg/gpu/mocknvml
40+
make clean
41+
make
42+
43+
- name: Upload test artifacts
44+
uses: actions/upload-artifact@v4
45+
if: failure()
46+
with:
47+
name: mocknvml-test-results
48+
path: pkg/gpu/mocknvml/build/test/

.github/workflows/test-mocknvml.yml

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

0 commit comments

Comments
 (0)