You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+63-15
Original file line number
Diff line number
Diff line change
@@ -48,7 +48,40 @@ The full explanation of Enki it is out of scope for this documentation. To learn
48
48
> After installing Docker, navigate to the Docker Desktop GUI preferences and increase the `Memory` value to at least `8GiB`.
49
49
> [Here's where you can find the Docker Desktop GUI settings](https://docs.docker.com/docker-for-windows/#resources)
50
50
51
-
### Local development
51
+
52
+
53
+
## Local development
54
+
55
+
**General Workflow**
56
+
1. Start stack with or without GitHub OAuth (see below)
57
+
1. Visit http://localhost/ to see the frontend
58
+
1. Make modifications
59
+
1. Wait for automatic reload
60
+
61
+
**NOTE**: You might get 502 when visiting http://localhost/ at first: this is normal. Wait a few seconds and try again.
62
+
63
+
### GitHub OAuth Disabled (Leashed Mode)
64
+
65
+
To start corgi without GitHub OAuth, in the project root directory, run:
66
+
67
+
```bash
68
+
./corgi start-leashed
69
+
```
70
+
71
+
or
72
+
73
+
```bash
74
+
./corgi start
75
+
```
76
+
77
+
78
+
In leashed mode, corgi only uses data that is stored locally.
79
+
80
+
Currently, that data is stored in `backend/app/tests/unit/data`.
81
+
82
+
**NOTE:** By default, you will only be able to use `tiny-book` as the repository and `book-slug1` as the book when queuing jobs. This data can be updated: see [Run backend unit tests](#run-backend-unit-tests) for more information.
83
+
84
+
### GitHub OAuth Enabled
52
85
53
86
**Prerequisites**
54
87
* You will need access to a GitHub OAuth app. You can [create your own](https://docs.github.com/en/developers/apps/building-oauth-apps/creating-an-oauth-app) if you do not have one already.
@@ -57,9 +90,11 @@ The full explanation of Enki it is out of scope for this documentation. To learn
3.`SESSION_SECRET` (secret used to encrypt session cookies)
59
92
60
-
Build/start the stack with Docker Compose:
93
+
Build/start the stack with the Corgi script:
61
94
62
-
docker-compose -f docker-compose.stack.dev.yml up -d
95
+
```bash
96
+
./corgi start-dev
97
+
```
63
98
64
99
View the API Docs here:
65
100
@@ -68,15 +103,20 @@ View the API Docs here:
68
103
69
104
To check the logs run:
70
105
71
-
docker-compose logs backend/frontend/etc.
106
+
```bash
107
+
./corgi logs backend/frontend/etc.
108
+
```
109
+
110
+
### Functions Patched in Leashed Mode
72
111
112
+
Leashed mode attempts to patch any `app.github.api` function functions starting with "get_". It looks for the associated mock functions in `backend/app/tests/unit/init_test_data.py`.
113
+
114
+
### Hot Reloading
73
115
74
116
Using the development stack, the Svelte frontend is rebuilt inside the container
75
117
as you make changes: no restarts required. The page should reload automatically
76
-
as well.
77
-
78
-
NOTE: The dev frontend server can take a while to start up. You might get 502
79
-
responses at first: this is normal. Wait a few seconds and try again.
118
+
as well. The same is true for the backend: as you make modifications, the
119
+
backend server should reload with your latest changes.
80
120
81
121
82
122
### View the Docs
@@ -119,19 +159,25 @@ Note: Can be done in container or outside the container, with installed requirem
119
159
120
160
To run unit tests:
121
161
122
-
cd backend/app
123
-
poetry run pytest tests/unit
162
+
```bash
163
+
cd backend/app
164
+
poetry run pytest tests/unit
165
+
```
124
166
125
-
The unit tests use vcr to store response from GitHub. To initialize test data:
167
+
The unit tests use vcr to store response from GitHub. To update the test data:
126
168
127
-
cd backend/app
128
-
poetry run pytest tests/unit --init-test-data --github-token "<token>"
169
+
```bash
170
+
cd backend/app
171
+
poetry run pytest tests/unit --init-test-data --github-token "<token>"
172
+
```
129
173
130
174
### Run integration and UI tests
131
175
132
176
To run the tests execute:
133
177
134
-
./scripts/tests.ci.sh
178
+
```bash
179
+
./scripts/tests.ci.sh
180
+
```
135
181
136
182
### How to develop UI tests
137
183
@@ -143,7 +189,9 @@ In the [./scripts/tests.ci.local](./scripts/tests.ci.local) file comment out the
143
189
144
190
In order to view the browser first list all the containers for the docker-stack.yml file:
145
191
146
-
$ docker-compose -f docker-stack.yml ps
192
+
```bash
193
+
docker-compose -f docker-stack.yml ps
194
+
```
147
195
148
196
A table will be displayed with column names. Find the one labeled PORTS for the backend-tests container.
0 commit comments