Skip to content

Commit 7a437cd

Browse files
committed
Combine all CI into one workflow
Signed-off-by: Christopher Desiniotis <[email protected]>
1 parent e8b1299 commit 7a437cd

File tree

4 files changed

+146
-216
lines changed

4 files changed

+146
-216
lines changed

.github/workflows/image.yaml renamed to .github/workflows/ci.yaml

Lines changed: 146 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
name: Image
15+
name: CI
1616

1717
on:
1818
pull_request:
@@ -28,7 +28,98 @@ on:
2828
- release-*
2929

3030
jobs:
31+
### Configuration checks ###
32+
helm-lint:
33+
runs-on: ubuntu-latest
34+
steps:
35+
- name: Checkout code
36+
uses: actions/checkout@v4
37+
- name: Install Helm
38+
uses: azure/[email protected]
39+
id: install
40+
- run: helm lint deployments/gpu-operator/
41+
validate-csv:
42+
runs-on: ubuntu-latest
43+
steps:
44+
- name: Checkout code
45+
uses: actions/checkout@v4
46+
- name: Get Golang version
47+
id: vars
48+
run: |
49+
GOLANG_VERSION=$( grep "GOLANG_VERSION ?=" versions.mk )
50+
echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION ?= }" >> $GITHUB_ENV
51+
- name: Install Go
52+
uses: actions/setup-go@v5
53+
with:
54+
go-version: ${{ env.GOLANG_VERSION }}
55+
- run: make validate-csv
56+
validate-helm-values:
57+
runs-on: ubuntu-latest
58+
steps:
59+
- name: Checkout code
60+
uses: actions/checkout@v4
61+
- name: Get Golang version
62+
id: vars
63+
run: |
64+
GOLANG_VERSION=$( grep "GOLANG_VERSION ?=" versions.mk )
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 validate-helm-values
71+
72+
### Golang checks and build ###
73+
go-check:
74+
needs: [helm-lint, validate-csv, validate-helm-values]
75+
runs-on: ubuntu-latest
76+
steps:
77+
- uses: actions/checkout@v4
78+
name: Checkout code
79+
- name: Get Golang version
80+
id: vars
81+
run: |
82+
GOLANG_VERSION=$( grep "GOLANG_VERSION ?=" versions.mk )
83+
echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION ?= }" >> $GITHUB_ENV
84+
- name: Install Go
85+
uses: actions/setup-go@v5
86+
with:
87+
go-version: ${{ env.GOLANG_VERSION }}
88+
- name: Lint
89+
uses: golangci/golangci-lint-action@v5
90+
with:
91+
version: latest
92+
args: -v --timeout 5m
93+
skip-cache: true
94+
- run: make check
95+
go-test:
96+
needs: [helm-lint, validate-csv, validate-helm-values]
97+
name: unit tests
98+
runs-on: ubuntu-latest
99+
steps:
100+
- name: Checkout code
101+
uses: actions/checkout@v4
102+
- name: Get Golang version
103+
id: vars
104+
run: |
105+
GOLANG_VERSION=$( grep "GOLANG_VERSION ?=" versions.mk )
106+
echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION ?= }" >> $GITHUB_ENV
107+
- name: Install Go
108+
uses: actions/setup-go@v5
109+
with:
110+
go-version: ${{ env.GOLANG_VERSION }}
111+
- run: make coverage
112+
go-build:
113+
needs: [helm-lint, validate-csv, validate-helm-values]
114+
runs-on: ubuntu-latest
115+
steps:
116+
- uses: actions/checkout@v4
117+
name: Checkout code
118+
- run: make docker-build
119+
120+
### Image builds ###
31121
build-gpu-operator:
122+
needs: [go-check, go-test, go-build]
32123
runs-on: ubuntu-latest
33124
strategy:
34125
matrix:
@@ -73,6 +164,7 @@ jobs:
73164
echo "${VERSION}"
74165
make build-${{ matrix.dist }}
75166
build-gpu-operator-validator:
167+
needs: [go-check, go-test, go-build]
76168
runs-on: ubuntu-latest
77169
strategy:
78170
matrix:
@@ -118,6 +210,7 @@ jobs:
118210
echo "${VERSION}"
119211
make build-${{ matrix.dist }}
120212
213+
### e2e tests ###
121214
e2e-tests-containerd:
122215
needs: [build-gpu-operator, build-gpu-operator-validator]
123216
runs-on: ubuntu-latest
@@ -153,17 +246,64 @@ jobs:
153246
echo "private_key=${{ github.workspace }}/key.pem" >> $GITHUB_ENV
154247
- name: Run e2e tests
155248
env:
156-
#OPERATOR_VERSION: ${COMMIT_SHORT_SHA}-ubi8
157-
#OPERATOR_IMAGE: ghcr.io/${LOWERCASE_REPO_OWNER}/gpu-operator
158-
#VALIDATOR_VERSION: ${COMMIT_SHORT_SHA}-ubi8
159-
#VALIDATOR_IMAGE: ghcr.io/${LOWERCASE_REPO_OWNER}/gpu-operator/gpu-operator-validator
160249
GPU_PRODUCT_NAME: "Tesla-T4"
161250
SKIP_LAUNCH: "true"
162251
CONTAINER_RUNTIME: "containerd"
163252
TEST_CASE: "./tests/cases/defaults.sh"
164253
run: |
165254
echo "${{ secrets.AWS_SSH_KEY }}" > ${private_key} && chmod 400 ${private_key}
166-
echo "${OPERATOR_IMAGE}:${OPERATOR_VERSION}\n${VALIDATOR_IMAGE}:${VALIDATOR_VERSION}\n${GPU_PRODUCT_NAME}\n${TEST_CASE}"
255+
./tests/ci-run-e2e.sh ${OPERATOR_IMAGE} ${OPERATOR_VERSION} ${VALIDATOR_IMAGE} ${VALIDATOR_VERSION} ${GPU_PRODUCT_NAME} ${TEST_CASE} || rc=$?
256+
./tests/scripts/pull.sh /tmp/logs logs
257+
exit $rc
258+
- name: Archive test logs
259+
if: ${{ failure() }}
260+
uses: actions/upload-artifact@v4
261+
with:
262+
name: e2e-test-logs
263+
path: ./logs/
264+
retention-days: 15
265+
266+
e2e-tests-nvidiadriver:
267+
needs: [build-gpu-operator, build-gpu-operator-validator]
268+
runs-on: ubuntu-latest
269+
steps:
270+
- uses: actions/checkout@v4
271+
name: Check out code
272+
- name: Set up Holodeck
273+
uses: NVIDIA/holodeck@main
274+
with:
275+
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
276+
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
277+
aws_ssh_key: ${{ secrets.AWS_SSH_KEY }}
278+
holodeck_config: "tests/holodeck.yaml"
279+
- name: Get public dns name
280+
id: get_public_dns_name
281+
uses: mikefarah/yq@master
282+
with:
283+
cmd: yq '.status.properties[] | select(.name == "public-dns-name") | .value' /github/workspace/.cache/holodeck.yaml
284+
- name: Calculate test vars
285+
id: vars
286+
run: |
287+
COMMIT_SHORT_SHA=${GITHUB_SHA:0:8}
288+
echo "COMMIT_SHORT_SHA=${GITHUB_SHA:0:8}" >> $GITHUB_ENV
289+
LOWERCASE_REPO_OWNER=$(echo "${GITHUB_REPOSITORY_OWNER}" | awk '{print tolower($0)}')
290+
echo "LOWERCASE_REPO_OWNER=$(echo "${GITHUB_REPOSITORY_OWNER}" | awk '{print tolower($0)}')" >> $GITHUB_ENV
291+
292+
echo "OPERATOR_VERSION=${COMMIT_SHORT_SHA}-ubi8" >> $GITHUB_ENV
293+
echo "OPERATOR_IMAGE=ghcr.io/${LOWERCASE_REPO_OWNER}/gpu-operator" >> $GITHUB_ENV
294+
echo "VALIDATOR_VERSION=${COMMIT_SHORT_SHA}-ubi8" >> $GITHUB_ENV
295+
echo "VALIDATOR_IMAGE=ghcr.io/${LOWERCASE_REPO_OWNER}/gpu-operator/gpu-operator-validator" >> $GITHUB_ENV
296+
297+
echo "instance_hostname=ubuntu@${{ steps.get_public_dns_name.outputs.result }}" >> $GITHUB_ENV
298+
echo "private_key=${{ github.workspace }}/key.pem" >> $GITHUB_ENV
299+
- name: Run e2e tests
300+
env:
301+
GPU_PRODUCT_NAME: "Tesla-T4"
302+
SKIP_LAUNCH: "true"
303+
CONTAINER_RUNTIME: "containerd"
304+
TEST_CASE: "./tests/cases/nvidia-driver.sh"
305+
run: |
306+
echo "${{ secrets.AWS_SSH_KEY }}" > ${private_key} && chmod 400 ${private_key}
167307
./tests/ci-run-e2e.sh ${OPERATOR_IMAGE} ${OPERATOR_VERSION} ${VALIDATOR_IMAGE} ${VALIDATOR_VERSION} ${GPU_PRODUCT_NAME} ${TEST_CASE} || rc=$?
168308
./tests/scripts/pull.sh /tmp/logs logs
169309
exit $rc

.github/workflows/config.yaml

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

.github/workflows/e2e.yaml

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

0 commit comments

Comments
 (0)