2626 test-authenticate_with_oidc :
2727 docker :
2828 - image : cimg/base:current
29+ resource_class : small
2930 steps :
3031 - checkout
3132 - cloudsmith-circleci/authenticate_with_oidc :
5354 test-set_env_vars_for_pip :
5455 docker :
5556 - image : cimg/python:3.9
57+ resource_class : small
5658 steps :
5759 - checkout
5860 - cloudsmith-circleci/set_env_vars_for_pip :
@@ -73,19 +75,82 @@ jobs:
7375 fi
7476 echo "All tests passed."
7577
76- test-upload_python_package :
78+ test-set_env_vars_for_twine :
7779 docker :
7880 - image : cimg/python:3.9
81+ resource_class : small
7982 steps :
8083 - checkout
84+ - cloudsmith-circleci/set_env_vars_for_twine :
85+ repository : " circleci-orb-testing"
86+ service_account : " circleci-orb-testing"
8187 - run :
82- name : Prepare distribution
83- command : python setup.py sdist
88+ name : Assert environment variables have been set
89+ command : |
90+ if [ $CLOUDSMITH_TWINE_REPOSITORY_URL != "https://python.cloudsmith.io/financial-times/circleci-orb-testing/" ]
91+ then
92+ echo "Test failed: CLOUDSMITH_TWINE_REPOSITORY_URL has not been set correctly."
93+ exit 1
94+ fi
95+ if [ $CLOUDSMITH_TWINE_USERNAME != "circleci-orb-testing" ]
96+ then
97+ echo "Test failed: CLOUDSMITH_TWINE_USERNAME has not been set correctly."
98+ exit 1
99+ fi
100+ if [ -z $CLOUDSMITH_TWINE_PASSWORD ]
101+ then
102+ echo "Test failed: CLOUDSMITH_TWINE_PASSWORD has not been set."
103+ exit 1
104+ fi
105+ echo "All tests passed."
106+
107+ test-upload_package_using_twine :
108+ docker :
109+ - image : cimg/python:3.9
110+ resource_class : small
111+ steps :
112+ - checkout
113+ - run : python -m ensurepip --upgrade
114+ - run :
115+ name : Build source and wheel distributions
116+ command : |
117+ python -m pip install build --upgrade --user
118+ python -m build
119+ working_directory : .circleci/simplepkg-py
120+ - run :
121+ name : Install twine
122+ command : |
123+ python -m pip install twine --upgrade --user
124+ - cloudsmith-circleci/set_env_vars_for_twine :
125+ repository : " circleci-orb-testing"
126+ service_account : " circleci-orb-testing"
127+ - run :
128+ name : twine upload package to Cloudsmith
129+ command : |
130+ twine upload \
131+ --username $CLOUDSMITH_TWINE_USERNAME \
132+ --password $CLOUDSMITH_TWINE_PASSWORD \
133+ --repository-url $CLOUDSMITH_TWINE_REPOSITORY_URL \
134+ dist/*
135+ working_directory : .circleci/simplepkg-py
136+
137+ test-upload_package_using_cli :
138+ docker :
139+ - image : cimg/python:3.9
140+ resource_class : small
141+ steps :
142+ - checkout
143+ - run : python -m ensurepip --upgrade
144+ - run :
145+ name : Build source and wheel distributions
146+ command : |
147+ python -m pip install build --upgrade --user
148+ python -m build
84149 working_directory : .circleci/simplepkg-py
85150 - cloudsmith-circleci/upload_python_package :
86151 repository : " circleci-orb-testing"
87152 service_account : " circleci-orb-testing"
88- package_path : .circleci/simplepkg-py/dist/simplepkg-0.0.1.tar.gz
153+ dist_dir : .circleci/simplepkg-py/dist
89154
90155workflows :
91156 test-deploy :
@@ -98,9 +163,17 @@ workflows:
98163 - test-set_env_vars_for_pip :
99164 context : circleci-orb-publishing
100165 filters : *filters
101- - test-upload_python_package :
166+ - test-set_env_vars_for_twine :
102167 context : circleci-orb-publishing
103168 filters : *filters
169+ - test-upload_package_using_twine :
170+ context : circleci-orb-publishing
171+ filters : *filters
172+ - test-upload_package_using_cli :
173+ context : circleci-orb-publishing
174+ filters : *filters
175+ requires :
176+ - test-upload_package_using_twine
104177 # The orb must be re-packed for publishing, and saved to the workspace.
105178 - orb-tools/pack :
106179 filters : *release-filters
@@ -113,7 +186,9 @@ workflows:
113186 - orb-tools/pack
114187 - test-authenticate_with_oidc
115188 - test-set_env_vars_for_pip
116- - test-upload_python_package
189+ - test-set_env_vars_for_twine
190+ - test-upload_package_using_twine
191+ - test-upload_package_using_cli
117192 # Use a context to hold your publishing token.
118193 context : circleci-orb-publishing
119194 filters : *release-filters
0 commit comments