From 992996e9caf0c51a7a846e71cb89c175a47d820a Mon Sep 17 00:00:00 2001 From: Yih-Dar <2521628+ydshieh@users.noreply.github.com> Date: Wed, 27 Apr 2022 21:44:21 +0200 Subject: [PATCH] Add -e flag to some GH workflow yml files (#16959) * Add -e flag * add check * create new keys * run python setup.py build install * add comments * change to develop Co-authored-by: ydshieh --- .github/workflows/add-model-like.yml | 17 +++++++++++++++-- .github/workflows/model-templates.yml | 17 +++++++++++++++-- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/.github/workflows/add-model-like.yml b/.github/workflows/add-model-like.yml index b3f6f241d9..b6e8126616 100644 --- a/.github/workflows/add-model-like.yml +++ b/.github/workflows/add-model-like.yml @@ -27,14 +27,27 @@ jobs: id: cache with: path: ~/venv/ - key: v2-tests_model_like-${{ hashFiles('setup.py') }} + key: v3-tests_model_like-${{ hashFiles('setup.py') }} - name: Create virtual environment on cache miss if: steps.cache.outputs.cache-hit != 'true' run: | python -m venv ~/venv && . ~/venv/bin/activate pip install --upgrade pip!=21.3 - pip install .[dev] + pip install -e .[dev] + + - name: Check transformers location + # make `transformers` available as package (required since we use `-e` flag) and check it's indeed from the repo. + run: | + . ~/venv/bin/activate + python setup.py develop + transformer_loc=$(pip show transformers | grep "Location: " | cut -c11-) + transformer_repo_loc=$(pwd .) + if [ "$transformer_loc" != "$transformer_repo_loc/src" ]; then + echo "transformers is from $transformer_loc but it shoud be from $transformer_repo_loc/src." + echo "A fix is required. Stop testing." + exit 1 + fi - name: Create model files run: | diff --git a/.github/workflows/model-templates.yml b/.github/workflows/model-templates.yml index e6d6300555..3fafffb6af 100644 --- a/.github/workflows/model-templates.yml +++ b/.github/workflows/model-templates.yml @@ -33,14 +33,27 @@ jobs: id: cache with: path: ~/venv/ - key: v2-tests_templates-${{ hashFiles('setup.py') }} + key: v3-tests_templates-${{ hashFiles('setup.py') }} - name: Create virtual environment on cache miss if: steps.cache.outputs.cache-hit != 'true' run: | python -m venv ~/venv && . ~/venv/bin/activate pip install --upgrade pip!=21.3 - pip install .[dev] + pip install -e .[dev] + + - name: Check transformers location + # make `transformers` available as package (required since we use `-e` flag) and check it's indeed from the repo. + run: | + . ~/venv/bin/activate + python setup.py develop + transformer_loc=$(pip show transformers | grep "Location: " | cut -c11-) + transformer_repo_loc=$(pwd .) + if [ "$transformer_loc" != "$transformer_repo_loc/src" ]; then + echo "transformers is from $transformer_loc but it shoud be from $transformer_repo_loc/src." + echo "A fix is required. Stop testing." + exit 1 + fi - name: Create model files run: |