Skip to content

Commit

Permalink
ci/cd: foundation work for mongo-db action
Browse files Browse the repository at this point in the history
  • Loading branch information
HendrixString committed Jan 13, 2025
1 parent df699eb commit c021e41
Show file tree
Hide file tree
Showing 51 changed files with 77 additions and 38 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/test.database-mongodb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: MongoDB
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]


jobs:

test-mongodb:
name: Test MongoDB
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [22.x]
services:
mongodb:
image: mongo
env:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: password
MONGO_INITDB_DATABASE: test
options: >-
--health-cmd mongo
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 27017:27017

steps:
- name: Check out repository code
uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- name: Install dependencies
working-directory: ./packages/databases/database-mongodb
run: npm ci

- name: Test
run: npm test
working-directory: ./packages/databases/database-mongodb
env:
# The hostname used to communicate with the mysql service container
MONGODB_NAME: test
MONGODB_URL: mongodb+srv://root:password@localhost:27017/?retryWrites=true&w=majority
2 changes: 1 addition & 1 deletion packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
width='90%' />
</div><hr/><br/>

[![Test Core Package](https://github.com/store-craft/storecraft/actions/workflows/test.core.yml/badge.svg)](https://github.com/store-craft/storecraft/actions/workflows/test.core.yml)
[![Core](https://github.com/store-craft/storecraft/actions/workflows/test.core.yml/badge.svg)](https://github.com/store-craft/storecraft/actions/workflows/test.core.yml)

This package has
- core App
Expand Down
1 change: 0 additions & 1 deletion packages/core/test-runner/api/auth.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'dotenv/config';
import { suite } from 'uvu';
import * as assert from 'uvu/assert';
import { file_name } from './api.utils.crud.js';
Expand Down
1 change: 0 additions & 1 deletion packages/core/test-runner/api/checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*
*/

import 'dotenv/config';
import { suite } from 'uvu';
import * as assert from 'uvu/assert';
import { enums } from '../../api/index.js';
Expand Down
1 change: 0 additions & 1 deletion packages/core/test-runner/api/collections_crud.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*
*/

import 'dotenv/config';
import { suite } from 'uvu';
import * as assert from 'uvu/assert';
import { add_sanity_crud_to_test_suite,
Expand Down
1 change: 0 additions & 1 deletion packages/core/test-runner/api/collections_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*
*/

import 'dotenv/config';
import { suite } from 'uvu';
import * as assert from 'uvu/assert';
import { create_handle, file_name,
Expand Down
1 change: 0 additions & 1 deletion packages/core/test-runner/api/collections_products.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*
*/

import 'dotenv/config';
import { suite } from 'uvu';
import * as assert from 'uvu/assert';
import { create_handle, file_name, promises_sequence } from './api.utils.crud.js';
Expand Down
1 change: 0 additions & 1 deletion packages/core/test-runner/api/customers_crud.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*
*/

import 'dotenv/config';
import { suite } from 'uvu';
import * as assert from 'uvu/assert';
import {
Expand Down
1 change: 0 additions & 1 deletion packages/core/test-runner/api/customers_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @import { PubSubEvent } from '../../pubsub/types.public.js'
*
*/
import 'dotenv/config';
import { suite } from 'uvu';
import * as assert from 'uvu/assert';
import { create_handle, file_name,
Expand Down
1 change: 0 additions & 1 deletion packages/core/test-runner/api/discounts_crud.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @import { PubSubEvent } from '../../pubsub/types.public.js'
*
*/
import 'dotenv/config';
import { suite } from 'uvu';
import * as assert from 'uvu/assert';
import { enums } from '../../api/index.js';
Expand Down
1 change: 0 additions & 1 deletion packages/core/test-runner/api/discounts_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @import { PubSubEvent } from '../../pubsub/types.public.js'
*
*/
import 'dotenv/config';
import { suite } from 'uvu';
import * as assert from 'uvu/assert';
import { file_name,
Expand Down
1 change: 0 additions & 1 deletion packages/core/test-runner/api/discounts_products.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @import { PubSubEvent } from '../../pubsub/types.public.js'
*
*/
import 'dotenv/config';
import { suite } from 'uvu';
import * as assert from 'uvu/assert';
import { file_name } from './api.utils.crud.js';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
* @import { PubSubEvent } from '../../pubsub/types.public.js'
*
*/
import 'dotenv/config';
import { enums } from '../../api/index.js';
import { create_handle, create_title_gen, get_static_ids } from './api.utils.crud.js';
import { to_handle } from '../../api/utils.func.js';
Expand Down
1 change: 0 additions & 1 deletion packages/core/test-runner/api/images_crud.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @import { PubSubEvent } from '../../pubsub/types.public.js'
*
*/
import 'dotenv/config';
import { suite } from 'uvu';
import * as assert from 'uvu/assert';
import { add_sanity_crud_to_test_suite, file_name } from './api.utils.crud.js';
Expand Down
1 change: 0 additions & 1 deletion packages/core/test-runner/api/images_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @import { PubSubEvent } from '../../pubsub/types.public.js'
*
*/
import 'dotenv/config';
import { suite } from 'uvu';
import * as assert from 'uvu/assert';
import { file_name,
Expand Down
1 change: 0 additions & 1 deletion packages/core/test-runner/api/notifications_crud.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @import { PubSubEvent } from '../../pubsub/types.public.js'
*
*/
import 'dotenv/config';
import { suite } from 'uvu';
import * as assert from 'uvu/assert';
import { file_name, get_static_ids } from './api.utils.crud.js';
Expand Down
1 change: 0 additions & 1 deletion packages/core/test-runner/api/notifications_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @import { PubSubEvent } from '../../pubsub/types.public.js'
*
*/
import 'dotenv/config';
import { suite } from 'uvu';
import * as assert from 'uvu/assert';
import { file_name,
Expand Down
1 change: 0 additions & 1 deletion packages/core/test-runner/api/orders_crud.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @import { PubSubEvent } from '../../pubsub/types.public.js'
*
*/
import 'dotenv/config';
import { suite } from 'uvu';
import * as assert from 'uvu/assert';
import { enums } from '../../api/index.js';
Expand Down
1 change: 0 additions & 1 deletion packages/core/test-runner/api/orders_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @import { PubSubEvent } from '../../pubsub/types.public.js'
*
*/
import 'dotenv/config';
import { suite } from 'uvu';
import * as assert from 'uvu/assert';
import { file_name, iso, add_list_integrity_tests,
Expand Down
1 change: 1 addition & 0 deletions packages/core/test-runner/api/play.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'dotenv/config';
import { App } from '@storecraft/core';
import { MongoDB } from '@storecraft/database-mongodb';
import { NodePlatform } from '@storecraft/core/platform/node';
Expand Down
1 change: 0 additions & 1 deletion packages/core/test-runner/api/posts_crud.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @import { PubSubEvent } from '../../pubsub/types.public.js'
*
*/
import 'dotenv/config';
import { suite } from 'uvu';
import * as assert from 'uvu/assert';
import { add_sanity_crud_to_test_suite,
Expand Down
1 change: 0 additions & 1 deletion packages/core/test-runner/api/posts_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @import { PubSubEvent } from '../../pubsub/types.public.js'
*
*/
import 'dotenv/config';
import { suite } from 'uvu';
import * as assert from 'uvu/assert';
import { create_handle, file_name,
Expand Down
1 change: 0 additions & 1 deletion packages/core/test-runner/api/pricing.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
* @import { PubSubEvent } from '../../pubsub/types.public.js'
*
*/
import 'dotenv/config';
import { suite } from 'uvu';
import * as assert from 'uvu/assert';
import { enums } from '@storecraft/core/api';
Expand Down
1 change: 0 additions & 1 deletion packages/core/test-runner/api/products_collections.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @import { PubSubEvent } from '../../pubsub/types.public.js'
*
*/
import 'dotenv/config';
import { suite } from 'uvu';
import * as assert from 'uvu/assert';
import { create_handle, file_name, promises_sequence } from './api.utils.crud.js';
Expand Down
1 change: 0 additions & 1 deletion packages/core/test-runner/api/products_crud.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @import { PubSubEvent } from '../../pubsub/types.public.js'
*
*/
import 'dotenv/config';
import { suite } from 'uvu';
import * as assert from 'uvu/assert';
import {
Expand Down
1 change: 0 additions & 1 deletion packages/core/test-runner/api/products_discounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @import { PubSubEvent } from '../../pubsub/types.public.js'
*
*/
import 'dotenv/config';
import { suite } from 'uvu';
import * as assert from 'uvu/assert';
import { file_name } from './api.utils.crud.js';
Expand Down
1 change: 0 additions & 1 deletion packages/core/test-runner/api/products_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @import { PubSubEvent } from '../../pubsub/types.public.js'
*
*/
import 'dotenv/config';
import { suite } from 'uvu';
import * as assert from 'uvu/assert';
import { create_handle, file_name,
Expand Down
1 change: 0 additions & 1 deletion packages/core/test-runner/api/products_related_products.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @import { PubSubEvent } from '../../pubsub/types.public.js'
*
*/
import 'dotenv/config';
import { suite } from 'uvu';
import * as assert from 'uvu/assert';
import { App } from '../../index.js';
Expand Down
1 change: 0 additions & 1 deletion packages/core/test-runner/api/products_variants.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @import { PubSubEvent } from '../../pubsub/types.public.js'
*
*/
import 'dotenv/config';
import { suite } from 'uvu';
import * as assert from 'uvu/assert';
import { App } from '../../index.js';
Expand Down
1 change: 0 additions & 1 deletion packages/core/test-runner/api/quick_search.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* @import { PubSubEvent } from '../../pubsub/types.public.js'
*
*/
import 'dotenv/config';
import { suite } from 'uvu';
import * as assert from 'uvu/assert';
import { add_sanity_crud_to_test_suite,
Expand Down
1 change: 0 additions & 1 deletion packages/core/test-runner/api/shipping_crud.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @import { PubSubEvent } from '../../pubsub/types.public.js'
*
*/
import 'dotenv/config';
import { suite } from 'uvu';
import * as assert from 'uvu/assert';
import { add_sanity_crud_to_test_suite,
Expand Down
1 change: 0 additions & 1 deletion packages/core/test-runner/api/shipping_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @import { PubSubEvent } from '../../pubsub/types.public.js'
*
*/
import 'dotenv/config';
import { suite } from 'uvu';
import * as assert from 'uvu/assert';
import { create_handle, file_name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @import { PubSubEvent } from '../../pubsub/types.public.js'
*
*/
import 'dotenv/config';
import { suite } from 'uvu';
import * as assert from 'uvu/assert';
import { enums } from '../../api/index.js';
Expand Down
1 change: 0 additions & 1 deletion packages/core/test-runner/api/storefronts_crud.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @import { PubSubEvent } from '../../pubsub/types.public.js'
*
*/
import 'dotenv/config';
import { suite } from 'uvu';
import * as assert from 'uvu/assert';
import { add_sanity_crud_to_test_suite,
Expand Down
1 change: 0 additions & 1 deletion packages/core/test-runner/api/storefronts_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @import { PubSubEvent } from '../../pubsub/types.public.js'
*
*/
import 'dotenv/config';
import { suite } from 'uvu';
import * as assert from 'uvu/assert';
import { create_handle, file_name,
Expand Down
1 change: 0 additions & 1 deletion packages/core/test-runner/api/tags_crud.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @import { PubSubEvent } from '../../pubsub/types.public.js'
*
*/
import 'dotenv/config';
import { suite } from 'uvu';
import * as assert from 'uvu/assert';
import { assert_async_throws } from './utils.js';
Expand Down
1 change: 0 additions & 1 deletion packages/core/test-runner/api/tags_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @import { PubSubEvent } from '../../pubsub/types.public.js'
*
*/
import 'dotenv/config';
import { suite } from 'uvu';
import * as assert from 'uvu/assert';
import { create_handle, file_name,
Expand Down
1 change: 0 additions & 1 deletion packages/core/test-runner/api/templates_crud.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* @import { idable_concrete } from '../../database/types.public.js'
*
*/
import 'dotenv/config';
import { suite } from 'uvu';
import * as assert from 'uvu/assert';
import { add_sanity_crud_to_test_suite,
Expand Down
1 change: 0 additions & 1 deletion packages/core/test-runner/api/templates_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* @import { idable_concrete } from '../../database/types.public.js'
*
*/
import 'dotenv/config';
import { suite } from 'uvu';
import * as assert from 'uvu/assert';
import { create_handle, file_name,
Expand Down
10 changes: 9 additions & 1 deletion packages/databases/database-mongodb/tests/runner.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'dotenv/config';
import { App } from '@storecraft/core';
import { MongoDB, migrateToLatest } from '@storecraft/database-mongodb';
import { NodePlatform } from '@storecraft/core/platform/node';
Expand All @@ -12,7 +13,14 @@ export const create_app = async () => {
}
)
.withPlatform(new NodePlatform())
.withDatabase(new MongoDB({ db_name: 'test'}))
.withDatabase(
new MongoDB(
{
db_name: process.env.MONGODB_NAME,
url: process.env.MONGODB_URL
}
)
)

return app.init();
}
Expand Down
2 changes: 2 additions & 0 deletions packages/databases/database-mysql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
width='90%' />
</div><hr/><br/>

[![SQLite / Postgres / MySQL](https://github.com/store-craft/storecraft/actions/workflows/test.database-sql.yml/badge.svg)](https://github.com/store-craft/storecraft/actions/workflows/test.database-sql.yml)

Official `MySQL` driver for `StoreCraft` using `mysql2` package.

```bash
Expand Down
1 change: 1 addition & 0 deletions packages/databases/database-mysql/tests/runner.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'dotenv/config';
import { App } from '@storecraft/core';
import { MySQL } from '@storecraft/database-mysql';
import { migrateToLatest } from '@storecraft/database-sql-base/migrate.js';
Expand Down
1 change: 1 addition & 0 deletions packages/databases/database-neon/tests/runner.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'dotenv/config';
import { App } from '@storecraft/core';
import { NodePlatform } from '@storecraft/core/platform/node';
import { api } from '@storecraft/core/test-runner';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'dotenv/config';
import { App } from '@storecraft/core';
import { NodePlatform } from '@storecraft/core/platform/node';
import { api } from '@storecraft/core/test-runner'
Expand Down
Loading

0 comments on commit c021e41

Please sign in to comment.