Skip to content

Commit

Permalink
Enable caching of poetry dependencies in github actions (#353)
Browse files Browse the repository at this point in the history
Attempt to speed up github actions by caching poetry dependencies.

Also install poetry before python and use working directory instead of `cd`.

---------

Co-authored-by: Amir Feizpour <[email protected]>
Co-authored-by: Oshoma Momoh <[email protected]>
  • Loading branch information
3 people authored May 2, 2024
1 parent 54dc2cf commit a115d64
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 28 deletions.
24 changes: 10 additions & 14 deletions .github/workflows/offline_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,22 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Install poetry
run: pipx install poetry

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
cache: "poetry"

# Install poetry with virtualenvs disabled for tests
- name: Install poetry and dependencies
- name: Install dependencies
working-directory: ./src
run: |
python -m pip install --upgrade pip
python -m pip install poetry
cd src
poetry install
# en_core_web_sm required by spacy needs to be installed separately
- name: Install extra dependencies
run: |
cd src
poetry run python -m spacy download en_core_web_sm
poetry run python -m spacy download en_core_web_sm
- name: Run tests
run: |
cd src
poetry run pytest --cov=sherpa_ai tests
working-directory: ./src
run:
poetry run pytest --cov=sherpa_ai tests
23 changes: 9 additions & 14 deletions .github/workflows/online_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,20 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Install poetry
run: pipx install poetry

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
cache: "poetry"

# Install poetry with virtualenvs disabled for tests
- name: Install poetry and dependencies
- name: Install dependencies
working-directory: ./src
run: |
python -m pip install --upgrade pip
python -m pip install poetry
cd src
poetry config virtualenvs.create false
poetry install
# en_core_web_sm required by spacy needs to be installed separately
- name: Install extra dependencies
run: |
cd src
poetry run python -m spacy download en_core_web_sm
poetry run python -m spacy download en_core_web_sm
- name: Run tests
env:
Expand All @@ -43,6 +38,6 @@ jobs:
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUBOATHKEY }}
DAILY_TOKEN_LIMIT: ${{ secrets.TOKENLIMIT }}
TEMPRATURE: ${{ secrets.TEMPRATURE }}
run: |
cd src
working-directory: ./src
run:
poetry run pytest --external_api --cov=sherpa_ai tests

0 comments on commit a115d64

Please sign in to comment.