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
35 changes: 35 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
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 dependencies"
run: |
python -m pip install --upgrade pip setuptools wheel 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,4 +26,5 @@ Wasim Thabraze <[email protected]>
Varun Kamath <[email protected]>
Brian Rutledge <[email protected]>
Peter Stensmyr <[email protected]> (http://www.peterstensmyr.com)
Felipe Mulinari Rocha Campos <[email protected]>
Devesh Kumar Singh <[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
13 changes: 8 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,19 @@ def test_read_valid(example_wheel):

def test_read_non_existent_wheel_file_name():
"""Raise an exception when wheel file doesn't exist."""
file_name = "/foo/bar/baz.whl"
file_name = str(pathlib.Path("/foo/bar/baz.whl").resolve())
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():
"""Raise an exception when file is missing .whl extension."""
file_name = os.path.join(os.path.dirname(__file__), "fixtures/twine-1.5.0.tar.gz")
file_name = str(pathlib.Path(__file__).parent / "fixtures" / "twine-1.5.0.tar.gz")
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 +96,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)