Skip to content

Commit 16b992b

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

File tree

1 file changed

+35
-34
lines changed

1 file changed

+35
-34
lines changed

.github/workflows/test.yaml

Lines changed: 35 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,6 +36,7 @@ jobs:
3636
unit-tests:
3737
name: Unit Tests
3838
runs-on: ubuntu-latest
39+
3940
steps:
4041
- name: Checkout
4142
uses: actions/checkout@v4
@@ -53,14 +54,14 @@ jobs:
5354
uses: actions/upload-artifact@v4
5455
with:
5556
name: unit-test-results
56-
path: /tmp/eks-helm-test-*/test-results.txt
57+
path: /tmp/test-results.txt
5758
if-no-files-found: ignore
5859

5960
integration-tests:
6061
name: Integration Tests
6162
runs-on: ubuntu-latest
6263
needs: unit-tests
63-
64+
6465
strategy:
6566
matrix:
6667
test-scenario:
@@ -101,7 +102,6 @@ jobs:
101102
PRIVATE_CLUSTER: ${{ matrix.test-scenario.private }}
102103
KUBECTL_VERSION: ${{ matrix.test-scenario.kubectl }}
103104
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,13 +110,14 @@ 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="${INPUT_DEBUG}" \
113+
-e INPUT_DEBUG="${{ inputs.debug || 'false' }}" \
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+
120121
steps:
121122
- name: Checkout
122123
uses: actions/checkout@v4
@@ -132,12 +133,12 @@ jobs:
132133
with:
133134
name: validation-report
134135
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+
141142
steps:
142143
- name: Checkout
143144
uses: actions/checkout@v4
@@ -148,7 +149,7 @@ jobs:
148149
cluster-name: test-cluster
149150
region: us-west-2
150151
dry-run: true
151-
debug: ${{ github.event.inputs.debug || false }}
152+
debug: ${{ inputs.debug || false }}
152153
args: |
153154
echo "=== Action Test ==="
154155
kubectl version --client
@@ -162,7 +163,7 @@ jobs:
162163
region: us-east-1
163164
private-cluster: true
164165
dry-run: true
165-
debug: ${{ github.event.inputs.debug || false }}
166+
debug: ${{ inputs.debug || false }}
166167
args: |
167168
echo "=== Private Cluster Test ==="
168169
echo "Private cluster mode enabled"
@@ -172,20 +173,21 @@ jobs:
172173
runs-on: ubuntu-latest
173174
needs: [unit-tests, integration-tests, action-validation, test-action]
174175
if: always()
176+
175177
steps:
176178
- name: Check Test Results
177179
run: |
178180
echo "## 🧪 Test Summary" >> $GITHUB_STEP_SUMMARY
179181
echo "" >> $GITHUB_STEP_SUMMARY
180182
echo "| Test Suite | Status |" >> $GITHUB_STEP_SUMMARY
181183
echo "|------------|--------|" >> $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
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
186188
echo "" >> $GITHUB_STEP_SUMMARY
187-
188-
if [[ "${{ needs.unit-tests.result }}" != "success" || "${{ needs.integration-tests.result }}" != "success" || "${{ needs.action-validation.result }}" != "success" || "${{ needs.test-action.result }}" != "success" ]]; then
189+
190+
if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" ]]; then
189191
echo "❌ **Some tests failed!**" >> $GITHUB_STEP_SUMMARY
190192
exit 1
191193
else
@@ -197,23 +199,22 @@ jobs:
197199
uses: actions/github-script@v7
198200
with:
199201
script: |
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-
});
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+
});

0 commit comments

Comments
 (0)