Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[report]
fail_under = 90
show_missing = True
32 changes: 32 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
name: Run build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Create .env
run: |
touch .env
echo SECRET_KEY=secret_key >> .env
echo POSTGRES_DB=app >> .env
echo POSTGRES_SERVER=db >> .env
echo POSTGRES_USER=postgres >> .env
echo POSTGRES_PASSWORD=postgres123 >> .env
cat .env

- name: Run docker-compose build
run: sudo docker-compose build
35 changes: 35 additions & 0 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Style

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
lint:
name: Check style
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Create .env
run: |
touch .env
echo SECRET_KEY=secret_key >> .env
echo POSTGRES_DB=app >> .env
echo POSTGRES_SERVER=db >> .env
echo POSTGRES_USER=postgres >> .env
echo POSTGRES_PASSWORD=postgres123 >> .env
cat .env

- name: Run docker-compose build with INSTALL_DEV=true
run: sudo docker-compose build --build-arg INSTALL_DEV=true

- name: Run flake8
run: sudo docker-compose run backend flake8
35 changes: 35 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Tests

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
test:
name: Run tests
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Create .env
run: |
touch .env
echo SECRET_KEY=secret_key >> .env
echo POSTGRES_DB=app >> .env
echo POSTGRES_SERVER=db >> .env
echo POSTGRES_USER=postgres >> .env
echo POSTGRES_PASSWORD=postgres123 >> .env
cat .env

- name: Run docker-compose build with INSTALL_DEV=true
run: sudo docker-compose build --build-arg INSTALL_DEV=true

- name: Run pytest-cov
run: sudo docker-compose run backend pytest -v --color=yes --cov=.
20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[![Build](https://github.com/Computer-Progress/api/workflows/Build/badge.svg)](https://github.com/Computer-Progress/api/actions/workflows/build.yml)
[![Style](https://github.com/Computer-Progress/api/workflows/Style/badge.svg)](https://github.com/Computer-Progress/api/actions/workflows/style.yml)
[![Tests](https://github.com/Computer-Progress/api/workflows/Tests/badge.svg)](https://github.com/Computer-Progress/api/actions/workflows/test.yml)

# API Computer Progress



## Commands

To execute the project just run this:
Expand All @@ -23,6 +24,20 @@ To run the migrations:
docker-compose run --rm backend alembic upgrade head
```

To execute the tests:

```
sudo docker-compose build --build-arg INSTALL_DEV=true && \
sudo docker-compose run --rm backend pytest
```

To run code style verification:

```
sudo docker-compose build --build-arg INSTALL_DEV=true && \
sudo docker-compose run --rm backend flake8
```

And if you need to install new dependencies you can run:

```bash
Expand All @@ -33,4 +48,3 @@ And if you need to install new dependencies you can run:
After the docker is runnig, you can acess the routes documentation accessing:

http://localhost:8000/docs

Loading