-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f3c2ebc
commit f588275
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: test-on-PR | ||
|
||
on: [push pull_request workflow_dispatch] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# check out repo; set up recent python | ||
- name: Check out repo | ||
uses: actions/checkout@v4 | ||
- name: Set up python | ||
id: setup-python | ||
uses: actions/setup-python@v | ||
with: | ||
python-version: '3.12' | ||
|
||
# install and configure poetry | ||
- name: Install poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
installer-parallel: true | ||
|
||
# load cached venv if it exsists | ||
- name: Load cached venv | ||
id: cached-poetry-dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: .venv | ||
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | ||
|
||
# install dependencies when no cache | ||
- name: Install dependencies | ||
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | ||
run: poetry install --no-interaction --no-root | ||
|
||
# install the project | ||
- name: Install n100tickers | ||
run: poetry install --no-interaction | ||
|
||
# now test | ||
- name: Run test suite | ||
run: | | ||
source .venv/bin/activate | ||
pytest | ||