Skip to content

Commit

Permalink
push to dockerhub with actions
Browse files Browse the repository at this point in the history
  • Loading branch information
mikedh committed Mar 3, 2020
1 parent 427ce64 commit 268bbdd
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 21 deletions.
19 changes: 0 additions & 19 deletions .circleci/config.yml

This file was deleted.

10 changes: 9 additions & 1 deletion .github/workflows/pythonpublish.yml
Expand Up @@ -63,25 +63,33 @@ jobs:
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Login to Docker Hub
run: docker login -u ${{ secrets.DH_USER }} -p ${{ secrets.DH_PASS }}
- name: Checkout trimesh
uses: actions/checkout@v2
- name: Build, tag, and push to DockerHub and AWS ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY }}
GIT_SHA: ${{ github.sha }}
DH_IMAGE: mikedh/trimesh
run: |
# get the version of trimesh with python
export TRIMESH_VERSION=$(python -c "exec(open('trimesh/version.py','r').read()); print(__version__)")
# tag the image with the short git sha
export IMAGE_TAG=${GIT_SHA::7}
docker build -t mikedh/trimesh:latest -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -t $ECR_REGISTRY/$ECR_REPOSITORY:latest -t $ECR_REGISTRY/$ECR_REPOSITORY:$TRIMESH_VERSION .
docker build -t mikedh/trimesh:latest -t mikedh/trimesh:$TRIMESH_VERSION -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -t $ECR_REGISTRY/$ECR_REPOSITORY:latest -t $ECR_REGISTRY/$ECR_REPOSITORY:$TRIMESH_VERSION .
# push image to AWS ECR tagged by sha
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
# push image to ECR tagged latest
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
# push image to ECR tagged with trimesh version
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$TRIMESH_VERSION
# push image to Docker Hub
docker push $DH_IMAGE:latest
# push image to Docker Hub tagged by trimesh version
docker push $DH_IMAGE:$TRIMESH_VERSION
- name: Logout of registries
if: always()
run: |
Expand Down
32 changes: 32 additions & 0 deletions tests/test_except.py
@@ -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()
5 changes: 5 additions & 0 deletions trimesh/exceptions.py
Expand Up @@ -20,6 +20,11 @@ def __init__(self, exc):
self.exc = exc

def __getattribute__(self, *args, **kwargs):
# if it's asking for our class type return None
# this allows isinstance() checks to not re-raise
if args[0] == '__class__':
return None.__class__
# otherwise return our original exception
raise super(ExceptionModule, self).__getattribute__('exc')


Expand Down
2 changes: 1 addition & 1 deletion trimesh/version.py
@@ -1 +1 @@
__version__ = '3.5.26'
__version__ = '3.5.27'

0 comments on commit 268bbdd

Please sign in to comment.