From d9a2c9399af4e472547c692fc8bfe32c5fde0a05 Mon Sep 17 00:00:00 2001 From: Aravindan M <83415736+aravindan888@users.noreply.github.com> Date: Sat, 6 Sep 2025 23:57:12 +0530 Subject: [PATCH 01/10] Create ci.yml --- .github/ci.yml | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/ci.yml diff --git a/.github/ci.yml b/.github/ci.yml new file mode 100644 index 0000000..48724ca --- /dev/null +++ b/.github/ci.yml @@ -0,0 +1,47 @@ +name: CI + +on: + pull_request: + push: + branches: [ master ] + +jobs: + test: + name: Run Tests & Build + runs-on: ubuntu-latest + + services: + mariadb: + image: mariadb:latest + env: + MYSQL_USER: worlddriven + MYSQL_PASSWORD: password + MYSQL_DATABASE: worlddriven + ports: + - 3306:3306 + options: >- + --health-cmd="mysqladmin ping -h localhost" + --health-interval=10s + --health-timeout=5s + --health-retries=5 + + env: + JAWSDB_MARIA_URL: mysql://worlddriven:password@127.0.0.1/worlddriven + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' # Modern Node.js (PR #265 upgrade) + + - name: Install dependencies + run: npm install + + - name: Run tests + run: npm test + + - name: Build project + run: npm run build From 24493712275b46725d96605922fb2cd78c462c4b Mon Sep 17 00:00:00 2001 From: Aravindan M <83415736+aravindan888@users.noreply.github.com> Date: Sun, 7 Sep 2025 00:03:57 +0530 Subject: [PATCH 02/10] Update ci.yml manual trigger --- .github/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/ci.yml b/.github/ci.yml index 48724ca..3b0971e 100644 --- a/.github/ci.yml +++ b/.github/ci.yml @@ -4,6 +4,7 @@ on: pull_request: push: branches: [ master ] + workflow_dispatch: jobs: test: From ecb74d114b17c8d5099e05cb752d0324a74f377a Mon Sep 17 00:00:00 2001 From: Aravindan M <83415736+aravindan888@users.noreply.github.com> Date: Sun, 7 Sep 2025 00:05:15 +0530 Subject: [PATCH 03/10] Rename .github/ci.yml to .github/workflows/ci.yml --- .github/{ => workflows}/ci.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{ => workflows}/ci.yml (100%) diff --git a/.github/ci.yml b/.github/workflows/ci.yml similarity index 100% rename from .github/ci.yml rename to .github/workflows/ci.yml From 59a9e567954460f2f7d7e2d1959a1b8c840c5c32 Mon Sep 17 00:00:00 2001 From: Aravindan M <83415736+aravindan888@users.noreply.github.com> Date: Sun, 7 Sep 2025 00:08:57 +0530 Subject: [PATCH 04/10] Update ci.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added MYSQL_ROOT_PASSWORD: root → required. Pinned to mariadb:10.5 instead of :latest → avoids breaking changes. Improved --health-cmd with credentials → mysqladmin ping -h 127.0.0.1 -uroot -proot. Added an explicit wait-for-DB step before tests. --- .github/workflows/ci.yml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3b0971e..74a8906 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,15 +13,16 @@ jobs: services: mariadb: - image: mariadb:latest + image: mariadb:10.5 # stable version env: + MYSQL_ROOT_PASSWORD: root MYSQL_USER: worlddriven MYSQL_PASSWORD: password MYSQL_DATABASE: worlddriven ports: - 3306:3306 options: >- - --health-cmd="mysqladmin ping -h localhost" + --health-cmd="mysqladmin ping -h 127.0.0.1 -uroot -proot" --health-interval=10s --health-timeout=5s --health-retries=5 @@ -36,7 +37,19 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '20' # Modern Node.js (PR #265 upgrade) + node-version: '20' + + - name: Wait for MariaDB + run: | + echo "Waiting for MariaDB to be ready..." + for i in {1..30}; do + if mysql -h 127.0.0.1 -uroot -proot -e "SELECT 1;" &> /dev/null; then + echo "MariaDB is up!" + break + fi + echo "Still waiting... ($i)" + sleep 2 + done - name: Install dependencies run: npm install From 96a30071c313454bcfe5dad1c370401d86bba2e7 Mon Sep 17 00:00:00 2001 From: Aravindan M <83415736+aravindan888@users.noreply.github.com> Date: Sun, 7 Sep 2025 11:40:06 +0530 Subject: [PATCH 05/10] Update ci.yml Changed the CI workflow from MariaDB to MongoDB, using MONGO_URL with the worlddriven_test database to match the migration in PR #265 --- .github/workflows/ci.yml | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 74a8906..e285459 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,23 +12,18 @@ jobs: runs-on: ubuntu-latest services: - mariadb: - image: mariadb:10.5 # stable version - env: - MYSQL_ROOT_PASSWORD: root - MYSQL_USER: worlddriven - MYSQL_PASSWORD: password - MYSQL_DATABASE: worlddriven + mongodb: + image: mongo:6.0 ports: - - 3306:3306 + - 27017:27017 options: >- - --health-cmd="mysqladmin ping -h 127.0.0.1 -uroot -proot" + --health-cmd="mongosh --eval 'db.adminCommand(\"ping\")'" --health-interval=10s --health-timeout=5s --health-retries=5 env: - JAWSDB_MARIA_URL: mysql://worlddriven:password@127.0.0.1/worlddriven + MONGO_URL: mongodb://127.0.0.1:27017/worlddriven_test steps: - name: Checkout repository @@ -39,23 +34,10 @@ jobs: with: node-version: '20' - - name: Wait for MariaDB - run: | - echo "Waiting for MariaDB to be ready..." - for i in {1..30}; do - if mysql -h 127.0.0.1 -uroot -proot -e "SELECT 1;" &> /dev/null; then - echo "MariaDB is up!" - break - fi - echo "Still waiting... ($i)" - sleep 2 - done - - name: Install dependencies run: npm install - name: Run tests run: npm test - - name: Build project run: npm run build From 0749e7eeb3d825a077e23df84f753e4000efb43a Mon Sep 17 00:00:00 2001 From: Aravindan M <83415736+aravindan888@users.noreply.github.com> Date: Wed, 10 Sep 2025 11:41:02 +0530 Subject: [PATCH 06/10] Update package.json prettier script --- package.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index b800abc..541249e 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,11 @@ "lint:frontend": "eslint static/js --config frontend.eslint.config.cjs --report-unused-disable-directives --max-warnings 0", "start": "node src/index.js", "test": "npm run check && sort-package-json package.json --check && mdspell --en-us --ignore-numbers --report \"*.md\" && write-good --no-adverb README.md CONTRIBUTING.md" - }, + + "scripts": { + "format": "prettier --write .", + "check": "prettier --check . && npm run lint" +}, "dependencies": { "connect-mongo": "5.1.0", "express": "4.21.2", From d4151a5914b65d4689a9f63babc56e5d9f26687d Mon Sep 17 00:00:00 2001 From: Aravindan M <83415736+aravindan888@users.noreply.github.com> Date: Wed, 10 Sep 2025 11:44:45 +0530 Subject: [PATCH 07/10] Update package.json --- package.json | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 541249e..022557f 100644 --- a/package.json +++ b/package.json @@ -25,12 +25,9 @@ "lint": "eslint . --report-unused-disable-directives --max-warnings 0", "lint:frontend": "eslint static/js --config frontend.eslint.config.cjs --report-unused-disable-directives --max-warnings 0", "start": "node src/index.js", - "test": "npm run check && sort-package-json package.json --check && mdspell --en-us --ignore-numbers --report \"*.md\" && write-good --no-adverb README.md CONTRIBUTING.md" - - "scripts": { - "format": "prettier --write .", - "check": "prettier --check . && npm run lint" -}, + "test": "npm run check && sort-package-json package.json --check && mdspell --en-us --ignore-numbers --report \"*.md\" && write-good --no-adverb README.md CONTRIBUTING.md", + "format": "prettier --write ." + }, "dependencies": { "connect-mongo": "5.1.0", "express": "4.21.2", From 4af9fe3f69209427615d039c4a46126d76377c9d Mon Sep 17 00:00:00 2001 From: Aravindan M <83415736+aravindan888@users.noreply.github.com> Date: Wed, 10 Sep 2025 11:48:55 +0530 Subject: [PATCH 08/10] Update package.json From e5fa2ae90ac07ea6361934a86ddce1c7d18dd91b Mon Sep 17 00:00:00 2001 From: Aravindan M <83415736+aravindan888@users.noreply.github.com> Date: Wed, 10 Sep 2025 11:58:42 +0530 Subject: [PATCH 09/10] Update ci.yml --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e285459..66b4911 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,6 +37,10 @@ jobs: - name: Install dependencies run: npm install + - name: Auto format with Prettier + run: npm run format + + - name: Run tests run: npm test - name: Build project From 99cfd3a553531cf402b8008e2e031ff665018dc9 Mon Sep 17 00:00:00 2001 From: Aravindan M <83415736+aravindan888@users.noreply.github.com> Date: Wed, 10 Sep 2025 12:08:23 +0530 Subject: [PATCH 10/10] Update ci.yml --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 66b4911..9c22a4d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,6 +33,7 @@ jobs: uses: actions/setup-node@v4 with: node-version: '20' + cache: 'npm' - name: Install dependencies run: npm install @@ -40,8 +41,8 @@ jobs: - name: Auto format with Prettier run: npm run format - - name: Run tests run: npm test + - name: Build project run: npm run build