Skip to content

Commit

Permalink
Trigger pytest for any changes in package and tests dir
Browse files Browse the repository at this point in the history
  • Loading branch information
dormant-user committed Aug 12, 2023
1 parent 70177da commit acafbae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
14 changes: 4 additions & 10 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,16 @@ jobs:
id: check-changes
run: |
files_changed=$(git diff --name-only "${{ github.event.before }}" "${{ github.sha }}")
changes_in_folder=false
for file in $files_changed; do
if [[ $file == "thronetrader/"* && $file != "thronetrader/__init__.py" && $file != "thronetrader/requirements.txt" ]]; then
changes_in_folder=true
break
fi
done
echo "Changes: ${files_changed}"
if [[ "${{ env.changes_in_folder }}" == 'true' ]]; then
if [[ $files_changed =~ "tests/"* || $files_changed =~ "thronetrader/"* ]]; then
echo "changes_in_folder=true" >> $GITHUB_ENV
echo "Changes identified in package. Running pytest."
else
echo "changes_in_folder=false" >> $GITHUB_ENV
echo "No changes were found in package. Skipping pytest."
fi
echo "changes_in_folder=$changes_in_folder" >> $GITHUB_ENV
- name: Install dependencies and run functional tests
- name: Install dependencies and run pytest
if: env.changes_in_folder == 'true'
run: |
python -m pip install --upgrade pip
Expand Down
4 changes: 4 additions & 0 deletions tests/test_functionalities.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,7 @@ def test_predictions(self):
linear = predictions.linear_regression_prediction()
assert linear is None or (isinstance(gradient, dict) and
tuple(gradient.keys()) == ('ticker', 'signal', 'signal_rate', 'recommendation'))


if __name__ == '__main__':
unittest.main()

0 comments on commit acafbae

Please sign in to comment.