Skip to content

Commit

Permalink
Add -e flag to some GH workflow yml files (huggingface#16959)
Browse files Browse the repository at this point in the history
* Add -e flag

* add check

* create new keys

* run python setup.py build install

* add comments

* change to develop

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
  • Loading branch information
ydshieh and ydshieh authored Apr 27, 2022
1 parent 596afb4 commit 992996e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
17 changes: 15 additions & 2 deletions .github/workflows/add-model-like.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
17 changes: 15 additions & 2 deletions .github/workflows/model-templates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down

0 comments on commit 992996e

Please sign in to comment.