Skip to content

Commit

Permalink
hooray ci
Browse files Browse the repository at this point in the history
  • Loading branch information
jkent committed Jun 24, 2019
1 parent 3a15567 commit dd61c80
Show file tree
Hide file tree
Showing 10 changed files with 239 additions and 45 deletions.
10 changes: 10 additions & 0 deletions .ci/build_linux_wheels.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

set -e

for PYVER in "cp35-cp35m" "cp36-cp36m" "cp37-cp37m"; do
PYBIN="/opt/python/${PYVER}/bin"
"${PYBIN}/python" -m pip install wheel
"${PYBIN}/python" setup.py bdist_wheel
done
find dist -name "*.whl" -exec auditwheel repair {} \;
13 changes: 13 additions & 0 deletions .ci/build_macos_wheels.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

set -e

brew update
brew outdated pyenv || brew upgrade pyenv
export PATH=~/.pyenv/shims:$PATH
for PYVER in "3.5.7" "3.6.8" "3.7.3"; do
pyenv install ${PYVER}
pyenv global ${PYVER}
python -m pip install wheel
python setup.py bdist_wheel
done
59 changes: 59 additions & 0 deletions .ci/build_windows_wheels.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/usr/bin/env python
from __future__ import unicode_literals, print_function

import os.path
import sys
import time

import requests

api_url = 'https://ci.appveyor.com/api'
account_name = os.getenv('APPVEYOR_ACCOUNT')
project_slug = os.getenv('APPVEYOR_SLUG')
headers = {'Authorization': 'Bearer ' + os.getenv('APPVEYOR_TOKEN')}

# Trigger the AppVeyor build
r = requests.post(api_url + '/builds', {
'accountName': account_name,
'projectSlug': project_slug,
'branch': os.getenv('TRAVIS_BRANCH'),
'commitID': os.getenv('TRAVIS_COMMIT')
}, headers=headers)
r.raise_for_status()
build = r.json()
print('Started AppVeyor build (buildId={buildId}, version={version})'.format(**build))

# Wait until the build has finished
while True:
url = '{}/projects/{}/{}/build/{}'.format(api_url, account_name, project_slug,
build['version'])
r = requests.get(url, headers=headers)
r.raise_for_status()
build = r.json()['build']
status = build['status']
if status in ('starting', 'queued', 'running'):
print('Build status: {}; checking again in 5 seconds'.format(status))
time.sleep(5)
elif status == 'success':
print('Build successful')
job_ids = [job['jobId'] for job in build['jobs']]
break
else:
print('Build failed with status: {}'.format(status), file=sys.stderr)
sys.exit(1)

# Download the artifacts to wheelhouse/
os.mkdir('wheelhouse')
for job_id in job_ids:
r = requests.get('{}/buildjobs/{}/artifacts'.format(api_url, job_id), headers=headers)
r.raise_for_status()
for artifact in r.json():
url = '{}/buildjobs/{}/artifacts/{}'.format(api_url, job_id, artifact['fileName'])
r = requests.get(url, headers=headers, stream=True)
r.raise_for_status()
file_name = 'wheelhouse/' + os.path.basename(artifact['fileName'])
with open(file_name, 'wb') as f:
for chunk in r.iter_content(None):
f.write(chunk)

print('Downloaded ' + f.name)
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
.project
.pydevproject
.settings
.vscode/
*.egg-info/
Debug/
build/
dist/
__pycache__/
MANIFEST

81 changes: 81 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
dist: xenial
language: python

env:
global:
- PYTHONUNBUFFERED=1
- APPVEYOR_SLUG=python-q3huff
- APPVEYOR_ACCOUNT=jkent
# APPVEYOR_TOKEN
- secure: "vKfQSVJIcx01th0MCk6bRDixN9ln42eTFUTQViZWAPUQxq/TZ/62UdEkKEO0h7ORxCB1XWqUp0KfTLLsUUSH/ilLgY787VXzxmCWQcoierINXCTDiU6eK9qPAYc3b1bOtijsurjXxYv+yruotx6r7jeXzLozt+dR25sQgYiThNQ/IQ5WlhFw9Tt7SPbyM3JtUIXt8XgrPp3raexGdgpqLSfOBeOnuYCqPCobgIU1+emY2Nd1ivsX9xQmgR5xWdbBkk2cRSIaUjV7FWz+t4y/VvB+bRJolk8W7UHGfKje0Y0KxL3gUgi8ffKAWxFGbcMEkd53TZquHko8LA6FxQ1vz+oMtJMry29dCysqV33hfxbhqjdW4XFIAF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kent
# TWINE_PASSWORD
- secure: "jdLAi3njWnHfczsR1yZ/qBDLuWfYx6D+vGe2+G1jzmePhi21ZVTPnc2SGfKnDUhGLLmgacQITYQUw90QMMBPCRKP8CCSSQNvEsVHOHBtsGhw8JLIvl1ziuRes5FJzM4Dtwn14F69RLPCtM18ilSdH6xfhM94TfANVkaOIeADKS1smFTpn4rXuN6VeKOJW3hPC6G2Ejb6l1ruDUPYSzBJZd80QjX+h+Y/+09trQ0mvfodykvLPgkTU4LZ3ETmG2XwsXFWllt+NhNscr4CJ8y/LeMVgTioggsstCuBFh79D4ebhMD99WBFoBRGC4wp2/E/SkJYO73hihYSFmgQBYSDqK2fNyXSJzzQXGyj8J8kJcozkmVDJyuBQMyucBrC+jghTIUU+oULiRnCtzZMPci3Yxlexs+Fzhk+mo5o7CvDg2gz23VPdlD8l0w25nNA09KG8nSM+L+lve9BslGSWGtCJ6AqTmpQB1KYrzwYYzizWf/khD1ZhzPODwtbJGPbOC62vWxoh22wXGkJaX4+PuzXXRAdA/WmOn7kNcvdwVQ8OMV5ejmysZDuQxUj8yTad3x23JYBxDcvaHbflD9De/EarcmWM+4huv72Gg24H9KRhp+hRnpwBXcRtTZjXLvJrvtRofTyFeIQ2+oPO/DxOtixbJc7KRNkITbrrPbSgEbxrSA="

stages:
- name: test
- name: build sdist
if: type = push AND tag =~ ^v\d+\.\d+\.\d+
- name: build wheels
if: type = push AND tag =~ ^v\d+\.\d+\.\d+
- name: deploy to pypi
if: type = push AND tag =~ ^v\d+\.\d+\.\d+

python:
- '3.4'
- '3.5'
- '3.6'
- '3.7'

install:
- pip install -e .[test]

script: pytest

jobs:
fast_finish: true
include:
- stage: build sdist
before_install: &setup_s3
- pip install awscli
- mkdir dist
install: skip
script: python setup.py sdist
after_success:
- aws s3 rm --recursive s3://python-q3huff/dist
- aws s3 sync dist s3://python-q3huff/dist

- stage: build wheels
env: OS=LINUX
sudo: required
before_install: *setup_s3
install: skip
script: docker run --rm -it -v $(pwd):/io -w /io quay.io/pypa/manylinux1_x86_64 .ci/build_linux_wheels.sh
after_success: aws s3 sync wheelhouse s3://python-q3huff/dist

- stage: build wheels
os: osx
language: generic
env: OS=MACOS
before_install: *setup_s3
install: skip
script: .ci/build_macos_wheels.sh
after_success: aws s3 sync dist s3://python-q3huff/dist

- stage: build wheels
env: OS=WINDOWS
before_install: *setup_s3
install: pip install requests
script: .ci/build_windows_wheels.py
after_success: aws s3 sync wheelhouse s3://python-q3huff/dist

- stage: deploy to pypi
before_install: *setup_s3
install: pip install twine
script:
- aws s3 sync s3://python-q3huff/dist dist
- twine upload dist/*
- aws s3 rm --recursive s3://python-q3huff/dist
22 changes: 22 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: 1.0.{build}
clone_depth: 50 # The same depth Travis has

environment:
matrix:
- PYTHON: "C:\\Python35"
- PYTHON: "C:\\Python35-x64"
- PYTHON: "C:\\Python36"
- PYTHON: "C:\\Python36-x64"
- PYTHON: "C:\\Python37"
- PYTHON: "C:\\Python37-x64"

install:
- "%PYTHON%\\python.exe -m pip install wheel"

build: off

after_test:
- "%PYTHON%\\python.exe setup.py bdist_wheel"

artifacts:
- path: dist\*
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from distutils.core import Extension, setup
from setuptools import Extension, setup

__version__ = '0.2.0'
__version__ = '0.3.0'

huffman_src = ['src/hufflib.c',
'src/huffman.c',
Expand All @@ -17,12 +17,12 @@

setup(name='q3huff', version = __version__,
ext_modules = [huffman_ext],
description = 'Python 3 C API wrapper for Huffman code found in Quake 3.',
description = 'Python 3 C API wrapper for Huffman code found in ioquake3.',
author = 'Jeff Kent',
author_email = 'jeff@jkent.net',
maintainer = 'Jeff Kent',
maintainer_email = 'jeff@jkent.net',
url = "https://github.com/jkent/q3huff",
url = "https://github.com/jkent/python-q3huff",
license = 'GNU GPLv2',
classifiers = [
'Development Status :: 4 - Beta',
Expand Down

0 comments on commit dd61c80

Please sign in to comment.