Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sample Data Loading and Test in GitHub Action #3223

Open
wants to merge 93 commits into
base: develop-postgres
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
44d3e1a
DB testing Workflow
Feb 15, 2025
723f9a5
Merge branch 'develop-postgres' into PR-Workflow-(DB)
JaiPannu-IITI Feb 16, 2025
ee982a5
workflow
Feb 16, 2025
1909d58
Merge branch 'PR-Workflow-(DB)' of https://github.com/JaiPannu-IITI/t…
Feb 16, 2025
bbf88b9
fix data readibility
Feb 16, 2025
29ea81b
dynamic insertion
Feb 16, 2025
4ec6777
dynamic testing
Feb 16, 2025
0143804
prettier
Feb 16, 2025
432148a
Merge branch 'develop-postgres' into PR-Workflow-(DB)
JaiPannu-IITI Feb 16, 2025
9aeb522
Clean Code
Feb 16, 2025
be189c7
Merge branch 'PR-Workflow-(DB)' of https://github.com/JaiPannu-IITI/t…
Feb 16, 2025
54e0c50
finalizing
Feb 16, 2025
fd473ca
comment
Feb 16, 2025
edebdd5
graceful exit
Feb 16, 2025
8a44750
pretty
Feb 16, 2025
e94acf2
pretty
Feb 16, 2025
8f48c4a
Merge branch 'develop-postgres' into PR-Workflow-(DB)
JaiPannu-IITI Feb 17, 2025
d79e082
Test case
Feb 17, 2025
597bd66
Merge branch 'PR-Workflow-(DB)' of https://github.com/JaiPannu-IITI/t…
Feb 17, 2025
ce6efd6
pretty
Feb 17, 2025
060df44
basic testing
Feb 17, 2025
ca64626
pretty
Feb 17, 2025
cb788ea
Empty commit
Feb 17, 2025
2db0ddb
type check
Feb 17, 2025
b01653f
pretty
Feb 17, 2025
19e96b4
coderabbit
Feb 17, 2025
51c04ac
Empty commit
Feb 17, 2025
1872ac0
changes
Feb 17, 2025
11943bb
change
Feb 17, 2025
a183cd6
pretty
Feb 17, 2025
b74aecb
Final test
Feb 17, 2025
6e41bc5
Merge branch 'develop-postgres' into PR-Workflow-(DB)
JaiPannu-IITI Feb 18, 2025
4b0be6e
major changes
Feb 18, 2025
ef8f3e3
Merge branch 'PR-Workflow-(DB)' of https://github.com/JaiPannu-IITI/t…
Feb 18, 2025
1ca9efe
correction
Feb 18, 2025
3eebbcd
docs
Feb 18, 2025
4061fd7
prettier
Feb 18, 2025
9b1d59f
finalizing
Feb 18, 2025
023a6ae
test modifications
Feb 18, 2025
3ed16e2
test modify
Feb 18, 2025
fbb0103
pretty
Feb 18, 2025
2704f49
remove test
Feb 18, 2025
cb28075
environment setup
Feb 18, 2025
b899925
changes
Feb 18, 2025
db5c885
Merge branch 'develop-postgres' into PR-Workflow-(DB)
JaiPannu-IITI Feb 18, 2025
6788693
documentation updated
Feb 18, 2025
5b309de
Merge branch 'PR-Workflow-(DB)' of https://github.com/JaiPannu-IITI/t…
Feb 18, 2025
ad53429
documentation
Feb 18, 2025
67c6e91
documentation
Feb 18, 2025
4b25561
documentation
Feb 18, 2025
bdd8891
test
Feb 19, 2025
9e902f6
module
Feb 19, 2025
021e964
Merge branch 'develop-postgres' into PR-Workflow-(DB)
JaiPannu-IITI Feb 19, 2025
914cc79
major testing improvement
Feb 20, 2025
2250ee3
Merge branch 'PR-Workflow-(DB)' of https://github.com/JaiPannu-IITI/t…
Feb 20, 2025
e6fd5b0
Merge branch 'develop-postgres' into PR-Workflow-(DB)
JaiPannu-IITI Feb 20, 2025
e0c6b4a
test
Feb 20, 2025
8453f8e
pretty
Feb 20, 2025
a097800
xoldd, coderabbit ai implementation
Feb 20, 2025
ed37435
Merge branch 'develop-postgres' into PR-Workflow-(DB)
JaiPannu-IITI Feb 20, 2025
c1bfc4d
Merge branch 'develop-postgres' into PR-Workflow-(DB)
JaiPannu-IITI Feb 21, 2025
451724e
Merge branch 'develop-postgres' into PR-Workflow-(DB)
JaiPannu-IITI Feb 21, 2025
40dad6b
changes
Feb 21, 2025
209231c
Merge branch 'PR-Workflow-(DB)' of https://github.com/JaiPannu-IITI/t…
Feb 21, 2025
7f8387e
fix
Feb 21, 2025
cbc445e
improvements
Feb 21, 2025
6e6a847
improvements
Feb 21, 2025
df35d8d
code quality
Feb 21, 2025
f30d560
removed unnecessary packages
Feb 21, 2025
1e67c4b
fix
Feb 21, 2025
7b8a492
remove unwanted package (xoldd)
Feb 21, 2025
5d843e2
fix
Feb 21, 2025
038942d
test database
Feb 21, 2025
c51af3c
code-quality
Feb 21, 2025
5587783
manipulate db
Feb 21, 2025
4dd5400
fix
Feb 21, 2025
fddd190
backward compatibility
Feb 21, 2025
6cb21d7
fix
Feb 21, 2025
d528e97
final
Feb 21, 2025
29924bd
cleaning
Feb 21, 2025
d430bc0
corrected environment
Feb 21, 2025
3016e41
host managment
Feb 21, 2025
3b88beb
fixed code quality
Feb 21, 2025
039640b
sample
Feb 21, 2025
c116227
removed unncessary dependencies
Feb 21, 2025
c6adb1e
roll back to postgres env
Feb 21, 2025
9657f10
pretty
Feb 21, 2025
cd84244
pretty
Feb 21, 2025
8b0921d
fix
Feb 21, 2025
55b7146
added tests
Feb 21, 2025
0a63e0d
fix
Feb 21, 2025
9287f8d
vitest is sufficient
Feb 21, 2025
78c4696
coderabbit
Feb 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -313,21 +313,3 @@ jobs:
run: |
source venv/bin/activate
python .github/workflows/scripts/check_docstrings.py --directories .github


# Import-Sample-Data:
# name: Import Sample Data
# runs-on: ubuntu-latest
# steps:
# - name: Checkout this repository
# uses: actions/checkout@v4.2.2
# - name: Create .env file for talawa api testing environment
# run: cp ./envFiles/.env.ci ./.env
# - name: Build talawa api non production environment docker image
# run: docker compose build
# - name: Run import:sample-data
# uses: addnab/docker-run-action@v3
# with:
# image: talawa_api
# options: --env-file ./envFiles/.env.ci
# run: pnpm run import:sample-data
54 changes: 53 additions & 1 deletion docs/docs/docs/developer-resources/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ This section covers important tests to validate the operation of the API.
### Sample Database Login Credentials

If the API:

1. is running with an unmodified `.env` file copied from `envFiles/.env.devcontainer` and;
2. the API sample database is loaded;
then you can use these login credentials to access the API via various clients.
then you can use these login credentials to access the API via various clients.

| Email | Password | User Type | Joined Organization |
| -----------------------------------| -------- | ---------------| -------------------- |
Expand Down Expand Up @@ -184,6 +185,57 @@ CloudBeaver is a lightweight web application designed for comprehensive data man
6. You should now see the `PostgreSql@postgres-test` connection in the list of available connections. Click on the connection to open the database.
7. Navigate to `PostgreSql@postgres-test > Databases > talawa > Schemas > public > Tables` to view the available tables.

## Resetting Database

**NOTE:** This applies only to Talawa API developers.

Sometimes you may want to start all over again from scratch. These steps ensure all tables emptied and the default administrator account automatically restored.

### Using the CLI (Dev Containers)

This applies to users running Talawa API in dev containers.

1. Once the server is running, open a new terminal session.

2. Open a bash session inside the running container:

```bash
docker exec -it talawa-api-1 /bin/bash
```

3. **WARNING:** This command will **DELETE** all data from each table in your database, administrator roles will be restored. Use with extreme caution.

```bash
pnpm run reset:db
```

4. This command will add sample data to make it easier for developers to get an understanding of the application.

```bash
pnpm run add:sample_data
```

5. Then exit

```bash
exit
```

### Using VS Code Dev Container

This applies to users running Talawa API in dev containers and VSCode.

1. **WARNING:** This command will **DELETE** all data from each table in your database, administrator roles will be restored. Use with extreme caution.
```bash
pnpm run reset:db
```
2. This command will add sample data to make it easier for developers to get an understanding of the application.
```bash
pnpm run add:sample_data
```

Now you can resume your development work.

## Object Storage Management

MinIO is a free, open-source object storage server that's compatible with Amazon S3. It's designed for large-scale data storage and can run on-premises or in the cloud.
Expand Down
25 changes: 22 additions & 3 deletions docs/docs/docs/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -387,25 +387,44 @@ You can run the app after closing the terminal or restating the vscode using the

We have created sample data to make it easier for end users to get an understanding of the application.

### Importing Sample Data
### Using the CLI (Dev Containers)

This applies to users running Talawa API in dev containers.

1. Once the server is running, open a new terminal session.

2. Open a bash session inside the running container:

```bash
docker exec -it talawa-api-1 /bin/bash
```

3. Inside the container, run the following command to import sample data into the database:

```bash
pnpm run import:sample-data
pnpm run add:sample_data
```

4. Then exit

```bash
exit
exit
```

Refer to the next section for login information.

### Using VS Code Dev Container

This applies to users running Talawa API in dev containers and VSCode.

1. Open a terminal inside the container.

2. Run the following command to import sample data into the database:

```bash
pnpm run add:sample_data
```

### Sample Data Users

Below is a table of user login credentials for the sample data.
Expand Down
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,17 @@
"close-with-grace": "^2.2.0",
"drizzle-orm": "^0.39.1",
"drizzle-zod": "0.6.1",
"dotenv": "^16.0.3",
"env-schema": "^6.0.1",
"fastify": "^5.2.1",
"fastify-plugin": "^5.0.1",
"graphql": "^16.10.0",
"graphql-scalars": "^1.24.0",
"graphql-upload-minimal": "^1.6.1",
"inquirer": "^12.4.1",
"mercurius": "^16.0.1",
"mercurius-upload": "^8.0.0",
"minio": "^8.0.4",
"postgres": "^3.4.5",
"ulidx": "^2.4.1",
"uuid": "^11.0.5",
"uuidv7": "^1.0.2",
"zod": "^3.24.1"
},
Expand Down Expand Up @@ -88,7 +85,8 @@
"generate_drizzle_migrations": "drizzle-kit generate",
"generate_graphql_sdl_file": "tsx ./scripts/generateGraphQLSDLFile.ts",
"generate_gql_tada": "gql.tada generate-output && gql.tada turbo --fail-on-warn",
"import:sample-data": "tsx ./src/utilities/loadSampleData.ts",
"reset:db": "tsx ./scripts/dbManagement/resetDB.ts",
"add:sample_data": "tsx ./scripts/dbManagement/addSampleData.ts",
"push_drizzle_schema": "drizzle-kit push",
"push_drizzle_test_schema": "drizzle-kit push --config=./test/drizzle.config.ts",
"run_tests": "vitest --coverage",
Expand Down
Loading
Loading