Skip to content

Commit f922eeb

Browse files
callmecamposbhrutledgedi
authored
Multi Platform CI Pipeline with GitHub Actions (#651)
* add the .yml config * fix posix vs. windows path issues * fix integration tests (xfail on win32) * sign AUTHORS * add codecov to config * exclusive use of pathlib * use pathlib standard library * print coverage report instead of upload timeouts * Update .github/workflows/main.yml Co-authored-by: Brian Rutledge <[email protected]> * Update .github/workflows/main.yml Co-authored-by: Dustin Ingram <[email protected]> Co-authored-by: Brian Rutledge <[email protected]> Co-authored-by: Dustin Ingram <[email protected]>
1 parent 424a584 commit f922eeb

File tree

4 files changed

+56
-5
lines changed

4 files changed

+56
-5
lines changed

.github/workflows/main.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- name: Setup Python
11+
uses: actions/setup-python@v1
12+
with:
13+
python-version: 3.8
14+
- name: Install tox
15+
run: python -m pip install tox
16+
- name: Run linting
17+
run: python -m tox -e lint
18+
19+
test:
20+
strategy:
21+
matrix:
22+
python: [3.6, 3.7, 3.8]
23+
platform: [ubuntu-latest, macos-latest, windows-latest]
24+
runs-on: ${{ matrix.platform }}
25+
steps:
26+
- uses: actions/checkout@v2
27+
- name: Setup Python
28+
uses: actions/setup-python@v1
29+
with:
30+
python-version: ${{ matrix.python }}
31+
- name: "Install dependencies"
32+
run: |
33+
python -m pip install --upgrade pip setuptools wheel tox
34+
- name: Run tests
35+
run: python -m tox -e py # Run tox using the version of Python in `PATH`

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ Wasim Thabraze <[email protected]>
2626
Varun Kamath <[email protected]>
2727
Brian Rutledge <[email protected]>
2828
Peter Stensmyr <[email protected]> (http://www.peterstensmyr.com)
29+
Felipe Mulinari Rocha Campos <[email protected]>
2930
Devesh Kumar Singh <[email protected]>

tests/test_integration.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1+
import sys
2+
3+
import pytest
4+
15
from twine import cli
26

37

8+
@pytest.mark.xfail(
9+
sys.platform == "win32",
10+
reason="pytest-services watcher_getter fixture does not support Windows",
11+
)
412
def test_devpi_upload(devpi_server, uploadable_dist):
513
command = [
614
"upload",
@@ -38,6 +46,10 @@ def test_pypi_upload(sampleproject_dist):
3846
cli.dispatch(command)
3947

4048

49+
@pytest.mark.xfail(
50+
sys.platform == "win32",
51+
reason="pytest-services watcher_getter fixture does not support Windows",
52+
)
4153
def test_pypiserver_upload(pypiserver_instance, uploadable_dist):
4254
command = [
4355
"upload",

tests/test_wheel.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414
import os
15+
import pathlib
16+
import re
1517
import zipfile
1618

1719
import pretend
@@ -70,19 +72,19 @@ def test_read_valid(example_wheel):
7072

7173
def test_read_non_existent_wheel_file_name():
7274
"""Raise an exception when wheel file doesn't exist."""
73-
file_name = "/foo/bar/baz.whl"
75+
file_name = str(pathlib.Path("/foo/bar/baz.whl").resolve())
7476
with pytest.raises(
75-
exceptions.InvalidDistribution, match=f"No such file: {file_name}"
77+
exceptions.InvalidDistribution, match=re.escape(f"No such file: {file_name}")
7678
):
7779
wheel.Wheel(file_name)
7880

7981

8082
def test_read_invalid_wheel_extension():
8183
"""Raise an exception when file is missing .whl extension."""
82-
file_name = os.path.join(os.path.dirname(__file__), "fixtures/twine-1.5.0.tar.gz")
84+
file_name = str(pathlib.Path(__file__).parent / "fixtures" / "twine-1.5.0.tar.gz")
8385
with pytest.raises(
8486
exceptions.InvalidDistribution,
85-
match=f"Not a known archive format for file: {file_name}",
87+
match=re.escape(f"Not a known archive format for file: {file_name}"),
8688
):
8789
wheel.Wheel(file_name)
8890

@@ -94,6 +96,7 @@ def test_read_wheel_empty_metadata(tmpdir):
9496
zip_file.writestr("METADATA", "")
9597

9698
with pytest.raises(
97-
exceptions.InvalidDistribution, match=f"No METADATA in archive: {whl_file}"
99+
exceptions.InvalidDistribution,
100+
match=re.escape(f"No METADATA in archive: {whl_file}"),
98101
):
99102
wheel.Wheel(whl_file)

0 commit comments

Comments
 (0)