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

Port CI to GitHub Actions #57

Merged
merged 4 commits into from
Mar 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Runs the unit tests for the pyroma package
# Based on https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Test package

on: [pull_request, push]

jobs:
build:
name: Run package tests

runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.6', '3.9', 'pypy-3.7']

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
run: python -m pip install --upgrade pip
- name: Install package
run: pip install -e .
- name: Run tests
run: python -bb -X dev -W ignore::UserWarning:setuptools.dist -m unittest -v pyroma.tests
16 changes: 0 additions & 16 deletions .travis.yml

This file was deleted.

15 changes: 8 additions & 7 deletions pyroma/distributiondata.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# Extracts information from a distribution file by unpacking in a temporary
# directory and then using projectdata on that.
"""
Extract information from a distribution file by unpacking in a temporary
directory and then using projectdata on that.
"""

import os
import shutil
import tarfile
import tempfile
import zipfile
import tarfile

from pyroma import projectdata

Expand All @@ -15,9 +18,8 @@ def get_data(path):
if basename.endswith(".tar"):
basename, ignored = os.path.splitext(basename)

tempdir = tempfile.mkdtemp()
try:
tempdir = tempfile.mkdtemp()

if ext in (".bz2", ".tbz", "tb2", ".gz", ".tgz", ".tar"):
with tarfile.open(name=path, mode="r:*") as tar_file:
tar_file.extractall(tempdir)
Expand All @@ -31,8 +33,7 @@ def get_data(path):

projectpath = os.path.join(tempdir, basename)
data = projectdata.get_data(projectpath)

finally:
shutil.rmtree(tempdir)
shutil.rmtree(tempdir, ignore_errors=True)

return data
7 changes: 5 additions & 2 deletions pyroma/tests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import unittest
import os
import collections
import io
import os
import unittest

try:
from xmlrpc import client as xmlrpclib
Expand All @@ -18,6 +19,8 @@
)
if not isinstance(long_description, str):
long_description = long_description.decode()
# Translate newlines to universal format
long_description = io.StringIO(long_description, newline=None).read()

COMPLETE = {
"_setuptools": True,
Expand Down