Skip to content

Sample Data Loading and Test in GitHub Action #3223

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

Merged
merged 98 commits into from
Feb 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
44d3e1a
DB testing Workflow
JaiPannu-IITI Feb 15, 2025
723f9a5
Merge branch 'develop-postgres' into PR-Workflow-(DB)
JaiPannu-IITI Feb 16, 2025
ee982a5
workflow
JaiPannu-IITI Feb 16, 2025
1909d58
Merge branch 'PR-Workflow-(DB)' of https://github.com/JaiPannu-IITI/t…
JaiPannu-IITI Feb 16, 2025
bbf88b9
fix data readibility
JaiPannu-IITI Feb 16, 2025
29ea81b
dynamic insertion
JaiPannu-IITI Feb 16, 2025
4ec6777
dynamic testing
JaiPannu-IITI Feb 16, 2025
0143804
prettier
JaiPannu-IITI Feb 16, 2025
432148a
Merge branch 'develop-postgres' into PR-Workflow-(DB)
JaiPannu-IITI Feb 16, 2025
9aeb522
Clean Code
JaiPannu-IITI Feb 16, 2025
be189c7
Merge branch 'PR-Workflow-(DB)' of https://github.com/JaiPannu-IITI/t…
JaiPannu-IITI Feb 16, 2025
54e0c50
finalizing
JaiPannu-IITI Feb 16, 2025
fd473ca
comment
JaiPannu-IITI Feb 16, 2025
edebdd5
graceful exit
JaiPannu-IITI Feb 16, 2025
8a44750
pretty
JaiPannu-IITI Feb 16, 2025
e94acf2
pretty
JaiPannu-IITI Feb 16, 2025
8f48c4a
Merge branch 'develop-postgres' into PR-Workflow-(DB)
JaiPannu-IITI Feb 17, 2025
d79e082
Test case
JaiPannu-IITI Feb 17, 2025
597bd66
Merge branch 'PR-Workflow-(DB)' of https://github.com/JaiPannu-IITI/t…
JaiPannu-IITI Feb 17, 2025
ce6efd6
pretty
JaiPannu-IITI Feb 17, 2025
060df44
basic testing
JaiPannu-IITI Feb 17, 2025
ca64626
pretty
JaiPannu-IITI Feb 17, 2025
cb788ea
Empty commit
JaiPannu-IITI Feb 17, 2025
2db0ddb
type check
JaiPannu-IITI Feb 17, 2025
b01653f
pretty
JaiPannu-IITI Feb 17, 2025
19e96b4
coderabbit
JaiPannu-IITI Feb 17, 2025
51c04ac
Empty commit
JaiPannu-IITI Feb 17, 2025
1872ac0
changes
JaiPannu-IITI Feb 17, 2025
11943bb
change
JaiPannu-IITI Feb 17, 2025
a183cd6
pretty
JaiPannu-IITI Feb 17, 2025
b74aecb
Final test
JaiPannu-IITI Feb 17, 2025
6e41bc5
Merge branch 'develop-postgres' into PR-Workflow-(DB)
JaiPannu-IITI Feb 18, 2025
4b0be6e
major changes
JaiPannu-IITI Feb 18, 2025
ef8f3e3
Merge branch 'PR-Workflow-(DB)' of https://github.com/JaiPannu-IITI/t…
JaiPannu-IITI Feb 18, 2025
1ca9efe
correction
JaiPannu-IITI Feb 18, 2025
3eebbcd
docs
JaiPannu-IITI Feb 18, 2025
4061fd7
prettier
JaiPannu-IITI Feb 18, 2025
9b1d59f
finalizing
JaiPannu-IITI Feb 18, 2025
023a6ae
test modifications
JaiPannu-IITI Feb 18, 2025
3ed16e2
test modify
JaiPannu-IITI Feb 18, 2025
fbb0103
pretty
JaiPannu-IITI Feb 18, 2025
2704f49
remove test
JaiPannu-IITI Feb 18, 2025
cb28075
environment setup
JaiPannu-IITI Feb 18, 2025
b899925
changes
JaiPannu-IITI Feb 18, 2025
db5c885
Merge branch 'develop-postgres' into PR-Workflow-(DB)
JaiPannu-IITI Feb 18, 2025
6788693
documentation updated
JaiPannu-IITI Feb 18, 2025
5b309de
Merge branch 'PR-Workflow-(DB)' of https://github.com/JaiPannu-IITI/t…
JaiPannu-IITI Feb 18, 2025
ad53429
documentation
JaiPannu-IITI Feb 18, 2025
67c6e91
documentation
JaiPannu-IITI Feb 18, 2025
4b25561
documentation
JaiPannu-IITI Feb 18, 2025
bdd8891
test
JaiPannu-IITI Feb 19, 2025
9e902f6
module
JaiPannu-IITI Feb 19, 2025
021e964
Merge branch 'develop-postgres' into PR-Workflow-(DB)
JaiPannu-IITI Feb 19, 2025
914cc79
major testing improvement
JaiPannu-IITI Feb 20, 2025
2250ee3
Merge branch 'PR-Workflow-(DB)' of https://github.com/JaiPannu-IITI/t…
JaiPannu-IITI Feb 20, 2025
e6fd5b0
Merge branch 'develop-postgres' into PR-Workflow-(DB)
JaiPannu-IITI Feb 20, 2025
e0c6b4a
test
JaiPannu-IITI Feb 20, 2025
8453f8e
pretty
JaiPannu-IITI Feb 20, 2025
a097800
xoldd, coderabbit ai implementation
JaiPannu-IITI 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
JaiPannu-IITI Feb 21, 2025
209231c
Merge branch 'PR-Workflow-(DB)' of https://github.com/JaiPannu-IITI/t…
JaiPannu-IITI Feb 21, 2025
7f8387e
fix
JaiPannu-IITI Feb 21, 2025
cbc445e
improvements
JaiPannu-IITI Feb 21, 2025
6e6a847
improvements
JaiPannu-IITI Feb 21, 2025
df35d8d
code quality
JaiPannu-IITI Feb 21, 2025
f30d560
removed unnecessary packages
JaiPannu-IITI Feb 21, 2025
1e67c4b
fix
JaiPannu-IITI Feb 21, 2025
7b8a492
remove unwanted package (xoldd)
JaiPannu-IITI Feb 21, 2025
5d843e2
fix
JaiPannu-IITI Feb 21, 2025
038942d
test database
JaiPannu-IITI Feb 21, 2025
c51af3c
code-quality
JaiPannu-IITI Feb 21, 2025
5587783
manipulate db
JaiPannu-IITI Feb 21, 2025
4dd5400
fix
JaiPannu-IITI Feb 21, 2025
fddd190
backward compatibility
JaiPannu-IITI Feb 21, 2025
6cb21d7
fix
JaiPannu-IITI Feb 21, 2025
d528e97
final
JaiPannu-IITI Feb 21, 2025
29924bd
cleaning
JaiPannu-IITI Feb 21, 2025
d430bc0
corrected environment
JaiPannu-IITI Feb 21, 2025
3016e41
host managment
JaiPannu-IITI Feb 21, 2025
3b88beb
fixed code quality
JaiPannu-IITI Feb 21, 2025
039640b
sample
JaiPannu-IITI Feb 21, 2025
c116227
removed unncessary dependencies
JaiPannu-IITI Feb 21, 2025
c6adb1e
roll back to postgres env
JaiPannu-IITI Feb 21, 2025
9657f10
pretty
JaiPannu-IITI Feb 21, 2025
cd84244
pretty
JaiPannu-IITI Feb 21, 2025
8b0921d
fix
JaiPannu-IITI Feb 21, 2025
55b7146
added tests
JaiPannu-IITI Feb 21, 2025
0a63e0d
fix
JaiPannu-IITI Feb 21, 2025
9287f8d
vitest is sufficient
JaiPannu-IITI Feb 21, 2025
78c4696
coderabbit
JaiPannu-IITI Feb 21, 2025
0f20d5b
docker environment configuration
JaiPannu-IITI Feb 22, 2025
33dffac
docs
JaiPannu-IITI Feb 22, 2025
4e83255
Merge branch 'develop-postgres' into PR-Workflow-(DB)
JaiPannu-IITI Feb 22, 2025
9058603
Merge branch 'develop-postgres' into PR-Workflow-(DB)
JaiPannu-IITI Feb 22, 2025
f257c72
Merge branch 'develop-postgres' into PR-Workflow-(DB)
JaiPannu-IITI Feb 22, 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/[email protected]
# - 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
3 changes: 3 additions & 0 deletions docker/api.Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ USER talawa
RUN curl -fsSL https://fnm.vercel.app/install | bash -s -- --skip-shell \
# Appends the fnm configuration to `/home/talawa/.bashrc` file.
&& echo eval \"\$\(fnm env --corepack-enabled --resolve-engines --use-on-cd --version-file-strategy=recursive\)\" >> /home/talawa/.bashrc
# Set the PATH for all shells
ENV NODE_VERSION=23.7.0
ENV PATH="/home/talawa/.local/share/fnm/node-versions/v${NODE_VERSION}/installation/bin:/home/talawa/.local/share/fnm/node-versions/v${NODE_VERSION}/installation/lib/node_modules/corepack/shims:${PATH}"
ENV PATH=/home/talawa/.local/share/fnm:${PATH}
WORKDIR /home/talawa/api

Expand Down
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 @@ -186,6 +187,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 (Interactive)

**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
27 changes: 17 additions & 10 deletions docs/docs/docs/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -387,24 +387,31 @@ 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:

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

```bash
pnpm run import:sample-data
docker exec talawa-api-1 /bin/bash -c 'pnpm run add:sample_data && exit'
```
4. Then 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
exit
pnpm run add:sample_data
```
Refer to the next section for login information.

### Sample Data Users

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