Skip to content

Commit

Permalink
BLD: Try out GH actions.
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Sanderson committed Apr 29, 2020
1 parent c2a5f20 commit 892b8d7
Show file tree
Hide file tree
Showing 13 changed files with 138 additions and 66 deletions.
99 changes: 99 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: PGContents CI
on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:

pre-commit:
name: pre-commit
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: 3.6
- uses: actions/cache@v1
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
- uses: pre-commit/[email protected]

tests:
name: ${{ matrix.name }}
runs-on: ubuntu-18.04
strategy:
fail-fast: false
matrix:
name:
- py27-notebook5
- py35-notebook5
- py36-notebook5

- py35-notebook6
- py36-notebook6

include:
- name: py27-notebook5
python-version: 2.7

- name: py35-notebook5
python-version: 3.5

- name: py36-notebook5
python-version: 3.6

- name: py35-notebook6
python-version: 3.5

- name: py36-notebook6
python-version: 3.6

services:
postgres:
image: "postgres:9.5-alpine"
ports:
- 5432:5432
env:
POSTGRES_DB: pgcontents_testing
POSTGRES_USER: pgcontents_user
POSTGRES_PASSWORD: pgcontents_pass

steps:

- name: Dump Matrix Config
env:
MATRIX: ${{ toJson(matrix) }}
run: echo "$MATRIX"

- name: Checkout Repository
uses: actions/checkout@v1

- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ matrix.name }}-pip-${{ hashFiles('**/*_constraints.txt') }}

- name: Setup LibPQ
run: |
sudo apt-get update
sudo apt-get install libpq-dev
- name: Install Tox
run: |
python -m pip install -U pip setuptools
python -m pip install tox
- name: Run Tox
run: tox -e ${{ matrix.name }}
env:
PGCONTENTS_TEST_DB_URL: "postgresql://pgcontents_user:pgcontents_pass@localhost/pgcontents_testing"
18 changes: 18 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
default_language_version:
python: python3.6

repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.1.0
hooks:
- id: check-merge-conflict
- id: check-yaml
- id: check-symlinks
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.7
hooks:
- id: flake8
49 changes: 0 additions & 49 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions examples/example_checkpoints_config.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from pgcontents import PostgresCheckpoints
c = get_config()
c = get_config() # noqa

# Tell IPython to use PostgresCheckpoints for checkpoint storage.
c.NotebookApp.checkpoints_class = PostgresCheckpoints

# Set the url for the database used to store files. See
# http://docs.sqlalchemy.org/en/rel_0_9/core/engines.html#postgresql
# for more info on db url formatting.
c.PostgresContentsManager.db_url = 'postgresql://ssanderson:[email protected]:5432/pgcontents'
c.PostgresContentsManager.db_url = 'postgresql://ssanderson:[email protected]:5432/pgcontents' # noqa
4 changes: 2 additions & 2 deletions examples/example_jupyter_notebook_config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from pgcontents import PostgresContentsManager
c = get_config()
c = get_config() # noqa

# Tell IPython to use PostgresContentsManager for all storage.
c.NotebookApp.contents_manager_class = PostgresContentsManager
Expand All @@ -16,4 +16,4 @@
c.PostgresContentsManager.user_id = 'my_awesome_username'

# Set a maximum file size, if desired.
c.PostgresContentsManager.max_file_size_bytes = 1000000 # 1MB File cap
c.PostgresContentsManager.max_file_size_bytes = 1000000 # 1MB File cap
5 changes: 3 additions & 2 deletions examples/hybrid_manager_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
# directory, and all requests for data within that directory are routed to the
# sub-manager.

# A HybridContentsManager needs two pieces of information at configuration time:
# A HybridContentsManager needs two pieces of information at configuration
# time:

# 1. ``manager_classes``, a map from root directory to the type of contents
# manager to use for that root directory.
Expand All @@ -21,7 +22,7 @@
# Using Legacy IPython.
from IPython.html.services.contents.filemanager import FileContentsManager

c = get_config()
c = get_config() # noqa

c.NotebookApp.contents_manager_class = HybridContentsManager
c.HybridContentsManager.manager_classes = {
Expand Down
2 changes: 1 addition & 1 deletion pgcontents/alembic/README
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Generic single-database configuration.
Generic single-database configuration.
1 change: 0 additions & 1 deletion pgcontents/alembic/versions/32518998055d_.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,3 @@ def downgrade():
),
schema='pgcontents',
)

2 changes: 1 addition & 1 deletion pgcontents/alembic/versions/33b3645dc7f5_.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""empty message
Revision ID: 33b3645dc7f5
Revises:
Revises:
Create Date: 2014-12-17 11:37:24.122882
"""
Expand Down
1 change: 0 additions & 1 deletion pgcontents/alembic/versions/551f95fbd4a2_.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,3 @@ def downgrade():
op.alter_column('files', 'name', type_=sa.Unicode(40))
for tablename, colname in tables_cols:
op.alter_column(tablename, colname, type_=OldFilePath)

10 changes: 7 additions & 3 deletions pgcontents/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from cryptography.fernet import Fernet
from getpass import getuser
from itertools import starmap
import os
import posixpath
from unicodedata import normalize

Expand All @@ -26,9 +27,12 @@
)
from ..utils.migrate import upgrade

TEST_DB_URL = "postgresql://{user}@/pgcontents_testing".format(
user=getuser(),
)

TEST_DB_URL = os.environ.get('PGCONTENTS_TEST_DB_URL')
if TEST_DB_URL is None:
TEST_DB_URL = "postgresql://{user}@/pgcontents_testing".format(
user=getuser(),
)


def make_fernet():
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
exclude = pgcontents/alembic/versions/*

[nosetests]
with-ignore-docstrings=1
with-ignore-docstrings=1
7 changes: 4 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ whitelist_externals =
createdb

install_command =
py{27,35,36}-notebook5: pip install -c notebook5_constraints.txt {opts} {packages}
py{35,36}-notebook6: pip install -c notebook6_constraints.txt {opts} {packages}
py{27,35,36}-notebook5: pip install -v -c notebook5_constraints.txt {opts} {packages}
py{35,36}-notebook6: pip install -v -c notebook6_constraints.txt {opts} {packages}
notest,flake8: pip install {opts} {packages}

deps =
Expand All @@ -17,7 +17,8 @@ deps =
notest: .

commands =
py{27,35,36}-notebook{5,6}: -createdb pgcontents_testing
py{27,35,36}-notebook{5,6}: nosetests pgcontents/tests
flake8: flake8 pgcontents
notest: python -c 'import pgcontents'

passenv = PGCONTENTS_TEST_DB_URL

0 comments on commit 892b8d7

Please sign in to comment.