-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #106 from IIIF/update-python-version
Adding github actions
- Loading branch information
Showing
8 changed files
with
160 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Publish Python 🐍 distributions 📦 to PyPI on Release | ||
|
||
on: | ||
release: | ||
types: [released] | ||
|
||
jobs: | ||
build-n-publish: | ||
name: Build and publish Python 🐍 distributions 📦 to PyPI | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.9 | ||
|
||
- name: Setup version | ||
run: echo "${{ github.event.release.tag_name }}" > version.txt | ||
|
||
- name: Install pypa/build | ||
run: python -m pip install build --user | ||
- name: Build a binary wheel and a source tarball | ||
run: python -m build --sdist --wheel --outdir dist/ | ||
|
||
- name: Publish distribution 📦 to PyPI | ||
uses: pypa/[email protected] | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Publish Python 🐍 distributions 📦 to TestPyPI on Tag creation | ||
|
||
on: | ||
release: | ||
types: [prereleased] | ||
|
||
jobs: | ||
build-n-publish: | ||
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.9 | ||
|
||
- name: Setup version | ||
run: echo "${{ github.event.release.tag_name }}" > version.txt | ||
|
||
- name: Install pypa/build | ||
run: python -m pip install build --user | ||
- name: Build a binary wheel and a source tarball | ||
run: python -m build --sdist --wheel --outdir dist/ | ||
|
||
|
||
- name: Publish distribution 📦 to Test PyPI | ||
uses: pypa/[email protected] | ||
with: | ||
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | ||
repository_url: https://test.pypi.org/legacy/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# This is a basic workflow to help you get started with Actions | ||
|
||
name: Run-tests | ||
|
||
# Controls when the action will run. Triggers the workflow on push or pull request | ||
# events but only for the master branch | ||
on: [push] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [ '3.9', '3.10', '3.11', '3.12', '3.13'] | ||
name: Python ${{ matrix.python-version }} sample | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
architecture: x64 | ||
|
||
- uses: actions/cache@v4 | ||
with: | ||
path: ${{ env.pythonLocation }} | ||
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ hashFiles('dev-requirements.txt') }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
pip install setuptools -U | ||
- name: Install | ||
run: python setup.py install | ||
|
||
- name: Test | ||
run: python -m unittest discover -s tests | ||
|
||
- name: install coveralls | ||
run: pip install coveralls | ||
|
||
- name: Generate coverage | ||
run: coverage run -m unittest discover -s tests | ||
|
||
- name: Upload coverage data to coveralls.io | ||
run: coveralls --service=github | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
COVERALLS_FLAG_NAME: ${{ matrix.python-version }} | ||
COVERALLS_PARALLEL: true | ||
|
||
Coveralls: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
container: python:3-slim | ||
steps: | ||
- name: Coveralls Finished | ||
run: | | ||
pip3 install --upgrade coveralls | ||
coveralls --service=github --finish | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
lxml | ||
bottle | ||
python-magic | ||
# Versions including 7 don't support python 2.x | ||
pillow<7 | ||
pillow | ||
mock | ||
setuptools |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,27 @@ | ||
from setuptools import setup | ||
# setuptools used instead of distutils.core so that | ||
# dependencies can be handled automatically | ||
import os | ||
from pathlib import Path | ||
|
||
# Extract version number from resync/_version.py. Here we | ||
# are very strict about the format of the version string | ||
# as an extra sanity check. (Thanks for comments in | ||
# http://stackoverflow.com/questions/458550/standard-way-to-embed-version-into-python-package ) | ||
import re | ||
VERSIONFILE = "iiif_validator/_version.py" | ||
verfilestr = open(VERSIONFILE, "rt").read() | ||
match = re.search(r"^__version__ = '(\d\.\d.\d+(\.\d+)?)'", verfilestr, | ||
re.MULTILINE) | ||
if match: | ||
version = match.group(1) | ||
this_directory = Path(__file__).parent | ||
if os.path.exists("version.txt"): | ||
VERSION = (this_directory / "version.txt").read_text().strip() | ||
else: | ||
raise RuntimeError("Unable to find version string in %s." % (VERSIONFILE)) | ||
VERSION = "0.0.0.dev0" | ||
|
||
REQUIREMENTS = [ | ||
"bottle>=0.12.1", | ||
"python-magic>=0.4.12", | ||
"lxml>=3.7.0", | ||
"Pillow>=6.2.2" | ||
] | ||
|
||
# Read dev requirements from requirements.txt | ||
with open("requirements.txt") as f: | ||
DEV_REQUIREMENTS = f.read().splitlines() | ||
|
||
setup( | ||
name='iiif-validator', | ||
version=version, | ||
version=VERSION, | ||
packages=['iiif_validator', 'iiif_validator.tests'], | ||
scripts=['iiif-validator.py', 'iiif-validate.py'], | ||
classifiers=[ | ||
|
@@ -27,29 +30,23 @@ | |
"License :: OSI Approved :: Apache Software License", | ||
"Operating System :: OS Independent", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 2", | ||
"Programming Language :: Python :: 2.7", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.4", | ||
"Programming Language :: Python :: 3.5", | ||
"Programming Language :: Python :: 3.6", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: 3.12", | ||
"Topic :: Internet :: WWW/HTTP", | ||
"Topic :: Software Development :: Libraries :: Python Modules", | ||
"Environment :: Web Environment" | ||
], | ||
python_requires='>=3', | ||
author='IIIF Contributors', | ||
author_email='[email protected]', | ||
description='IIIF Image API Validator', | ||
long_description=open('README').read(), | ||
url='http://github.com/IIIF/image-api', | ||
install_requires=[ | ||
"bottle>=0.12.1", | ||
"python-magic>=0.4.12", | ||
"lxml>=3.7.0" | ||
], | ||
long_description_content_type='text/markdown', | ||
url='https://github.com/IIIF/image-validator', | ||
install_requires=REQUIREMENTS, | ||
extras_require={ | ||
':python_version>="3.0"': ["Pillow>=3.2.0"], | ||
':python_version<"3.0"': ["Pillow==6.2.2"], | ||
}, | ||
test_suite="tests", | ||
tests_require=["mock"]) | ||
"dev": DEV_REQUIREMENTS | ||
}) |