1+ # Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
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 : Integration Tests - AWS
16+
17+ on :
18+ workflow_dispatch : {} # allow manual runs for testing
19+ schedule :
20+ - cron : ' 0 8 * * *' # daily at midnight PST, runs on default branch only
21+ push :
22+ branches :
23+ - main
24+
25+ permissions :
26+ contents : read
27+ actions : read
28+ id-token : write
29+
30+ jobs :
31+ integration-test-aws :
32+ runs-on : ubuntu-latest
33+ timeout-minutes : 60
34+ env :
35+ CSP : " aws"
36+ PREFIX : " nvs"
37+ AWS_ACCOUNT_ID : " 615299774277"
38+ AWS_REGION : " us-east-1"
39+ GITHUB_ACTIONS_ROLE_NAME : " github-actions-role"
40+ CLUSTER_NAME : " nvs-d${{ github.run_id }}"
41+ K8S_VERSION : " 1.34"
42+ EKSCTL_VERSION : " 0.216.0"
43+ GPU_AVAILABILITY_ZONE : " e"
44+ GPU_NODE_COUNT : " 1"
45+ CAPACITY_RESERVATION_ID : " cr-0cbe491320188dfa6"
46+
47+ # Debug
48+ SKIP_DELETE : " false" # skip cluster deletion
49+ TEST_TAG : " main-33c1d03"
50+
51+ steps :
52+ # Checkout
53+ - name : Checkout
54+ uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
55+
56+ # Auth
57+ - name : Configure AWS credentials
58+ id : auth
59+ uses : aws-actions/configure-aws-credentials@00943011d9042930efac3dcd3a170e4273319bc8 # v5.1.0
60+ with :
61+ role-to-assume : " arn:aws:iam::${{ env.AWS_ACCOUNT_ID }}:role/${{ env.GITHUB_ACTIONS_ROLE_NAME }}"
62+ aws-region : ${{ env.AWS_REGION }}
63+ role-session-name : GitHubActions-NVSentinel-Integration
64+
65+ # Install eksctl
66+ - name : Install eksctl
67+ run : |
68+ set -euox pipefail
69+ # Check if eksctl is already installed
70+ if command -v eksctl >/dev/null 2>&1; then
71+ echo "eksctl is already installed:"
72+ eksctl version
73+ exit 0
74+ fi
75+
76+ echo "Installing eksctl..."
77+ curl -LO "https://github.com/eksctl-io/eksctl/releases/download/v${EKSCTL_VERSION}/eksctl_linux_amd64.tar.gz"
78+ tar -xzf eksctl_linux_amd64.tar.gz
79+ chmod +x eksctl
80+ sudo mv eksctl /usr/local/bin/
81+ rm eksctl_linux_amd64.tar.gz
82+ echo "eksctl installed successfully:"
83+ eksctl version
84+
85+ # Cluster
86+ - name : Create Cluster
87+ id : cluster
88+ shell : bash
89+ run : |
90+ set -euox pipefail
91+ tests/uat/aws/create-eks-cluster.sh
92+
93+ # Connect
94+ - name : Connect to Cluster
95+ id : client
96+ if : steps.cluster.outcome == 'success'
97+ shell : bash
98+ run : |
99+ set -euox pipefail
100+ # Check if kubectl is already installed
101+ if command -v kubectl >/dev/null 2>&1; then
102+ echo "kubectl is already installed:"
103+ kubectl version
104+ exit 0
105+ fi
106+
107+ echo "Installing kubectl..."
108+ curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
109+ chmod +x kubectl
110+ sudo mv kubectl /usr/local/bin/
111+ echo "Updating kubeconfig..."
112+ aws eks update-kubeconfig --region ${{ env.AWS_REGION }} --name ${{ env.CLUSTER_NAME }}
113+ echo "Verifying cluster connection..."
114+ kubectl get nodes
115+
116+ # Image Tag
117+ - name : Compute ref name with short SHA
118+ id : ref-name
119+ if : steps.cluster.outcome == 'success'
120+ run : |
121+ if [[ "${{ github.ref_type }}" == "tag" ]]; then
122+ SAFE_REF="${{ github.ref_name }}"
123+ elif [[ "${{ github.ref_name }}" == "main" ]]; then
124+ SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
125+ SAFE_REF="${{ github.ref_name }}-${SHORT_SHA}"
126+ else
127+ SAFE_REF="${{ env.TEST_TAG }}"
128+ fi
129+ # Sanitize ref name: replace slashes with hyphens for Docker tag compatibility
130+ SAFE_REF=$(echo "$SAFE_REF" | sed 's/\//-/g')
131+ echo "value=$SAFE_REF" >> $GITHUB_OUTPUT
132+
133+ # Apps
134+ - name : Install NVS
135+ id : apps
136+ if : steps.client.outcome == 'success'
137+ shell : bash
138+ env :
139+ NVSENTINEL_VERSION : " ${{ steps.ref-name.outputs.value }}"
140+ run : |
141+ set -euxo pipefail
142+ tests/uat/install-apps.sh
143+
144+ # Test
145+ - name : Run UAT Tests
146+ id : tests
147+ if : steps.apps.outcome == 'success'
148+ shell : bash
149+ run : |
150+ set -euxo pipefail
151+ tests/uat/tests.sh
152+
153+ # Teardown
154+ - name : Destroy Cluster
155+ if : always() && steps.cluster.outcome != 'skipped' && env.SKIP_DELETE != 'true'
156+ shell : bash
157+ run : |
158+ set -euxo pipefail
159+ tests/uat/aws/delete-eks-cluster.sh
160+
161+ # Summary
162+ - name : Test Summary
163+ if : always()
164+ run : |
165+ echo "## Test Results" >> $GITHUB_STEP_SUMMARY
166+ echo "- Cluster: ${{ steps.cluster.outcome }}" >> $GITHUB_STEP_SUMMARY
167+ echo "- Connection: ${{ steps.client.outcome }}" >> $GITHUB_STEP_SUMMARY
168+ echo "- Apps: ${{ steps.apps.outcome }}" >> $GITHUB_STEP_SUMMARY
169+ echo "- Tests: ${{ steps.tests.outcome }}" >> $GITHUB_STEP_SUMMARY
0 commit comments