Skip to content

Commit

Permalink
setup github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
frostming committed Sep 20, 2019
1 parent 62d5769 commit 674f9b7
Show file tree
Hide file tree
Showing 22 changed files with 107 additions and 110 deletions.
5 changes: 1 addition & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ insert_final_newline = true
[*.md]
trim_trailing_whitespace = false

[*.toml]
indent_size = 2

[*.yaml]
[*.{toml,yaml,yml}]
indent_size = 2

# Makefiles always use tabs for indentation
Expand Down
69 changes: 69 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Continuous Integration and Deployment

on: [push]

jobs:
build:

runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
max-parallel: 6
matrix:
python-version: [2.7, 3.5, 3.6, 3.7]
os: [ubuntu-latest, macOS-latest, windows-latest]

steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Setup build and test environment
run: |
python -m pip install --upgrade "pip<19.2.0" setuptools wheel
- name: Build Python Package
run: |
python -m pip install -e ".[tests,virtualenv]"
python -m pip install -e tests/pytest-pypi
# Temporarily pin tomlkit to lower version dueto sdispater/tomlkit/issues/56.
python -m pip install --upgrade "tomlkit<=0.5.3"
- name: Lint with flake8
run: |
python -m pip install flake8
flake8 --show-source src/ tests/
- name: Test with pytest
run: |
pytest -n auto --cov=passa --cov-report=xml
- name: Report code coverage
uses: codecov/codecov-action@v1.0.2
with:
token: ${{secrets.CODECOV_TOKEN}}
file: coverage.xml

pack:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install Requirements
run: |
python -m pip install --upgrade "pip<19.2.0" check-manifest invoke
pip install -e ".[pack]"
- name: Check MANIFEST
run: |
check-manifest
- name: Packaging
run: |
invoke pack
python pack/passa.zip --help
- name: Upload packed result
uses: actions/upload-artifact@v1
with:
name: packed
path: pack/passa.zip
44 changes: 0 additions & 44 deletions .travis.yml

This file was deleted.

1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ recursive-include docs Makefile *.rst *.py *.bat
recursive-exclude docs requirements*.txt

prune .github
prune .gitmodules
prune docs/build
prune news
prune tasks
Expand Down
9 changes: 0 additions & 9 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 0 additions & 22 deletions appveyor.yml

This file was deleted.

4 changes: 3 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ ignore =
# E231: missing whitespace after ','
# E402: module level import not at top of file
# E501: line too long
E231,E402,E501
E231,E402,E501,W503

[tool:pytest]
strict = true
Expand All @@ -105,6 +105,8 @@ norecursedirs = .* build dist news tasks docs
filterwarnings =
ignore::DeprecationWarning
ignore::PendingDeprecationWarning
markers =
needs_internet: test cases that need access to the internet

[build-system]
requires = ["setuptools", "wheel"]
Expand Down
2 changes: 1 addition & 1 deletion src/passa/cli/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Command(BaseCommand):

def run(self, options):
return install(project=options.project, check=options.check, dev=options.dev,
clean=options.clean)
clean=options.clean)


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion src/passa/cli/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def __init__(self, root, *args, **kwargs):
)
try:
super(Project, self).__init__(root.as_posix(), environment=environment,
*args, **kwargs)
*args, **kwargs)
except tomlkit.exceptions.ParseError as e:
raise argparse.ArgumentError(
"project", "failed to parse Pipfile: {0!r}".format(str(e)),
Expand Down
2 changes: 1 addition & 1 deletion src/passa/cli/remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Command(BaseCommand):

def run(self, options):
return remove(project=options.project, only=options.only,
packages=options.packages, clean=options.clean, sync=options.sync)
packages=options.packages, clean=options.clean, sync=options.sync)


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion src/passa/cli/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Command(BaseCommand):

def run(self, options):
return upgrade(project=options.project, strategy=options.strategy,
sync=options.sync, packages=options.packages)
sync=options.sync, packages=options.packages)


if __name__ == "__main__":
Expand Down
10 changes: 4 additions & 6 deletions src/passa/internals/_pip.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
from __future__ import absolute_import, unicode_literals

import contextlib
import distutils.log
import io
import itertools
import distutils.log
import os
import re

Expand All @@ -16,15 +16,13 @@
import packaging.utils
import pip_shims
import six
import sys
import sysconfig
import vistir

from ..models.caches import CACHE_DIR
from ..models.environments import Environment
from ._pip_shims import (
SETUPTOOLS_SHIM, VCS_SUPPORT, build_wheel as _build_wheel, unpack_url
)
from ._pip_shims import SETUPTOOLS_SHIM
from ._pip_shims import build_wheel as _build_wheel
from ._pip_shims import unpack_url
from .utils import filter_sources


Expand Down
1 change: 0 additions & 1 deletion src/passa/internals/_pip_shims.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from __future__ import absolute_import, unicode_literals

import distlib.metadata
import importlib
import pip_shims
import recursive_monkey_patch

Expand Down
8 changes: 5 additions & 3 deletions src/passa/internals/markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ def get_without_extra(marker):
def _markers_collect_extras(markers, collection):
# Optimization: the marker element is usually appended at the end.
for el in reversed(markers):
if (isinstance(el, tuple) and
el[0].value == "extra" and
el[1].value == "=="):
if (
isinstance(el, tuple)
and el[0].value == "extra"
and el[1].value == "=="
):
collection.add(el[2].value)
elif isinstance(el, list):
_markers_collect_extras(el, collection)
Expand Down
6 changes: 3 additions & 3 deletions src/passa/internals/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def is_type_checking():


if MYPY_RUNNING:
from typing import Any, List, Dict # noqa
from typing import Any, List, Dict, Union # noqa
from requirementslib.models.requirements import Requirement # noqa
from pip_shims.shims import InstallRequirement # noqa

Expand Down Expand Up @@ -133,8 +133,8 @@ def get_allow_prereleases(requirement, global_setting):
def are_requirements_equal(this, that):
# type: (Requirement, Requirement) -> bool
return (
this.as_line(include_hashes=False) ==
that.as_line(include_hashes=False)
this.as_line(include_hashes=False)
== that.as_line(include_hashes=False)
)


Expand Down
3 changes: 1 addition & 2 deletions src/passa/models/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ def _format_metasets(metasets):
# This extra str(Marker()) call helps simplify the expression.
return str(packaging.markers.Marker(" or ".join(
"{0}".format(s) if " and " in s else s
for s in dedup_markers(str(metaset) for metaset in metasets
if metaset)
for s in dedup_markers(str(metaset) for metaset in metasets if metaset)
)))


Expand Down
6 changes: 4 additions & 2 deletions src/passa/models/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,10 @@ def contains_key_in_pipfile(self, key):
self._get_pipfile_section(develop=True, insert=False),
]
return any(
(packaging.utils.canonicalize_name(name) ==
packaging.utils.canonicalize_name(key))
(
packaging.utils.canonicalize_name(name)
== packaging.utils.canonicalize_name(key)
)
for section in sections
for name in section
)
Expand Down
4 changes: 2 additions & 2 deletions src/passa/models/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ def __init__(self, tracked_names, *args, **kwargs):
def is_satisfied_by(self, requirement, candidate):
# If this is a tracking package, tell the resolver out of using the
# preferred pin, and into a "normal" candidate selection process.
if (self.identify(requirement) in self.tracked_names and
getattr(candidate, "_preferred_by_provider", False)):
if (self.identify(requirement) in self.tracked_names
and getattr(candidate, "_preferred_by_provider", False)):
return False
return super(EagerUpgradeProvider, self).is_satisfied_by(
requirement, candidate,
Expand Down
1 change: 0 additions & 1 deletion src/passa/models/synchronizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import sys
import sysconfig

import distlib.wheel
import pkg_resources

import packaging.markers
Expand Down
6 changes: 4 additions & 2 deletions tests/actions/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,10 @@ def test_install_editable(project, is_dev):
install = passa.actions.install.install(project=project, check=True, dev=is_dev, clean=False)
assert install == 0
project.reload()
assert (project.env.is_installed("shellingham") or
project.is_installed("shellingham")), list([dist.project_name for dist in project.env.get_distributions()])
assert (
project.env.is_installed("shellingham")
or project.is_installed("shellingham")
), list([dist.project_name for dist in project.env.get_distributions()])


def test_install_sdist(project, is_dev):
Expand Down
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def project_directory(tmpdir_factory, pypi):
project_dir.join("Pipfile").write(DEFAULT_PIPFILE_CONTENTS.format(pypi=pypi.url))
with vistir.contextmanagers.cd(project_dir.strpath), vistir.contextmanagers.temp_environ():
os.environ["PIP_INDEX_URL"] = "{}/simple".format(pypi.url)
os.environ["PASSA_CACHE_DIR"] = project_dir.join(".caches").strpath
yield project_dir


Expand Down
9 changes: 5 additions & 4 deletions tests/pytest-pypi/pytest_pypi/app.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function

import contextlib
import io
import json
import os

from tarfile import is_tarfile
from zipfile import is_zipfile

import requests
import six
from flask import Flask, abort, jsonify, redirect, render_template, send_file
from six.moves import xmlrpc_client

from flask import Flask, redirect, abort, render_template, send_file, jsonify


app = Flask(__name__)
session = requests.Session()

packages = {}
ARTIFACTS = {}
if six.PY2:
FileNotFoundError = OSError


@contextlib.contextmanager
Expand Down

0 comments on commit 674f9b7

Please sign in to comment.