Skip to content

Commit e2f2bf6

Browse files
committed
Consolidated CI tasks into a streamlined node.js.yml workflow with Docker Compose tests integrated
- Deleted `.github/workflows/docker-compose.yml` along with its associated CI configuration. - Updated `README.md` to reflect the removal of the Docker Compose workflow. - Added `validate-ci.sh` script for local workflow validation and testing. - Introduced `GITHUB_ACTIONS.md` with detailed documentation on CI/CD processes and workflows.
1 parent ad49f97 commit e2f2bf6

5 files changed

Lines changed: 661 additions & 139 deletions

File tree

.github/workflows/docker-compose.yml

Lines changed: 0 additions & 133 deletions
This file was deleted.

.github/workflows/node.js.yml

Lines changed: 64 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,24 @@ jobs:
2020
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
2121

2222
steps:
23-
- uses: actions/checkout@v4
23+
- name: Checkout code
24+
uses: actions/checkout@v4
25+
2426
- name: Use Node.js ${{ matrix.node-version }}
2527
uses: actions/setup-node@v4
2628
with:
2729
node-version: ${{ matrix.node-version }}
2830
cache: 'npm'
29-
- run: npm ci
30-
- run: npm run build --if-present
31-
- name: Run tests with coverage
31+
32+
- name: Install dependencies
33+
run: npm ci
34+
35+
- name: Build project
36+
run: npm run build --if-present
37+
38+
- name: Run unit tests with coverage
3239
run: npm run test:coverage
40+
3341
- name: Upload coverage to Codecov
3442
uses: codecov/codecov-action@v5
3543
with:
@@ -38,3 +46,55 @@ jobs:
3846
flags: unittests
3947
name: codecov
4048
fail_ci_if_error: true
49+
50+
docker-compose-tests:
51+
runs-on: ubuntu-24.04
52+
needs: build
53+
54+
strategy:
55+
matrix:
56+
database: [couchdb, mongodb]
57+
fail-fast: false
58+
59+
steps:
60+
- name: Checkout code
61+
uses: actions/checkout@v4
62+
63+
- name: Set up Docker Buildx
64+
uses: docker/setup-buildx-action@v3
65+
66+
- name: Configure test credentials
67+
run: |
68+
case "${{ matrix.database }}" in
69+
couchdb)
70+
echo "COUCHDB_USERNAME=ci_test_admin" >> $GITHUB_ENV
71+
echo "COUCHDB_PASSWORD=ci_test_$(openssl rand -hex 12)" >> $GITHUB_ENV
72+
echo "COUCHDB_DATABASE=ci_test_notes" >> $GITHUB_ENV
73+
;;
74+
mongodb)
75+
echo "MONGODB_USERNAME=ci_test_user" >> $GITHUB_ENV
76+
echo "MONGODB_PASSWORD=ci_test_$(openssl rand -hex 12)" >> $GITHUB_ENV
77+
echo "MONGODB_DATABASE=ci_test_notes" >> $GITHUB_ENV
78+
;;
79+
esac
80+
81+
- name: Make test script executable
82+
run: chmod +x test-docker-setups.sh
83+
84+
- name: Test ${{ matrix.database }} setup
85+
timeout-minutes: 8
86+
run: |
87+
echo "🚀 Testing ${{ matrix.database }} setup..."
88+
./test-docker-setups.sh ${{ matrix.database }}
89+
90+
- name: Show logs on failure
91+
if: failure()
92+
run: |
93+
echo "=== Container logs ==="
94+
docker compose -f docker-compose.${{ matrix.database }}.yml logs || true
95+
96+
- name: Cleanup
97+
if: always()
98+
run: |
99+
docker compose -f docker-compose.${{ matrix.database }}.yml down -v || true
100+
docker system prune -f || true

0 commit comments

Comments
 (0)