From 77cb7d379b58f39c78824e06727894b2a452ef74 Mon Sep 17 00:00:00 2001 From: Egor Miasnikov Date: Mon, 5 Apr 2021 17:59:44 +0300 Subject: [PATCH 1/2] feat: publish packages to nexus --- .github/workflows/package-publish.yml | 67 +++++++++++++++++++++++++++ setup.py | 4 +- src/transformers/__init__.py | 2 +- 3 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/package-publish.yml diff --git a/.github/workflows/package-publish.yml b/.github/workflows/package-publish.yml new file mode 100644 index 000000000000..9a806eb5406d --- /dev/null +++ b/.github/workflows/package-publish.yml @@ -0,0 +1,67 @@ +name: Publish + +on: + pull_request: + branches: + - master +env: + GKE_ZONE: us-east4 +jobs: + setup-build-publish: + name: Setup, Build, Publish + runs-on: [self-hosted, low2c8gi] + + steps: + - name: get ENV shortname + run: | + if [[ "${{ github.event_name }}" == 'pull_request' ]]; then + branch=${GITHUB_BASE_REF} + elif [[ "${{ github.event_name }}" == 'push' ]]; then + branch=${GITHUB_REF##*/} + else + echo "Incorrect event type: ${{ github.event_name }}" + exit 1 + fi + + case $branch in + main) + echo "dev is for main" + echo "ENV_SHORT=dev" >> $GITHUB_ENV + echo "ENV_SECRET=DEV_GKE_SA_KEY" >> $GITHUB_ENV + ;; + esac + echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-7`" >> $GITHUB_ENV + + - name: Checkout + uses: actions/checkout@v2 + + - name: Install Python + uses: actions/setup-python@v1 + with: + python-version: 3.6 + + - uses: google-github-actions/setup-gcloud@v0.2.1 + with: + service_account_key: ${{ secrets[env.ENV_SECRET] }} + project_id: elementalcognition-app-${{ env.ENV_SHORT }} + + - name: Auth Docker + run: |- + gcloud --quiet auth configure-docker + + - name: Get GKE credentials + run: |- + gcloud container clusters get-credentials gke-ec-${{ env.ENV_SHORT }}-1 --zone "$GKE_ZONE" + + - name: Install + run: |- + pip install setuptools wheel twine + pip install -e . + + - name: Build + run: |- + python setup.py sdist bdist_wheel + + - name: Publish + run: |- + twine upload dist/* -r transformers --repository-url=https://nexus.src.elementalcognition.com/service/rest/repository/pypi-all/ -p anonymous -u anonymous \ No newline at end of file diff --git a/setup.py b/setup.py index 87c18390fd06..30a2143b046e 100644 --- a/setup.py +++ b/setup.py @@ -63,6 +63,8 @@ import os import re import shutil + +import transformers from distutils.core import Command from pathlib import Path @@ -282,7 +284,7 @@ def run(self): setup( name="transformers", - version="4.4.0.dev0", # expected format is one of x.y.z.dev0, or x.y.z.rc1 or x.y.z (no to dashes, yes to dots) + version=transformers.__version__, # expected format is one of x.y.z.dev0, or x.y.z.rc1 or x.y.z (no to dashes, yes to dots) author="Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Sam Shleifer, Patrick von Platen, Sylvain Gugger, Google AI Language Team Authors, Open AI team Authors, Facebook AI Authors, Carnegie Mellon University Authors", author_email="thomas@huggingface.co", description="State-of-the-art Natural Language Processing for TensorFlow 2.0 and PyTorch", diff --git a/src/transformers/__init__.py b/src/transformers/__init__.py index 0856c68edcf3..4d970c10d7a9 100755 --- a/src/transformers/__init__.py +++ b/src/transformers/__init__.py @@ -22,7 +22,7 @@ # to defer the actual importing for when the objects are requested. This way `import transformers` provides the names # in the namespace without actually importing anything (and especially none of the backends). -__version__ = "4.4.0.dev0" +__version__ = "4.4.0.dev1" # Work around to update TensorFlow's absl.logging threshold which alters the # default Python logging output behavior when present. From 6971cebd76191c75bb9d6cfccfae19af6009977d Mon Sep 17 00:00:00 2001 From: Michael Serchenia <76994369+mike-serchenia@users.noreply.github.com> Date: Tue, 6 Apr 2021 14:49:59 +0300 Subject: [PATCH 2/2] Update package-publish.yml --- .github/workflows/package-publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/package-publish.yml b/.github/workflows/package-publish.yml index 9a806eb5406d..748e89b05e40 100644 --- a/.github/workflows/package-publish.yml +++ b/.github/workflows/package-publish.yml @@ -9,7 +9,7 @@ env: jobs: setup-build-publish: name: Setup, Build, Publish - runs-on: [self-hosted, low2c8gi] + runs-on: [self-hosted, Linux, X64, low2c8gi] steps: - name: get ENV shortname @@ -64,4 +64,4 @@ jobs: - name: Publish run: |- - twine upload dist/* -r transformers --repository-url=https://nexus.src.elementalcognition.com/service/rest/repository/pypi-all/ -p anonymous -u anonymous \ No newline at end of file + twine upload dist/* -r transformers --repository-url=https://nexus.src.elementalcognition.com/service/rest/repository/pypi-all/ -p anonymous -u anonymous