Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Remove mypy deps install step in python_cache action #3956

Merged
merged 3 commits into from
Jan 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions .github/actions/python_cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,6 @@ runs:
# The cache will be rebuild every day and at every change of the dependency files
key: ${{ inputs.prefix }}-py${{ inputs.pythonVersion }}-${{ env.date }}-${{ hashFiles('**/pyproject.toml') }}

- name: Cache Mypy path
id: cache-mypy
uses: actions/cache@v3
with:
path: ${{ env.pythonLocation }}/.mypy_cache
# The cache will be rebuild every day and at every change of the dependency files
key: mypy-${{ inputs.prefix }}-py${{ inputs.pythonVersion }}-${{ env.date }}-${{ hashFiles('**/pyproject.toml') }}

- name: Install dependencies
# NOTE: this action runs only on cache miss to refresh the dependencies and make sure the next Haystack install will be faster.
# Do not rely on this step to install Haystack itself!
Expand All @@ -60,8 +52,3 @@ runs:
python -m pip install --upgrade pip
pip install .[all]
pip install rest_api/
- name: Install mypy dependencies
shell: bash
if: inputs.pythonVersion != 3.7
run: python -m mypy --install-types --non-interactive --cache-dir=${{ env.pythonLocation }}/.mypy_cache/ haystack/ rest_api/ --exclude=rest_api/build/ --exclude=rest_api/test/
20 changes: 7 additions & 13 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,12 @@ jobs:
- name: Get changed files
id: files
uses: tj-actions/changed-files@v34

- name: Filter changed files
id: python-files
run: |
for file in ${{ steps.files.outputs.all_changed_files }}; do
if [[ $file == *.py ]]; then
if [[ $file != test/* ]]; then
changed_files="$changed_files $file"
fi
fi
done
echo "changed_files=$changed_files" >> $GITHUB_OUTPUT
with:
files: |
*.py
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I forgot. Adding that.

files_ignore: |
test/**
rest_api/test/**
- name: Setup Python
uses: ./.github/actions/python_cache/
Expand All @@ -109,7 +103,7 @@ jobs:
if: steps.python-files.outputs.changed_files
run: |
mkdir .mypy_cache/
mypy ${{ steps.python-files.outputs.changed_files }}
mypy --install-types --non-interactive ${{ steps.python-files.outputs.changed_files }} --exclude=rest_api/build/ --exclude=rest_api/test/
Copy link
Contributor

@masci masci Jan 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: you don't need to exclude anything at this point (provided you filter out changed files)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True that, but might as well leave it I guess? Better safe than sorry. 🤷

- uses: act10ns/slack@v1
with:
Expand Down