Skip to content

Commit ad30cb9

Browse files
author
Matheus
committed
New build.yml
1 parent 3b74756 commit ad30cb9

File tree

1 file changed

+6
-32
lines changed

1 file changed

+6
-32
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,54 +4,28 @@ on:
44
push:
55
branches:
66
- main
7+
- 2-setup-ci/cd-for-backend
78
pull_request:
89
branches:
910
- main
1011

1112
jobs:
1213
build:
1314
name: Run build
14-
runs-on: ubuntu-20.04
15-
16-
services:
17-
postgres:
18-
image: postgres:12
19-
env:
20-
POSTGRES_SERVER: localhost
21-
POSTGRES_PASSWORD: postgres123
22-
POSTGRES_USER: postgres
23-
POSTGRES_DB: app
24-
ports:
25-
- 5432:5432
26-
options: --health-cmd pg_isready --health-interval 5s --health-timeout 4s --health-retries 5
15+
runs-on: ubuntu-latest
2716

2817
steps:
2918
- uses: actions/checkout@v2
30-
31-
- name: Set up Python
32-
uses: actions/setup-python@v2.2.2
3319
with:
34-
python-version: 3.7
35-
36-
- name: Install poetry
37-
run: pip install poetry==1.1
20+
fetch-depth: 0 # Evita clones rasos
3821

39-
- name: Install dependencies
40-
run: poetry install --no-dev
41-
42-
- name: Run initial migrations
22+
- name: Build
4323
env:
4424
# Overwrite data from alembic/env.py
45-
POSTGRES_SERVER: localhost
25+
POSTGRES_SERVER: db
4626
POSTGRES_PASSWORD: postgres123
4727

4828
# Doesn't overwrite data from alembic/env.py
4929
POSTGRES_USER: postgres
5030
POSTGRES_DB: app
51-
52-
DB_CONNECTION: postgresql://postgres:postgres123@localhost/app
53-
run: |
54-
poetry run alembic upgrade head
55-
poetry run python initial_data.py
56-
poetry run uvicorn main:app --reload --host 0.0.0.0 &
57-
sleep 2
31+
run: sudo docker-compose build

0 commit comments

Comments
 (0)