Skip to content

Commit 968ce7e

Browse files
authored
Merge pull request #33 from Visitha2001/development
Development
2 parents b1f8cd7 + 5d88367 commit 968ce7e

33 files changed

Lines changed: 234 additions & 30 deletions
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Docker Build and Push
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
env:
9+
REGISTRY: docker.io
10+
IMAGE_NAME: acquisitions
11+
12+
jobs:
13+
build-and-push:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Docker Buildx
21+
uses: docker/setup-buildx-action@v3
22+
23+
- name: Log in to Docker Hub
24+
uses: docker/login-action@v3
25+
with:
26+
registry: ${{ env.REGISTRY }}
27+
username: ${{ secrets.DOCKER_USERNAME }}
28+
password: ${{ secrets.DOCKER_PASSWORD }}
29+
30+
- name: Extract metadata
31+
id: meta
32+
uses: docker/metadata-action@v5
33+
with:
34+
images: ${{ env.REGISTRY }}/${{ secrets.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}
35+
tags: |
36+
type=ref,event=branch
37+
type=sha,prefix={{branch}}-
38+
type=raw,value=latest,enable={{is_default_branch}}
39+
type=raw,value=prod-{{date 'YYYYMMDD-HHmmss'}}
40+
labels: |
41+
org.opencontainers.image.title=${{ env.IMAGE_NAME }}
42+
org.opencontainers.image.description=Acquisitions backend application
43+
org.opencontainers.image.vendor=DevOps HandsOn
44+
45+
- name: Build and push Docker image
46+
id: build
47+
uses: docker/build-push-action@v5
48+
with:
49+
context: .
50+
platforms: linux/amd64,linux/arm64
51+
push: true
52+
tags: ${{ steps.meta.outputs.tags }}
53+
labels: ${{ steps.meta.outputs.labels }}
54+
cache-from: type=gha
55+
cache-to: type=gha,mode=max
56+
57+
- name: Generate summary
58+
run: |
59+
echo "🐳 **Docker Image Published Successfully!**" >> $GITHUB_STEP_SUMMARY
60+
echo "" >> $GITHUB_STEP_SUMMARY
61+
echo "**Repository:** ${{ env.REGISTRY }}/${{ secrets.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}" >> $GITHUB_STEP_SUMMARY
62+
echo "" >> $GITHUB_STEP_SUMMARY
63+
echo "**Published Tags:**" >> $GITHUB_STEP_SUMMARY
64+
echo '${{ steps.meta.outputs.tags }}' | while read -r tag; do
65+
if [ -n "$tag" ]; then
66+
echo "- \`$tag\`" >> $GITHUB_STEP_SUMMARY
67+
fi
68+
done
69+
echo "" >> $GITHUB_STEP_SUMMARY
70+
echo "**Platforms:** linux/amd64, linux/arm64" >> $GITHUB_STEP_SUMMARY
71+
echo "" >> $GITHUB_STEP_SUMMARY
72+
echo "**Image Digest:** \`${{ steps.build.outputs.digest }}\`" >> $GITHUB_STEP_SUMMARY
73+
echo "" >> $GITHUB_STEP_SUMMARY
74+
echo "**Pull Command:**" >> $GITHUB_STEP_SUMMARY
75+
echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY
76+
echo "docker pull ${{ env.REGISTRY }}/${{ secrets.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}:latest" >> $GITHUB_STEP_SUMMARY
77+
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Lint and Format
2+
3+
on:
4+
push:
5+
branches: [main, staging]
6+
pull_request:
7+
branches: [main, staging]
8+
9+
jobs:
10+
lint-and-format:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Setup Node.js
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: '20.x'
21+
cache: 'npm'
22+
23+
- name: Install dependencies
24+
run: npm ci
25+
26+
- name: Run ESLint
27+
run: |
28+
echo "Running ESLint..."
29+
if ! npm run lint; then
30+
echo "::error title=ESLint Issues Found::ESLint found issues. Run 'npm run lint:fix' to automatically fix some issues."
31+
exit 1
32+
fi
33+
34+
- name: Run Prettier Check
35+
run: |
36+
echo "Checking code formatting with Prettier..."
37+
if ! npm run format:check; then
38+
echo "::error title=Code Formatting Issues::Code formatting issues found. Run 'npm run format' to fix formatting."
39+
exit 1
40+
fi
41+
42+
- name: Success Summary
43+
if: success()
44+
run: |
45+
echo "✅ All linting and formatting checks passed!" >> $GITHUB_STEP_SUMMARY
46+
echo "" >> $GITHUB_STEP_SUMMARY
47+
echo "- ESLint: No issues found" >> $GITHUB_STEP_SUMMARY
48+
echo "- Prettier: Code formatting is correct" >> $GITHUB_STEP_SUMMARY

.github/workflows/tests.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [main, staging]
6+
pull_request:
7+
branches: [main, staging]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
env:
14+
NODE_ENV: test
15+
NODE_OPTIONS: --experimental-vm-modules
16+
DATABASE_URL: postgresql://test:test@localhost:5432/acquisitions_test
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: '20.x'
26+
cache: 'npm'
27+
28+
- name: Install dependencies
29+
run: npm ci
30+
31+
- name: Run tests
32+
id: run-tests
33+
run: |
34+
echo "Running tests..."
35+
if npm test; then
36+
echo "test_status=success" >> $GITHUB_OUTPUT
37+
echo "✅ All tests passed!" >> $GITHUB_STEP_SUMMARY
38+
else
39+
echo "test_status=failed" >> $GITHUB_OUTPUT
40+
echo "❌ Some tests failed!" >> $GITHUB_STEP_SUMMARY
41+
echo "::error title=Test Failures::Some tests failed. Check the logs above for details."
42+
exit 1
43+
fi
44+
45+
- name: Upload coverage reports
46+
uses: actions/upload-artifact@v4
47+
if: always()
48+
with:
49+
name: coverage-reports
50+
path: coverage/
51+
retention-days: 30
52+
53+
- name: Generate test summary
54+
if: always()
55+
run: |
56+
echo "" >> $GITHUB_STEP_SUMMARY
57+
echo "## Test Results" >> $GITHUB_STEP_SUMMARY
58+
echo "" >> $GITHUB_STEP_SUMMARY
59+
60+
if [ -f "coverage/lcov.info" ]; then
61+
echo "📊 **Coverage Report Available**" >> $GITHUB_STEP_SUMMARY
62+
echo "Coverage reports have been uploaded as artifacts." >> $GITHUB_STEP_SUMMARY
63+
fi
64+
65+
echo "" >> $GITHUB_STEP_SUMMARY
66+
echo "**Environment Variables:**" >> $GITHUB_STEP_SUMMARY
67+
echo "- NODE_ENV: $NODE_ENV" >> $GITHUB_STEP_SUMMARY
68+
echo "- NODE_OPTIONS: $NODE_OPTIONS" >> $GITHUB_STEP_SUMMARY
69+
echo "- DATABASE_URL: [configured]" >> $GITHUB_STEP_SUMMARY
70+
71+
if [ "${{ steps.run-tests.outputs.test_status }}" = "failed" ]; then
72+
echo "" >> $GITHUB_STEP_SUMMARY
73+
echo "⚠️ **Action Required:** Fix the failing tests before merging." >> $GITHUB_STEP_SUMMARY
74+
fi

coverage/clover.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<coverage generated="1758451119690" clover="3.2.0">
3-
<project timestamp="1758451119690" name="All files">
2+
<coverage generated="1758452213981" clover="3.2.0">
3+
<project timestamp="1758452213982" name="All files">
44
<metrics statements="727" coveredstatements="281" conditionals="17" coveredconditionals="5" methods="28" coveredmethods="2" elements="772" coveredelements="288" complexity="0" loc="727" ncloc="727" packages="9" files="18" classes="18"/>
55
<package name="src">
66
<metrics statements="42" coveredstatements="42" conditionals="4" coveredconditionals="4" methods="1" coveredmethods="1"/>

coverage/lcov-report/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ <h1>All files</h1>
221221
<div class='footer quiet pad2 space-top1 center small'>
222222
Code coverage generated by
223223
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
224-
at 2025-09-21T10:38:39.623Z
224+
at 2025-09-21T10:56:53.892Z
225225
</div>
226226
<script src="prettify.js"></script>
227227
<script>

coverage/lcov-report/src/App.js.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ <h1><a href="../index.html">All files</a> / <a href="index.html">src</a> App.js<
193193
<div class='footer quiet pad2 space-top1 center small'>
194194
Code coverage generated by
195195
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
196-
at 2025-09-21T10:38:39.623Z
196+
at 2025-09-21T10:56:53.892Z
197197
</div>
198198
<script src="../prettify.js"></script>
199199
<script>

coverage/lcov-report/src/config/arcjet.js.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">src/config</
136136
<div class='footer quiet pad2 space-top1 center small'>
137137
Code coverage generated by
138138
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
139-
at 2025-09-21T10:38:39.623Z
139+
at 2025-09-21T10:56:53.892Z
140140
</div>
141141
<script src="../../prettify.js"></script>
142142
<script>

coverage/lcov-report/src/config/database.js.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">src/config</
115115
<div class='footer quiet pad2 space-top1 center small'>
116116
Code coverage generated by
117117
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
118-
at 2025-09-21T10:38:39.623Z
118+
at 2025-09-21T10:56:53.892Z
119119
</div>
120120
<script src="../../prettify.js"></script>
121121
<script>

coverage/lcov-report/src/config/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ <h1><a href="../../index.html">All files</a> src/config</h1>
131131
<div class='footer quiet pad2 space-top1 center small'>
132132
Code coverage generated by
133133
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
134-
at 2025-09-21T10:38:39.623Z
134+
at 2025-09-21T10:56:53.892Z
135135
</div>
136136
<script src="../../prettify.js"></script>
137137
<script>

coverage/lcov-report/src/config/logger.js.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">src/config</
151151
<div class='footer quiet pad2 space-top1 center small'>
152152
Code coverage generated by
153153
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
154-
at 2025-09-21T10:38:39.623Z
154+
at 2025-09-21T10:56:53.892Z
155155
</div>
156156
<script src="../../prettify.js"></script>
157157
<script>

0 commit comments

Comments
 (0)