Skip to content

Commit 87254dd

Browse files
authored
🚚 Move location of scripts to simplify file structure (#1352)
1 parent 68a7fe0 commit 87254dd

File tree

9 files changed

+18
-22
lines changed

9 files changed

+18
-22
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ jobs:
2626
- run: docker compose down -v --remove-orphans
2727
- run: docker compose up -d
2828
- name: Lint
29-
run: docker compose exec -T backend bash /app/scripts/lint.sh
29+
run: docker compose exec -T backend bash scripts/lint.sh
3030
- name: Run tests
31-
run: docker compose exec -T backend bash /app/tests-start.sh "Coverage for ${{ github.sha }}"
31+
run: docker compose exec -T backend bash scripts/tests-start.sh "Coverage for ${{ github.sha }}"
3232
- run: docker compose down -v --remove-orphans
3333
- name: Store coverage files
3434
uses: actions/upload-artifact@v4

backend/Dockerfile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,10 @@ RUN bash -c "if [ $INSTALL_DEV == 'true' ] ; then poetry install --no-root ; els
1717

1818
ENV PYTHONPATH=/app
1919

20-
COPY ./scripts/ /app/
20+
COPY ./scripts /app/scripts
2121

2222
COPY ./alembic.ini /app/
2323

24-
COPY ./prestart.sh /app/
25-
26-
COPY ./tests-start.sh /app/
27-
2824
COPY ./app /app/app
2925

3026
CMD ["fastapi", "run", "--workers", "4", "app/main.py"]

backend/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,15 @@ If you use GitHub Actions the tests will run automatically.
106106
If your stack is already up and you just want to run the tests, you can use:
107107

108108
```bash
109-
docker compose exec backend bash /app/tests-start.sh
109+
docker compose exec backend bash scripts/tests-start.sh
110110
```
111111

112-
That `/app/tests-start.sh` script just calls `pytest` after making sure that the rest of the stack is running. If you need to pass extra arguments to `pytest`, you can pass them to that command and they will be forwarded.
112+
That `/app/scripts/tests-start.sh` script just calls `pytest` after making sure that the rest of the stack is running. If you need to pass extra arguments to `pytest`, you can pass them to that command and they will be forwarded.
113113

114114
For example, to stop on first error:
115115

116116
```bash
117-
docker compose exec backend bash /app/tests-start.sh -x
117+
docker compose exec backend bash scripts/tests-start.sh -x
118118
```
119119

120120
### Test Coverage
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#! /usr/bin/env bash
22

33
# Let the DB start
4-
python /app/app/backend_pre_start.py
4+
python app/backend_pre_start.py
55

66
# Run migrations
77
alembic upgrade head
88

99
# Create initial data in DB
10-
python /app/app/initial_data.py
10+
python app/initial_data.py

backend/scripts/tests-start.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#! /usr/bin/env bash
2+
set -e
3+
set -x
4+
5+
python app/tests_pre_start.py
6+
7+
bash scripts/test.sh "$@"

backend/tests-start.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ services:
5555
db:
5656
condition: service_healthy
5757
restart: true
58-
command: bash prestart.sh
58+
command: bash scripts/prestart.sh
5959
env_file:
6060
- .env
6161
environment:

scripts/test-local.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ fi
1212

1313
docker-compose build
1414
docker-compose up -d
15-
docker-compose exec -T backend bash /app/tests-start.sh "$@"
15+
docker-compose exec -T backend bash scripts/tests-start.sh "$@"

scripts/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ set -x
77
docker compose build
88
docker compose down -v --remove-orphans # Remove possibly previous broken stacks left hanging after an error
99
docker compose up -d
10-
docker compose exec -T backend bash /app/tests-start.sh "$@"
10+
docker compose exec -T backend bash scripts/tests-start.sh "$@"
1111
docker compose down -v --remove-orphans

0 commit comments

Comments
 (0)