Skip to content

Commit 1db5818

Browse files
✨ Create required scripts file and other workflow files
1 parent dfc39bb commit 1db5818

File tree

1 file changed

+33
-34
lines changed

1 file changed

+33
-34
lines changed

.github/workflows/test.yaml

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
- '**.md'
1010
- 'docs/**'
1111
- '.github/ISSUE_TEMPLATE/**'
12-
12+
1313
pull_request:
1414
branches: [ main, develop ]
1515
paths-ignore:
@@ -36,7 +36,6 @@ jobs:
3636
unit-tests:
3737
name: Unit Tests
3838
runs-on: ubuntu-latest
39-
4039
steps:
4140
- name: Checkout
4241
uses: actions/checkout@v4
@@ -61,7 +60,7 @@ jobs:
6160
name: Integration Tests
6261
runs-on: ubuntu-latest
6362
needs: unit-tests
64-
63+
6564
strategy:
6665
matrix:
6766
test-scenario:
@@ -102,6 +101,7 @@ jobs:
102101
PRIVATE_CLUSTER: ${{ matrix.test-scenario.private }}
103102
KUBECTL_VERSION: ${{ matrix.test-scenario.kubectl }}
104103
HELM_VERSION: ${{ matrix.test-scenario.helm }}
104+
INPUT_DEBUG: ${{ github.event.inputs.debug || 'false' }}
105105
run: |
106106
docker run --rm \
107107
-e INPUT_CLUSTER_NAME="${TEST_CLUSTER_NAME}" \
@@ -110,14 +110,13 @@ jobs:
110110
-e INPUT_KUBECTL_VERSION="${KUBECTL_VERSION:-}" \
111111
-e INPUT_HELM_VERSION="${HELM_VERSION:-}" \
112112
-e INPUT_DRY_RUN="true" \
113-
-e INPUT_DEBUG="${{ inputs.debug || 'false' }}" \
113+
-e INPUT_DEBUG="${INPUT_DEBUG}" \
114114
-e INPUT_ARGS="echo 'Test: ${{ matrix.test-scenario.name }}'" \
115115
eks-helm-client:test
116116
117117
action-validation:
118118
name: Validate Action
119119
runs-on: ubuntu-latest
120-
121120
steps:
122121
- name: Checkout
123122
uses: actions/checkout@v4
@@ -133,12 +132,12 @@ jobs:
133132
with:
134133
name: validation-report
135134
path: validation-report.txt
135+
if-no-files-found: ignore
136136

137137
test-action:
138138
name: Test Action
139139
runs-on: ubuntu-latest
140140
needs: [unit-tests, integration-tests]
141-
142141
steps:
143142
- name: Checkout
144143
uses: actions/checkout@v4
@@ -149,7 +148,7 @@ jobs:
149148
cluster-name: test-cluster
150149
region: us-west-2
151150
dry-run: true
152-
debug: ${{ inputs.debug || false }}
151+
debug: ${{ github.event.inputs.debug || false }}
153152
args: |
154153
echo "=== Action Test ==="
155154
kubectl version --client
@@ -163,7 +162,7 @@ jobs:
163162
region: us-east-1
164163
private-cluster: true
165164
dry-run: true
166-
debug: ${{ inputs.debug || false }}
165+
debug: ${{ github.event.inputs.debug || false }}
167166
args: |
168167
echo "=== Private Cluster Test ==="
169168
echo "Private cluster mode enabled"
@@ -173,21 +172,20 @@ jobs:
173172
runs-on: ubuntu-latest
174173
needs: [unit-tests, integration-tests, action-validation, test-action]
175174
if: always()
176-
177175
steps:
178176
- name: Check Test Results
179177
run: |
180178
echo "## 🧪 Test Summary" >> $GITHUB_STEP_SUMMARY
181179
echo "" >> $GITHUB_STEP_SUMMARY
182180
echo "| Test Suite | Status |" >> $GITHUB_STEP_SUMMARY
183181
echo "|------------|--------|" >> $GITHUB_STEP_SUMMARY
184-
echo "| Unit Tests | ${{ needs.unit-tests.result == 'success' && '✅ Passed' || '❌ Failed' }} |" >> $GITHUB_STEP_SUMMARY
185-
echo "| Integration Tests | ${{ needs.integration-tests.result == 'success' && '✅ Passed' || '❌ Failed' }} |" >> $GITHUB_STEP_SUMMARY
186-
echo "| Action Validation | ${{ needs.action-validation.result == 'success' && '✅ Passed' || '❌ Failed' }} |" >> $GITHUB_STEP_SUMMARY
187-
echo "| Action Test | ${{ needs.test-action.result == 'success' && '✅ Passed' || '❌ Failed' }} |" >> $GITHUB_STEP_SUMMARY
182+
echo "| Unit Tests | $([[ '${{ needs.unit-tests.result }}' == 'success' ]] && echo '✅ Passed' || echo '❌ Failed') |" >> $GITHUB_STEP_SUMMARY
183+
echo "| Integration Tests | $([[ '${{ needs.integration-tests.result }}' == 'success' ]] && echo '✅ Passed' || echo '❌ Failed') |" >> $GITHUB_STEP_SUMMARY
184+
echo "| Action Validation | $([[ '${{ needs.action-validation.result }}' == 'success' ]] && echo '✅ Passed' || echo '❌ Failed') |" >> $GITHUB_STEP_SUMMARY
185+
echo "| Action Test | $([[ '${{ needs.test-action.result }}' == 'success' ]] && echo '✅ Passed' || echo '❌ Failed') |" >> $GITHUB_STEP_SUMMARY
188186
echo "" >> $GITHUB_STEP_SUMMARY
189-
190-
if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" ]]; then
187+
188+
if [[ "${{ needs.unit-tests.result }}" != "success" || "${{ needs.integration-tests.result }}" != "success" || "${{ needs.action-validation.result }}" != "success" || "${{ needs.test-action.result }}" != "success" ]]; then
191189
echo "❌ **Some tests failed!**" >> $GITHUB_STEP_SUMMARY
192190
exit 1
193191
else
@@ -199,22 +197,23 @@ jobs:
199197
uses: actions/github-script@v7
200198
with:
201199
script: |
202-
const summary = `## 🧪 Test Results
203-
204-
| Test Suite | Status |
205-
|------------|--------|
206-
| Unit Tests | ${{ needs.unit-tests.result == 'success' && '✅ Passed' || '❌ Failed' }} |
207-
| Integration Tests | ${{ needs.integration-tests.result == 'success' && '✅ Passed' || '❌ Failed' }} |
208-
| Action Validation | ${{ needs.action-validation.result == 'success' && '✅ Passed' || '❌ Failed' }} |
209-
| Action Test | ${{ needs.test-action.result == 'success' && '✅ Passed' || '❌ Failed' }} |
210-
211-
**Commit**: ${{ github.event.pull_request.head.sha || github.sha }}
212-
**Workflow**: [Run #${{ github.run_number }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
213-
`;
214-
215-
github.rest.issues.createComment({
216-
issue_number: context.issue.number,
217-
owner: context.repo.owner,
218-
repo: context.repo.repo,
219-
body: summary
220-
});
200+
const summary = `
201+
## 🧪 Test Results
202+
203+
| Test Suite | Status |
204+
|--------------------|---------------|
205+
| Unit Tests | ${{ needs.unit-tests.result == 'success' ? '✅ Passed' : '❌ Failed' }} |
206+
| Integration Tests | ${{ needs.integration-tests.result == 'success' ? '✅ Passed' : '❌ Failed' }} |
207+
| Action Validation | ${{ needs.action-validation.result == 'success' ? '✅ Passed' : '❌ Failed' }} |
208+
| Action Test | ${{ needs.test-action.result == 'success' ? '✅ Passed' : '❌ Failed' }} |
209+
210+
**Commit**: ${{ github.event.pull_request.head.sha || github.sha }}
211+
**Workflow**: [Run #${{ github.run_number }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
212+
`;
213+
214+
github.rest.issues.createComment({
215+
issue_number: context.issue.number,
216+
owner: context.repo.owner,
217+
repo: context.repo.repo,
218+
body: summary
219+
});

0 commit comments

Comments
 (0)