Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi Platform CI Pipeline with GitHub Actions #651

Merged
merged 12 commits into from
Jun 10, 2020
34 changes: 34 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI

on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install tox
run: python -m pip install tox
- name: Run linting
run: python -m tox -e lint

test:
strategy:
matrix:
python: [3.6, 3.7, 3.8]
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python }}
- name: Install tox
run: python -m pip install tox
- name: Run tests
run: python -m tox -e py # Run tox using the version of Python in `PATH`
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ Wasim Thabraze <[email protected]>
Varun Kamath <[email protected]>
Brian Rutledge <[email protected]>
Peter Stensmyr <[email protected]> (http://www.peterstensmyr.com)
Felipe Rocha Campos <[email protected]>
12 changes: 12 additions & 0 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import sys

import pytest

from twine import cli


@pytest.mark.xfail(
callmecampos marked this conversation as resolved.
Show resolved Hide resolved
sys.platform == "win32",
reason="pytest-services watcher_getter fixture does not support Windows",
)
def test_devpi_upload(devpi_server, uploadable_dist):
command = [
"upload",
Expand Down Expand Up @@ -38,6 +46,10 @@ def test_pypi_upload(sampleproject_dist):
cli.dispatch(command)


@pytest.mark.xfail(
sys.platform == "win32",
reason="pytest-services watcher_getter fixture does not support Windows",
)
def test_pypiserver_upload(pypiserver_instance, uploadable_dist):
command = [
"upload",
Expand Down
15 changes: 10 additions & 5 deletions tests/test_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import pathlib
import re
import zipfile

import pretend
Expand Down Expand Up @@ -70,19 +72,21 @@ def test_read_valid(example_wheel):

def test_read_non_existent_wheel_file_name():
"""Test reading a wheel file which doesn't exist"""
file_name = "/foo/bar/baz.whl"
file_name = str(os.path.abspath(pathlib.Path("/foo/bar/baz.whl")))
callmecampos marked this conversation as resolved.
Show resolved Hide resolved
with pytest.raises(
exceptions.InvalidDistribution, match=f"No such file: {file_name}"
exceptions.InvalidDistribution, match=re.escape(f"No such file: {file_name}")
callmecampos marked this conversation as resolved.
Show resolved Hide resolved
):
wheel.Wheel(file_name)


def test_read_invalid_wheel_extension():
"""Test reading a wheel file without a .whl extension"""
file_name = os.path.join(os.path.dirname(__file__), "fixtures/twine-1.5.0.tar.gz")
file_name = str(
pathlib.Path(os.path.dirname(__file__)) / "fixtures" / "twine-1.5.0.tar.gz"
callmecampos marked this conversation as resolved.
Show resolved Hide resolved
)
with pytest.raises(
exceptions.InvalidDistribution,
match=f"Not a known archive format for file: {file_name}",
match=re.escape(f"Not a known archive format for file: {file_name}"),
):
wheel.Wheel(file_name)

Expand All @@ -94,6 +98,7 @@ def test_read_wheel_empty_metadata(tmpdir):
zip_file.writestr("METADATA", "")

with pytest.raises(
exceptions.InvalidDistribution, match=f"No METADATA in archive: {whl_file}"
exceptions.InvalidDistribution,
match=re.escape(f"No METADATA in archive: {whl_file}"),
):
wheel.Wheel(whl_file)
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ deps =
portend
pytest-services
munch
pathlib
callmecampos marked this conversation as resolved.
Show resolved Hide resolved
passenv =
PYTEST_ADDOPTS
commands =
Expand Down