Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
403 additions
and
197 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,133 @@ | ||
name: Test And Publish | ||
|
||
on: | ||
push: | ||
branches: | ||
- actions | ||
jobs: | ||
|
||
formatting: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.8 | ||
- name: Install Formatting | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install autopep8 flake8 | ||
- name: Check Formatting | ||
run: | | ||
flake8 tests | ||
flake8 trimesh | ||
flake8 examples | ||
autopep8 --recursive --aggressive --diff --exit-code trimesh/ | ||
autopep8 --recursive --aggressive --diff --exit-code examples/ | ||
autopep8 --recursive --aggressive --diff --exit-code tests/ | ||
tests: | ||
needs: formatting | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
python-version: [2.7, 3.5, 3.6, 3.7, 3.8] | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install Pytest | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install pytest pytest-cov | ||
- name: Install Trimesh And Test | ||
run: | | ||
pip install .[easy] | ||
pytest | ||
pypi: | ||
needs: tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: '3.x' | ||
- name: Install publishing dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install setuptools wheel twine | ||
- name: Build and publish | ||
env: | ||
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | ||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
run: | | ||
python setup.py sdist bdist_wheel | ||
twine upload dist/* | ||
docs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: '3.x' | ||
- name: Install From APT | ||
run: | | ||
apt-get update -qq -y | ||
apt-get install -qq -y pandoc | ||
- name: Install From Pip | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r docs/requirements.txt | ||
- name: Build Docs | ||
run: python docs/build.py | ||
- name: Deploy To Pages | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./docs/html | ||
|
||
containers: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: us-east-2 | ||
- name: Login to Amazon ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
- name: Login to Docker Hub | ||
run: echo ${{ secrets.DH_PASS }} | docker login --username mikedh --password-stdin | ||
- name: Checkout trimesh | ||
uses: actions/checkout@v2 | ||
- name: Build/Push to DockerHub and AWS ECR | ||
env: | ||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY }} | ||
GIT_SHA: ${{ github.sha }} | ||
run: | | ||
# get the version of trimesh with python | ||
export VERSION=$(python -c "exec(open('trimesh/version.py','r').read()); print(__version__)") | ||
# tag the image with the short git sha | ||
export GIT_SHORT=${GIT_SHA::7} | ||
# put a whole bunch of tags on image: | ||
# tag with version, git sha, and latest | ||
# push to DockerHub and AWS ECR | ||
export TAGS="trimesh/trimesh:latest; trimesh/trimesh:$VERSION; trimesh/trimesh:$GIT_SHORT; $ECR_REGISTRY/$ECR_REPOSITORY:$VERSION; $ECR_REGISTRY/$ECR_REPOSITORY:latest; $ECR_REGISTRY/$ECR_REPOSITORY:$GIT_SHORT" | ||
# build image tagged with all our many tags | ||
docker build -t `echo "${TAGS//;/$' -t '}"` . | ||
# push every tag to remote registry | ||
for i in ${TAGS//;/ }; do docker push $i; done; | ||
- name: Logout of registries | ||
if: always() | ||
run: | | ||
docker logout ${{ steps.login-ecr.outputs.registry }} | ||
docker logout |
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
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
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,32 @@ | ||
try: | ||
from . import generic as g | ||
except BaseException: | ||
import generic as g | ||
|
||
|
||
class ExceptionsTest(g.unittest.TestCase): | ||
|
||
def test_module(self): | ||
# create an ExceptionModule | ||
try: | ||
raise ValueError('nah') | ||
except BaseException as E: | ||
em = g.trimesh.exceptions.ExceptionModule(E) | ||
|
||
# checking isinstance should always return false | ||
# and NOT raise the error | ||
assert not isinstance(em, dict) | ||
|
||
try: | ||
# should re-raise `ValueError('nah')` | ||
em.hi() | ||
# if we're here raise an error we don't catch | ||
raise NameError('should not have worked!!') | ||
except ValueError: | ||
# should have re-raised ValueError | ||
pass | ||
|
||
|
||
if __name__ == '__main__': | ||
g.trimesh.util.attach_to_log() | ||
g.unittest.main() |
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
Oops, something went wrong.