-
Notifications
You must be signed in to change notification settings - Fork 22
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 #35 from Frameio/circleci-project-setup
DEVREL-234, DEVREL-235, DEVREL-250: CircleCI setup, integration testing, improved dev tooling, and CODEOWNER setup
- Loading branch information
Showing
12 changed files
with
496 additions
and
52 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,6 @@ | ||
[bumpversion] | ||
current_version = 0.7.5 | ||
commit = True | ||
tag = True | ||
|
||
[bumpversion:file:setup.py] |
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,174 @@ | ||
version: 2.1 | ||
|
||
orbs: | ||
python: circleci/python@0.2.1 | ||
win: circleci/windows@2.2.0 | ||
|
||
workflows: | ||
version: 2 | ||
build_test_deploy: | ||
jobs: | ||
- build | ||
|
||
- linux_py_27_17: | ||
requires: | ||
- build | ||
|
||
- linux_py_27_latest: | ||
requires: | ||
- build | ||
|
||
- linux_py_37: | ||
requires: | ||
- build | ||
|
||
- linux_py_latest: | ||
requires: | ||
- build | ||
|
||
- deploy: | ||
requires: | ||
- linux_py_27_17 | ||
- linux_py_27_latest | ||
- linux_py_37 | ||
- linux_py_latest | ||
|
||
filters: | ||
branches: | ||
only: | ||
- master | ||
tags: | ||
only: /[0-9]+(\.[0-9]+)*/ | ||
|
||
jobs: | ||
build: | ||
docker: | ||
- image: circleci/python:latest | ||
steps: | ||
- checkout: | ||
name: Checkout Git | ||
|
||
- run: | ||
name: Build Package | ||
command: | | ||
echo -e "Running sdist" | ||
python setup.py sdist | ||
echo -e "Creating wheel" | ||
python setup.py bdist_wheel --universal | ||
- persist_to_workspace: | ||
root: /home/circleci/project/ | ||
paths: | ||
- . | ||
|
||
linux_py_27_17: | ||
description: Linux 2.7.17 | ||
docker: | ||
- image: circleci/python:2.7.17 | ||
|
||
steps: | ||
- attach_workspace: | ||
at: /tmp/artifact | ||
name: Attach build artifact | ||
|
||
- run: | ||
name: Install package | ||
command: | | ||
pip install '/tmp/artifact' | ||
- run: | ||
name: Run integration test | ||
command: | | ||
python /tmp/artifact/tests/integration.py | ||
linux_py_27_latest: | ||
description: Linux 2.7.18 | ||
docker: | ||
- image: circleci/python:2.7.18 | ||
|
||
steps: | ||
- attach_workspace: | ||
at: /tmp/artifact | ||
name: Attach build artifact | ||
|
||
- run: | ||
name: Install package | ||
command: | | ||
pip install '/tmp/artifact' | ||
- run: | ||
name: Run integration test | ||
command: | | ||
python /tmp/artifact/tests/integration.py | ||
linux_py_37: | ||
description: Linux 3.7.7 | ||
docker: | ||
- image: circleci/python:3.7.7 | ||
|
||
steps: | ||
- attach_workspace: | ||
at: /tmp/artifact | ||
name: Attach build artifact | ||
|
||
- run: | ||
name: Install package | ||
command: | | ||
pip install '/tmp/artifact' | ||
- run: | ||
name: Run integration test | ||
command: | | ||
python /tmp/artifact/tests/integration.py | ||
linux_py_latest: | ||
description: Linux latest | ||
docker: | ||
- image: circleci/python:latest | ||
|
||
steps: | ||
- attach_workspace: | ||
at: /tmp/artifact | ||
name: Attach build artifact | ||
|
||
- run: | ||
name: Install package | ||
command: | | ||
pip install '/tmp/artifact' | ||
- run: | ||
name: Run integration test | ||
command: | | ||
python /tmp/artifact/tests/integration.py | ||
deploy: | ||
docker: | ||
- image: circleci/python:latest | ||
|
||
steps: | ||
- attach_workspace: | ||
at: /tmp/artifact | ||
name: Attach build artifact | ||
|
||
- run: | ||
name: Install dependencies | ||
command: | | ||
pip install setuptools wheel twine | ||
- run: | ||
name: init .pypirc | ||
command: | | ||
cd /tmp/artifact | ||
echo -e "[pypi]" >> ~/.pypirc | ||
echo -e "username = $TWINE_USERNAME" >> ~/.pypirc | ||
echo -e "password = $TWINE_PASSWORD" >> ~/.pypirc | ||
- run: | ||
name: Upload to pypi | ||
command: | | ||
cd /tmp/artifact | ||
. venv/bin/activate | ||
twine upload dist/ | ||
Validating CODEOWNERS rules …
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,10 @@ | ||
# These owners will be the default owners for everything in | ||
# the repo. Unless a later match takes precedence, | ||
# @global-owner1 and @global-owner2 will be requested for | ||
# review when someone opens a pull request. | ||
* @jhodges10 | ||
|
||
# Order is important; the last matching pattern takes the most | ||
# precedence. When someone opens a pull request that only | ||
# modifies Python files. | ||
*.py jmeggesto@frame.io billy@frame.io zach@frame.io jay@frame.io |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/sh | ||
|
||
install-dev: | ||
pip3 install -e .[dev] | ||
curl -fLSs https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/master/install.sh | bash | ||
|
||
bump-minor: | ||
bump2version minor | ||
|
||
bump-major: | ||
bump2version major | ||
|
||
bump-patch: | ||
bump2version patch |
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 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 +1,2 @@ | ||
from .client import FrameioClient | ||
from .utils import stream |
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 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 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,43 @@ | ||
import requests | ||
import math | ||
import concurrent.futures | ||
import threading | ||
|
||
thread_local = threading.local() | ||
|
||
class FrameioUploader(object): | ||
def __init__(self, asset, file): | ||
self.asset = asset | ||
self.file = file | ||
|
||
def _read_chunk(self, file, size): | ||
while True: | ||
data = file.read(size) | ||
if not data: | ||
break | ||
yield data | ||
|
||
def _get_session(self): | ||
if not hasattr(thread_local, "session"): | ||
thread_local.session = requests.Session() | ||
return thread_local.session | ||
|
||
def _upload_chunk(self, task): | ||
url = task[0] | ||
chunk = task[1] | ||
session = self._get_session() | ||
|
||
session.put(url, data=chunk, headers={ | ||
'content-type': self.asset['filetype'], | ||
'x-amz-acl': 'private' | ||
}) | ||
|
||
def upload(self): | ||
total_size = self.asset['filesize'] | ||
upload_urls = self.asset['upload_urls'] | ||
size = int(math.ceil(total_size / len(upload_urls))) | ||
|
||
with concurrent.futures.ThreadPoolExecutor(max_workers=5) as executor: | ||
for i, chunk in enumerate(self._read_chunk(self.file, size)): | ||
task = (upload_urls[i], chunk) | ||
executor.submit(self._upload_chunk, task) |
Oops, something went wrong.