Skip to content

Commit

Permalink
Revert "Sample Data Loading and Test in GitHub Action (#3223)" (#3271)
Browse files Browse the repository at this point in the history
This reverts commit 4ff9d91.
  • Loading branch information
palisadoes authored Feb 22, 2025
1 parent 7e6ef15 commit 792e6ee
Show file tree
Hide file tree
Showing 17 changed files with 697 additions and 1,153 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -302,3 +302,21 @@ 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
3 changes: 0 additions & 3 deletions docker/api.Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ 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: 1 addition & 53 deletions docs/docs/docs/developer-resources/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ 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 @@ -187,57 +186,6 @@ 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: 10 additions & 17 deletions docs/docs/docs/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -387,31 +387,24 @@ 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.

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

This applies to users running Talawa API in dev containers.

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

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

2. Open a bash session inside the running container:
```bash
docker exec talawa-api-1 /bin/bash -c 'pnpm run add:sample_data && exit'
docker exec -it talawa-api-1 /bin/bash
```

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:

3. Inside the container, run the following command to import sample data into the database:
```bash
pnpm run add:sample_data
pnpm run import:sample-data
```
4. Then exit
```bash
exit
```
Refer to the next section for login information.

### Sample Data Users

Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,20 @@
"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 @@ -85,8 +88,7 @@
"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",
"reset:db": "tsx ./scripts/dbManagement/resetDB.ts",
"add:sample_data": "tsx ./scripts/dbManagement/addSampleData.ts",
"import:sample-data": "tsx ./src/utilities/loadSampleData.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

0 comments on commit 792e6ee

Please sign in to comment.