-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: configure the base setup on github (#1)
* feat: configure the base setup on github * fix: fix git and make installation * fix: fix python version for testing * fix: avoid pip cache from setup-python action
- Loading branch information
Showing
10 changed files
with
563 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Execute lint and tests | ||
|
||
on: [push] | ||
|
||
env: | ||
DATABASE_URL: "postgres://fastqueue:fastqueue@postgres:5432/fastqueue" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
services: | ||
postgres: | ||
image: postgres:14-alpine | ||
env: | ||
POSTGRES_DB: fastqueue | ||
POSTGRES_USER: fastqueue | ||
POSTGRES_PASSWORD: fastqueue | ||
ports: | ||
- 5432:5432 | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
steps: | ||
- name: Install system dependencies | ||
run: sudo apt update && sudo apt install --no-install-recommends -y make git | ||
- uses: actions/checkout@v3 | ||
- uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cache/pypoetry/virtualenvs | ||
~/.cache/pre-commit | ||
key: self-runner-${{ runner.os }}-python-3.10-poetry-${{ hashFiles('poetry.lock') }}-precommit-${{ hashFiles('.pre-commit-config.yaml') }} | ||
- name: Set up Python 3.10.6 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.10.6 | ||
- name: Install dependencies | ||
run: | | ||
cp env.sample .env | ||
python -m pip install --upgrade pip | ||
pip install poetry | ||
poetry config virtualenvs.create false | ||
poetry install | ||
- name: pre-commit lint | ||
run: make lint | ||
- name: pytest | ||
run: make test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.3.0 | ||
hooks: | ||
- id: check-ast | ||
- id: fix-byte-order-marker | ||
- id: check-docstring-first | ||
- id: check-json | ||
- id: check-merge-conflict | ||
- id: check-symlinks | ||
- id: check-toml | ||
- id: check-vcs-permalinks | ||
- id: check-xml | ||
- id: check-yaml | ||
- id: debug-statements | ||
- id: destroyed-symlinks | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
|
||
- repo: https://github.com/MarcoGorelli/absolufy-imports | ||
rev: v0.3.1 | ||
hooks: | ||
- id: absolufy-imports | ||
|
||
- repo: https://github.com/pycqa/isort | ||
rev: 5.10.1 | ||
hooks: | ||
- id: isort | ||
args: ["--overwrite-in-place"] | ||
|
||
- repo: https://github.com/psf/black | ||
rev: 22.6.0 | ||
hooks: | ||
- id: black | ||
args: ["--line-length=110"] | ||
|
||
- repo: https://github.com/pycqa/flake8 | ||
rev: 5.0.4 | ||
hooks: | ||
- id: flake8 | ||
args: ["--max-line-length=110", "--ignore=E203,E501,W503"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
test: | ||
poetry run pytest -v | ||
|
||
lint: | ||
poetry run pre-commit run --all-files | ||
|
||
run-db: | ||
docker run --name postgres-fastqueue \ | ||
--restart unless-stopped \ | ||
-e POSTGRES_USER=fastqueue \ | ||
-e POSTGRES_PASSWORD=fastqueue \ | ||
-e POSTGRES_DB=fastqueue \ | ||
-p 5432:5432 \ | ||
-d postgres:14-alpine | ||
|
||
rm-db: | ||
docker kill $$(docker ps -aqf name=postgres-fastqueue) | ||
docker container rm $$(docker ps -aqf name=postgres-fastqueue) | ||
|
||
.PHONY: test lint run-db rm-db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# fastqueue | ||
Simple queue system based on FastAPI and PostgreSQL | ||
Simple queue system based on FastAPI and PostgreSQL. |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__version__ = "0.1.0" |
Oops, something went wrong.