Aman-Mittal commented on code in PR #29:
URL: 
https://github.com/apache/fineract-business-intelligence/pull/29#discussion_r3549295072


##########
.github/workflows/ci.yml:
##########
@@ -0,0 +1,354 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+name: CI Build & Verification
+
+on:
+  push:
+    branches: [ "**" ]
+  pull_request:
+    branches: [ "main", "develop" ]
+
+concurrency:
+  group: ${{ github.workflow }}-${{ github.event.pull_request.number || 
github.ref }}
+  cancel-in-progress: true
+
+permissions:
+  contents: read
+
+jobs:
+
+  compilation-checks:
+    name: Compile & Lint
+    runs-on: ubuntu-24.04
+    steps:
+      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # 
v7.0.0
+        with:
+          persist-credentials: false
+
+      - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # 
v6.2.0
+        with:
+          python-version: "3.11"
+          cache: "pip"
+          cache-dependency-path: |
+            extractor/requirements.txt
+            dbt/requirements.txt
+
+      - name: Install dependencies
+        run: |
+          pip install -r extractor/requirements.txt
+          pip install -r dbt/requirements.txt
+
+      - name: Python syntax check - extractor
+        run: python -m py_compile extractor/*.py
+
+      - name: Python syntax check - bootstrap
+        run: python -m py_compile docker/superset/bootstrap_superset_assets.py
+
+      - name: Python syntax check - scripts
+        run: python -m py_compile scripts/check_licenses.py
+
+      - name: dbt parse - validate all SQL models and refs (no DB connection)
+        run: |
+          cd dbt
+          dbt parse --profiles-dir . --target local
+
+  integration-test:
+    name: End-to-End Build & Smoke Test
+    runs-on: ubuntu-24.04
+    needs: compilation-checks
+    timeout-minutes: 25
+
+    steps:
+      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # 
v7.0.0
+        with:
+          persist-credentials: false
+
+      - name: Copy env config
+        run: |
+          cp .env.example .env
+          echo "SOURCE_DB_HOST=fineract-db" >> .env
+          echo "SOURCE_DB_HOST_PORT=5432" >> .env
+
+      - name: Remove stale volumes from any previous run
+        run: docker compose down -v --remove-orphans 2>/dev/null || true
+
+      - name: Create external Docker network required by extractor service
+        run: docker network create fineract_default || true
+
+      - name: Build Docker images
+        run: docker compose build
+
+      - name: Start data services
+        run: docker compose up -d fineract-db warehouse extractor dbt
+
+      - name: Wait for fineract-db to be ready
+        run: |
+          for i in $(seq 1 30); do
+            STATUS=$(docker inspect --format='{{.State.Status}}' 
fineract-bi-fineract-db 2>/dev/null || echo "missing")
+            if [ "$STATUS" = "exited" ] || [ "$STATUS" = "dead" ]; then
+              echo "ERROR: fineract-db container exited unexpectedly"
+              docker logs fineract-bi-fineract-db
+              exit 1
+            fi
+            docker exec fineract-bi-fineract-db pg_isready -U root -d postgres 
&& break
+            [ "$i" -eq 30 ] && { echo "ERROR: fineract-db never became ready"; 
docker logs fineract-bi-fineract-db; exit 1; }
+            sleep 3
+          done
+
+      - name: Wait for warehouse to be ready
+        run: |
+          for i in $(seq 1 30); do
+            STATUS=$(docker inspect --format='{{.State.Status}}' 
fineract-bi-warehouse 2>/dev/null || echo "missing")
+            if [ "$STATUS" = "exited" ] || [ "$STATUS" = "dead" ]; then
+              echo "ERROR: warehouse container exited unexpectedly"
+              docker logs fineract-bi-warehouse
+              exit 1
+            fi
+            docker exec fineract-bi-warehouse pg_isready -U analytics_admin -d 
analytics && break
+            [ "$i" -eq 30 ] && { echo "ERROR: warehouse never became ready"; 
docker logs fineract-bi-warehouse; exit 1; }
+            sleep 3
+          done
+
+      - name: Create Fineract schema in source database
+        run: |
+          docker exec -i \

Review Comment:
   Maybe you can reuse this command (Single functon and reuse everywhere)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to