diff --git a/.zuul.yaml b/.zuul.yaml index fc930b2b..a440cbb7 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -522,6 +522,17 @@ node_version: 14 js_build_command: test:unit +- job: + name: publish-skyline-console-python-branch-tarball + parent: publish-openstack-artifacts + description: | + Publish the results tar.gz and whl packages to tarballs.openstack.org. + pre-run: playbooks/python-tarball/pre.yaml + run: playbooks/python-tarball/run.yaml + post-run: playbooks/python-tarball/post.yaml + vars: + release_python: python3 + - project: check: jobs: @@ -649,3 +660,6 @@ irrelevant-files: *e2etests-other-irrelevant-files - skyline-console-devstack-e2etests-storage: irrelevant-files: *e2etests-storage-irrelevant-files + post: + jobs: + - publish-skyline-console-python-branch-tarball diff --git a/playbooks/python-tarball/post.yaml b/playbooks/python-tarball/post.yaml new file mode 100644 index 00000000..c17a3338 --- /dev/null +++ b/playbooks/python-tarball/post.yaml @@ -0,0 +1,35 @@ +- hosts: all + tasks: + - name: Find tarballs and wheels in dist folder + find: + file_type: file + paths: "src/{{ zuul.project.canonical_name }}/dist" + patterns: "*.tar.gz,*.whl" + register: result + + - name: Display stat for tarballs and wheels + stat: + path: "{{ zj_tarball_wheel.path }}" + with_items: "{{ result.files }}" + loop_control: + loop_var: zj_tarball_wheel + + - name: Ensure artifacts directory exists + file: + path: "{{ zuul.executor.work_root }}/artifacts" + state: directory + mode: 0755 + delegate_to: localhost + + - name: Collect artifacts + synchronize: + dest: "{{ zuul.executor.work_root }}/artifacts/" + mode: pull + src: "{{ zj_artifact.path }}" + verify_host: true + owner: no + group: no + with_items: "{{ result.files }}" + loop_control: + loop_var: zj_artifact + diff --git a/playbooks/python-tarball/pre.yaml b/playbooks/python-tarball/pre.yaml new file mode 100644 index 00000000..5a3f34de --- /dev/null +++ b/playbooks/python-tarball/pre.yaml @@ -0,0 +1,5 @@ +- hosts: all + roles: + # We use ensure-pip to make sure the wheel module is installed + - ensure-pip + - revoke-sudo diff --git a/playbooks/python-tarball/run.yaml b/playbooks/python-tarball/run.yaml new file mode 100644 index 00000000..57016808 --- /dev/null +++ b/playbooks/python-tarball/run.yaml @@ -0,0 +1,38 @@ +- hosts: all + tasks: + - name: Install tox, nvm, nodejs and yarn + shell: + executable: /bin/bash + cmd: | + # nvm + wget -P $HOME --tries=10 --retry-connrefused --waitretry=60 --no-dns-cache --no-cache https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh + bash $HOME/install.sh + . $HOME/.nvm/nvm.sh + # nodejs + NODE_VERSION=erbium + nvm install --lts=$NODE_VERSION + nvm alias default lts/$NODE_VERSION + nvm use default + # yarn + npm install -g yarn + # tox + pip3 install tox + + - name: Build tarball and wheel + shell: + executable: /bin/bash + cmd: | + . $HOME/.nvm/nvm.sh + $HOME/.local/bin/tox -e package + args: + chdir: "src/{{ zuul.project.canonical_name }}" + + - name: Rename whl files to branch specific name + shell: "mv skyline_console*.whl skyline_console-{{ zuul.branch | replace('/', '-') }}.whl" + args: + chdir: "src/{{ zuul.project.canonical_name }}/dist" + + - name: Rename tar.gz files to branch specific name + shell: "mv skyline-console*.tar.gz skyline-console-{{ zuul.branch | replace('/', '-') }}.tar.gz" + args: + chdir: "src/{{ zuul.project.canonical_name }}/dist" diff --git a/tox.ini b/tox.ini new file mode 100644 index 00000000..2fd1ca8d --- /dev/null +++ b/tox.ini @@ -0,0 +1,20 @@ +[tox] +minversion = 3.18.0 +# python runtimes: https://governance.openstack.org/tc/reference/runtimes/ussuri.html +envlist = package +skipsdist=true +# this allows tox to infer the base python from the environment name +# and override any basepython configured in this file +ignore_basepython_conflict=true +isolated_build=true + +[testenv] +# Set default python version +basepython = python3 +whitelist_externals = + make +deps = poetry != 1.1.8 + +[testenv:package] +commands = + make package