Skip to content
This repository has been archived by the owner on Mar 9, 2023. It is now read-only.

Updated config.yml and build.json from new version of globality-build #55

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
200 changes: 163 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.19.0
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:2022.12.0
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:2020.1.11
- image: ${AWS_ECR_DOMAIN}/globality-build:2022.12.0
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:2020.1.11
- image: ${AWS_ECR_DOMAIN}/globality-build:2022.12.0
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 build-gen local
globality-build docker-build-push --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,111 +120,197 @@ 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/sklearn_hierarchical_classification/tests/ --name service_tests alpine:3.4 /bin/true

docker create -v /src/sklearn_hierarchical_classification/tests/ --name service_tests alpine:3.11 /bin/true
docker cp $(pwd)/sklearn_hierarchical_classification/tests service_tests:/src/sklearn_hierarchical_classification/
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/sklearn_hierarchical_classification/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/sklearn_hierarchical_classification/tests/ --name service_tests alpine:3.11 /bin/true
docker cp $(pwd)/sklearn_hierarchical_classification/tests service_tests:/src/sklearn_hierarchical_classification/
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/sklearn_hierarchical_classification/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/sklearn_hierarchical_classification/tests/ --name service_tests alpine:3.11 /bin/true
docker cp $(pwd)/sklearn_hierarchical_classification/tests service_tests:/src/sklearn_hierarchical_classification/
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
name: Deploy # If package publishing enabled, always push RCs to JFrog
command: |
echo "[distutils]" > ~/.pypirc
echo "index-servers =" >> ~/.pypirc
echo " jfrog" >> ~/.pypirc
echo >> ~/.pypirc
echo "[jfrog]" >> ~/.pypirc
echo "repository:https://globality.jfrog.io/globality/api/pypi/pypi" >> ~/.pypirc
echo "username:$JFROG_USERNAME" >> ~/.pypirc
echo "password:$JFROG_PASSWORD" >> ~/.pypirc
echo >> ~/.pypirc
echo >> ~/.pypirc
version=0.${CIRCLE_BUILD_NUM}.dev${CIRCLE_BUILD_NUM}
sed -i '/version \=/s/\".*\"/'"\"${version}\"/" setup.py
python setup.py register -r jfrog
python setup.py sdist
twine upload --repository jfrog dist/sklearn-hierarchical-classification-${version}.tar.gz

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
twine upload --repository pypi dist/sklearn-hierarchical-classification-${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
- Python-Common

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This CCI context doesn't exist.

requires:
- test
- lint
Expand Down
2 changes: 1 addition & 1 deletion .globality/build.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
}
},
"type": "python-library",
"version": "2020.1.11"
"version": "2022.12.0"
}