Skip to content

Commit 4b7c14a

Browse files
✨ Create required scripts file and other workflow files
1 parent 67aff57 commit 4b7c14a

File tree

2 files changed

+28
-50
lines changed

2 files changed

+28
-50
lines changed

β€Ž.github/workflows/security.yamlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Security
22

33
on:
44
push:
5-
branches: [ main, develop ]
5+
branches: [ main ]
66
tags:
77
- 'v*.*.*'
88
pull_request:

β€Ž.github/workflows/test.yamlβ€Ž

Lines changed: 27 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ permissions:
3131
env:
3232
DOCKER_BUILDKIT: 1
3333
COMPOSE_DOCKER_CLI_BUILD: 1
34+
DOCKER_IMAGE_TAG: "eks-helm-client:test" # Define image tag for all jobs
3435

3536
jobs:
3637
unit-tests:
@@ -41,16 +42,16 @@ jobs:
4142
- name: Checkout
4243
uses: actions/checkout@v4
4344

44-
- name: Setup Scripts
45+
- name: Make scripts executable
46+
# It's best practice to set executable permissions in your Git repository.
47+
# This step ensures they are executable if not already set.
4548
run: |
4649
chmod +x .github/scripts/testing/*.sh
4750
chmod +x scripts/*.sh
4851
4952
- name: Run Unit Tests
50-
# run: .github/scripts/testing/run-unit-tests.sh
51-
run: |
52-
bash .github/scripts/testing/run-unit-tests.sh || true
53-
cat /tmp/eks-helm-test-*/test-results.txt || echo "No test results found"
53+
# CRITICAL FIX: Removed '|| true' to ensure the workflow fails if tests fail.
54+
run: bash .github/scripts/testing/run-unit-tests.sh
5455

5556
- name: Upload Test Results
5657
if: always()
@@ -65,22 +66,6 @@ jobs:
6566
runs-on: ubuntu-latest
6667
needs: unit-tests
6768

68-
strategy:
69-
matrix:
70-
test-scenario:
71-
- name: "Basic"
72-
cluster: "test-cluster"
73-
region: "us-west-2"
74-
- name: "Private Cluster"
75-
cluster: "private-cluster"
76-
region: "us-east-1"
77-
private: "true"
78-
- name: "Custom Versions"
79-
cluster: "version-test"
80-
region: "eu-west-1"
81-
kubectl: "1.27.1"
82-
helm: "3.12.0"
83-
8469
steps:
8570
- name: Checkout
8671
uses: actions/checkout@v4
@@ -94,28 +79,14 @@ jobs:
9479
context: .
9580
push: false
9681
load: true
97-
tags: eks-helm-client:test
82+
tags: ${{ env.DOCKER_IMAGE_TAG }}
9883
cache-from: type=gha
9984
cache-to: type=gha,mode=max
10085

101-
- name: Run Integration Test - ${{ matrix.test-scenario.name }}
102-
env:
103-
TEST_CLUSTER_NAME: ${{ matrix.test-scenario.cluster }}
104-
TEST_REGION: ${{ matrix.test-scenario.region }}
105-
PRIVATE_CLUSTER: ${{ matrix.test-scenario.private }}
106-
KUBECTL_VERSION: ${{ matrix.test-scenario.kubectl }}
107-
HELM_VERSION: ${{ matrix.test-scenario.helm }}
108-
run: |
109-
docker run --rm \
110-
-e INPUT_CLUSTER_NAME="${TEST_CLUSTER_NAME}" \
111-
-e INPUT_REGION="${TEST_REGION}" \
112-
-e INPUT_PRIVATE_CLUSTER="${PRIVATE_CLUSTER:-false}" \
113-
-e INPUT_KUBECTL_VERSION="${KUBECTL_VERSION:-}" \
114-
-e INPUT_HELM_VERSION="${HELM_VERSION:-}" \
115-
-e INPUT_DRY_RUN="true" \
116-
-e INPUT_DEBUG="${{ inputs.debug || 'false' }}" \
117-
-e INPUT_ARGS="echo 'Test: ${{ matrix.test-scenario.name }}'" \
118-
eks-helm-client:test
86+
- name: Run Integration Tests
87+
# CORRECTION: This now runs the actual integration test script.
88+
# The previous matrix only ran a simple 'echo' command inside the container.
89+
run: .github/scripts/testing/run-integration-tests.sh
11990

12091
action-validation:
12192
name: Validate Action
@@ -125,10 +96,11 @@ jobs:
12596
- name: Checkout
12697
uses: actions/checkout@v4
12798

99+
- name: Make validation script executable
100+
run: chmod +x .github/scripts/testing/validate-action.sh
101+
128102
- name: Validate Action Configuration
129-
run: |
130-
chmod +x .github/scripts/testing/validate-action.sh
131-
.github/scripts/testing/validate-action.sh
103+
run: .github/scripts/testing/validate-action.sh
132104

133105
- name: Upload Validation Report
134106
if: always()
@@ -178,7 +150,8 @@ jobs:
178150
if: always()
179151

180152
steps:
181-
- name: Check Test Results
153+
- name: Generate Job Summary
154+
id: summary
182155
run: |
183156
echo "## πŸ§ͺ Test Summary" >> $GITHUB_STEP_SUMMARY
184157
echo "" >> $GITHUB_STEP_SUMMARY
@@ -189,15 +162,20 @@ jobs:
189162
echo "| Action Validation | ${{ needs.action-validation.result == 'success' && 'βœ… Passed' || '❌ Failed' }} |" >> $GITHUB_STEP_SUMMARY
190163
echo "| Action Test | ${{ needs.test-action.result == 'success' && 'βœ… Passed' || '❌ Failed' }} |" >> $GITHUB_STEP_SUMMARY
191164
echo "" >> $GITHUB_STEP_SUMMARY
192-
193-
if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" ]]; then
165+
166+
if [[ "${{ needs.unit-tests.result }}" != "success" || "${{ needs.integration-tests.result }}" != "success" || "${{ needs.action-validation.result }}" != "success" || "${{ needs.test-action.result }}" != "success" ]]; then
167+
echo "status=failure" >> $GITHUB_OUTPUT
194168
echo "❌ **Some tests failed!**" >> $GITHUB_STEP_SUMMARY
195-
exit 1
196169
else
170+
echo "status=success" >> $GITHUB_OUTPUT
197171
echo "βœ… **All tests passed!**" >> $GITHUB_STEP_SUMMARY
198172
fi
199173
200-
- name: Comment PR
174+
- name: Fail workflow on test failure
175+
if: steps.summary.outputs.status == 'failure'
176+
run: exit 1
177+
178+
- name: Comment on PR
201179
if: github.event_name == 'pull_request'
202180
uses: actions/github-script@v7
203181
with:
@@ -211,7 +189,7 @@ jobs:
211189
| Action Validation | ${{ needs.action-validation.result == 'success' && 'βœ… Passed' || '❌ Failed' }} |
212190
| Action Test | ${{ needs.test-action.result == 'success' && 'βœ… Passed' || '❌ Failed' }} |
213191
214-
**Commit**: ${{ github.event.pull_request.head.sha || github.sha }}
192+
**Commit**: \`${{ github.event.pull_request.head.sha || github.sha }}\`
215193
**Workflow**: [Run #${{ github.run_number }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
216194
`;
217195

0 commit comments

Comments
Β (0)