Skip to content

Commit

Permalink
Merge pull request #21 from globality-corp/release/0.10.0
Browse files Browse the repository at this point in the history
Bump version to 0.10.0
  • Loading branch information
JP-Globality authored Jul 22, 2021
2 parents 359154d + 77ea7d5 commit e16402d
Show file tree
Hide file tree
Showing 18 changed files with 332 additions and 208 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.9.0
current_version = 0.10.0
commit = False
tag = False

Expand Down
186 changes: 149 additions & 37 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,68 +10,108 @@
# See: http://github.com/globality-corp/globality-build
#
#
version: 2.1


executors:
node-executor:
working_directory: ~/repo
docker:
- image: circleci/node:14.16.1
environment:
EXTRA_INDEX_URL: "InjectedDuringRuntime"
AWS_ECR_DOMAIN: "InjectedDuringRuntime"
JFROG_AUTH: "InjectedDuringRuntime"
APOLLO_ENGINE_API_KEY: "InjectedDuringRuntime"

globality-build-executor:
working_directory: ~/repo
docker:
- image: ${AWS_ECR_DOMAIN}/globality-build:2021.21.1
aws_auth:
aws_access_key_id: ${AWS_ACCESS_KEY_ID}
aws_secret_access_key: ${AWS_SECRET_ACCESS_KEY}
environment:
EXTRA_INDEX_URL: "InjectedDuringRuntime"
AWS_ECR_DOMAIN: "InjectedDuringRuntime"
JFROG_AUTH: "InjectedDuringRuntime"

defaults: &defaults
working_directory: ~/repo
docker:
- image: ${AWS_ECR_DOMAIN}/globality-build:2019.18.1
- image: ${AWS_ECR_DOMAIN}/globality-build:2021.21.1
aws_auth:
aws_access_key_id: ${AWS_ACCESS_KEY_ID}
aws_secret_access_key: ${AWS_SECRET_ACCESS_KEY}
environment:
EXTRA_INDEX_URL: "InjectedDuringRuntime"
AWS_ECR_DOMAIN: "InjectedDuringRuntime"
JFROG_AUTH: "InjectedDuringRuntime"
PYPI_AUTH_TOKEN: "InjectedDuringRuntime"
PYPI_USERNAME: "InjectedDuringRuntime"
PYPI_PASSWORD: "InjectedDuringRuntime"

deploy_defaults: &deploy_defaults
working_directory: ~/repo
docker:
- image: ${AWS_ECR_DOMAIN}/globality-build:2019.18.1
- image: ${AWS_ECR_DOMAIN}/globality-build:2021.21.1
aws_auth:
aws_access_key_id: ${AWS_ACCESS_KEY_ID}
aws_secret_access_key: ${AWS_SECRET_ACCESS_KEY}
environment:
EXTRA_INDEX_URL: "InjectedDuringRuntime"
AWS_ECR_DOMAIN: "InjectedDuringRuntime"
JFROG_AUTH: "InjectedDuringRuntime"
PYPI_AUTH_TOKEN: "InjectedDuringRuntime"
PYPI_USERNAME: "InjectedDuringRuntime"
PYPI_PASSWORD: "InjectedDuringRuntime"


whitelist: &whitelist
paths:
.

version: 2

jobs:
checkout:
<<: *defaults

steps:
- checkout


- persist_to_workspace:
root: ~/repo
<<: *whitelist

build_base_docker:
build_docker:
<<: *defaults

steps:
- attach_workspace:
at: ~/repo

- setup_remote_docker
- setup_remote_docker:
version: 19.03.12
docker_layer_caching: true

- run:
name: Build Base Docker
# install dependencies for loading ecs task definitions
name: Login AWS ECR
command: |
aws ecr get-login-password --region ${AWS_DEFAULT_REGION} | docker login --username AWS --password-stdin ${AWS_ECR_DOMAIN}
- run:
name: Build Docker - Application Service Code
command: |
eval $(aws ecr get-login --no-include-email)
globality-build docker-base --repo python-library
globality-build docker --repo python-library
# pwd is here to prevent error when pre_docker_build returns nothing
pwd
docker build --tag $AWS_ECR_DOMAIN/python-library:$CIRCLE_SHA1 \
--build-arg BUILD_NUM=$CIRCLE_BUILD_NUM \
--build-arg SHA1=$CIRCLE_SHA1 \
--build-arg EXTRA_INDEX_URL=$EXTRA_INDEX_URL \
--build-arg JFROG_AUTH=$JFROG_AUTH .
docker push $AWS_ECR_DOMAIN/python-library:$CIRCLE_SHA1
test:
<<: *defaults
Expand All @@ -80,109 +120,181 @@ jobs:
- attach_workspace:
at: ~/repo

- setup_remote_docker
- setup_remote_docker:
version: 19.03.12
docker_layer_caching: true

- run:
name: Login AWS ECR
command: |
aws ecr get-login-password --region ${AWS_DEFAULT_REGION} | docker login --username AWS --password-stdin ${AWS_ECR_DOMAIN}
- run:
name: Test code
name: Copy service tests to volume
command: |
docker create -v /src/microcosm_caching/tests/ --name service_tests alpine:3.4 /bin/true
docker create -v /src/microcosm_caching/tests/ --name service_tests alpine:3.11 /bin/true
docker cp $(pwd)/microcosm_caching/tests service_tests:/src/microcosm_caching/
eval $(aws ecr get-login --no-include-email)
docker pull ${AWS_ECR_DOMAIN}/python-library:${CIRCLE_SHA1}
- run:
name: Run Test
command: |
docker run -it --volumes-from service_tests ${AWS_ECR_DOMAIN}/python-library:${CIRCLE_SHA1} test
lint:
<<: *defaults

steps:
- attach_workspace:
at: ~/repo

- setup_remote_docker
- setup_remote_docker:
version: 19.03.12
docker_layer_caching: true

- run:
name: Run Lint
name: Login AWS ECR
command: |
docker create -v /src/microcosm_caching/tests/ --name service_tests alpine:3.4 /bin/true
aws ecr get-login-password --region ${AWS_DEFAULT_REGION} | docker login --username AWS --password-stdin ${AWS_ECR_DOMAIN}
- run:
name: Copy service tests to volume
command: |
docker create -v /src/microcosm_caching/tests/ --name service_tests alpine:3.11 /bin/true
docker cp $(pwd)/microcosm_caching/tests service_tests:/src/microcosm_caching/
eval $(aws ecr get-login --no-include-email)
docker pull ${AWS_ECR_DOMAIN}/python-library:${CIRCLE_SHA1}
- run:
name: Run Lint
command: |
docker run -it --volumes-from service_tests ${AWS_ECR_DOMAIN}/python-library:${CIRCLE_SHA1} lint
typehinting:
<<: *defaults

steps:
- attach_workspace:
at: ~/repo

- setup_remote_docker
- setup_remote_docker:
version: 19.03.12
docker_layer_caching: true

- run:
name: Run Typehinting
name: Login AWS ECR
command: |
docker create -v /src/microcosm_caching/tests/ --name service_tests alpine:3.4 /bin/true
aws ecr get-login-password --region ${AWS_DEFAULT_REGION} | docker login --username AWS --password-stdin ${AWS_ECR_DOMAIN}
- run:
name: Copy service tests to volume
command: |
docker create -v /src/microcosm_caching/tests/ --name service_tests alpine:3.11 /bin/true
docker cp $(pwd)/microcosm_caching/tests service_tests:/src/microcosm_caching/
eval $(aws ecr get-login --no-include-email)
docker pull ${AWS_ECR_DOMAIN}/python-library:${CIRCLE_SHA1}
- run:
name: Run Typehinting
command: |
docker run -it --volumes-from service_tests ${AWS_ECR_DOMAIN}/python-library:${CIRCLE_SHA1} typehinting
deploy_pypi:
deploy_jfrog_rc:
<<: *defaults
steps:
- attach_workspace:
at: ~/repo
- run:
name: Deploy
command: |
echo "Not publishing package!"
publish_library:
<<: *defaults
steps:
- attach_workspace:
at: ~/repo
- run:
name: Publish
command: |
echo "[distutils]" > ~/.pypirc
echo "index-servers =" >> ~/.pypirc
echo " pypi " >> ~/.pypirc
echo >> ~/.pypirc
echo "[pypi]" >> ~/.pypirc
echo "repository:https://upload.pypi.org/legacy/" >> ~/.pypirc
echo "username:$PYPI_USERNAME" >> ~/.pypirc
echo "password:$PYPI_PASSWORD" >> ~/.pypirc
echo "repository = https://upload.pypi.org/legacy/" >> ~/.pypirc
echo "username = __token__" >> ~/.pypirc
echo "password = ${PYPI_AUTH_TOKEN}" >> ~/.pypirc
echo >> ~/.pypirc
version=$(cat .bumpversion.cfg | awk '/current_version / {print $3}')
python setup.py register -r pypi
python setup.py sdist upload -r pypi
python setup.py sdist
twine upload --repository pypi dist/microcosm-caching-${version}.tar.gz
workflows:
version: 2

build-and-release:
jobs:
- checkout:
context:
- Globality-Common
filters:
# run for all branches and tags
tags:
only: /.*/
- build_base_docker:
- build_docker:
context:
- Globality-Common
requires:
- checkout
filters:
# run for all branches and tags
tags:
only: /.*/
- lint:
context:
- Globality-Common
requires:
- build_base_docker
- build_docker
filters:
# run for all branches and tags
tags:
only: /.*/
- test:
context:
- Globality-Common
requires:
- build_base_docker
- build_docker
filters:
# run for all branches and tags
tags:
only: /.*/
- deploy_jfrog_rc:
context:
- Globality-Common
requires:
- test
- lint
- typehinting
- typehinting:
context:
- Globality-Common
requires:
- build_base_docker
- build_docker
filters:
# run for all branches and tags
tags:
only: /.*/
- deploy_pypi:
- publish_library:
context:
- Globality-Common
requires:
- test
- lint
Expand Down
9 changes: 6 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
*
!microcosm_caching
microcosm_caching/test*
microcosm_caching/tests
!dist/*-none-any.whl
!entrypoint.sh
!MANIFEST.in
!README.md
!requirements.txt
!HISTORY.rst
!requirements*.txt
!setup.py
!setup.cfg
!mypy.ini
!pyproject.toml
!conftest.py
**/*.pyc
**/*~

2 changes: 1 addition & 1 deletion .globality/build.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
}
},
"type": "python-library",
"version": "2019.18.1"
"version": "2021.21.1"
}
Loading

0 comments on commit e16402d

Please sign in to comment.