Skip to content

Commit 328ac78

Browse files
authored
Merge pull request piccolo-orm#79 from piccolo-orm/github_actions
GitHub actions
2 parents 8a7c150 + 5926f54 commit 328ac78

File tree

5 files changed

+83
-39
lines changed

5 files changed

+83
-39
lines changed

.github/workflows/tests.yaml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Python package
2+
3+
on: [push]
4+
5+
jobs:
6+
postgres:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
python-version: [3.7, 3.8, 3.9]
11+
postgres-version: [9.6, 10, 11, 12, 13]
12+
13+
# Service containers to run with `container-job`
14+
services:
15+
# Label used to access the service container
16+
postgres:
17+
# Docker Hub image
18+
image: postgres:${{ matrix.postgres-version }}
19+
# Provide the password for postgres
20+
env:
21+
POSTGRES_PASSWORD: postgres
22+
# Set health checks to wait until postgres has started
23+
options: >-
24+
--health-cmd pg_isready
25+
--health-interval 10s
26+
--health-timeout 5s
27+
--health-retries 5
28+
ports:
29+
- 5432:5432
30+
31+
steps:
32+
- uses: actions/checkout@v2
33+
- name: Set up Python ${{ matrix.python-version }}
34+
uses: actions/setup-python@v2
35+
with:
36+
python-version: ${{ matrix.python-version }}
37+
- name: Install dependencies
38+
run: |
39+
python -m pip install --upgrade pip
40+
pip install -r requirements.txt
41+
pip install -r tests/test-requirements.txt
42+
- name: Setup postgres
43+
run: |
44+
export PGPASSWORD=postgres
45+
psql -h localhost -c 'CREATE DATABASE piccolo;' -U postgres
46+
psql -h localhost -c "CREATE USER piccolo PASSWORD 'piccolo';" -U postgres
47+
psql -h localhost -c "GRANT ALL PRIVILEGES ON DATABASE piccolo TO piccolo;" -U postgres
48+
psql -h localhost -c "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";" -d piccolo -U postgres
49+
50+
- name: Test with pytest, Postgres
51+
run: cd tests && ./test-postgres.sh
52+
env:
53+
PG_HOST: localhost
54+
PG_DATABASE: piccolo
55+
PG_PASSWORD: postgres
56+
57+
sqlite:
58+
runs-on: ubuntu-latest
59+
strategy:
60+
matrix:
61+
python-version: [3.7, 3.8, 3.9]
62+
63+
steps:
64+
- uses: actions/checkout@v2
65+
- name: Set up Python ${{ matrix.python-version }}
66+
uses: actions/setup-python@v2
67+
with:
68+
python-version: ${{ matrix.python-version }}
69+
- name: Install dependencies
70+
run: |
71+
python -m pip install --upgrade pip
72+
pip install -r requirements.txt
73+
pip install -r tests/test-requirements.txt
74+
- name: Test with pytest, SQLite
75+
run: cd tests && ./test-sqlite.sh

.travis.yml

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

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Piccolo
22

33
[![Build Status](https://travis-ci.com/piccolo-orm/piccolo.svg?branch=master)](https://travis-ci.com/piccolo-orm/piccolo)
4-
[![Coverage Status](https://coveralls.io/repos/github/piccolo-orm/piccolo/badge.svg)](https://coveralls.io/github/piccolo-orm/piccolo)
54
[![Documentation Status](https://readthedocs.org/projects/piccolo-orm/badge/?version=latest)](https://piccolo-orm.readthedocs.io/en/latest/?badge=latest)
65
[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/piccolo-orm/piccolo.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/piccolo-orm/piccolo/context:python)
76
[![Total alerts](https://img.shields.io/lgtm/alerts/g/piccolo-orm/piccolo.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/piccolo-orm/piccolo/alerts/)

tests/postgres_conf.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1+
import os
2+
13
from piccolo.engine.postgres import PostgresEngine
24
from piccolo.conf.apps import AppRegistry
35

46

57
DB = PostgresEngine(
6-
{
7-
"host": "localhost",
8-
"database": "piccolo",
9-
"user": "piccolo",
10-
"password": "piccolo",
8+
config={
9+
"host": os.environ.get("PG_HOST", "localhost"),
10+
"port": os.environ.get("PG_PORT", "5432"),
11+
"user": os.environ.get("PG_USER", "postgres"),
12+
"password": os.environ.get("PG_PASSWORD", ""),
13+
"database": os.environ.get("PG_DATABASE", "piccolo"),
1114
}
1215
)
1316

tests/travis.sh

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

0 commit comments

Comments
 (0)