Also match search subscriptions against organic results #2670
This file contains hidden or 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
| name: Unit Testing | |
| on: | |
| pull_request: | |
| branches: | |
| - master | |
| push: | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: [ 3.12 ] | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Cache virtual environment | |
| id: cache-venv | |
| uses: actions/cache@v3 | |
| with: | |
| path: venv | |
| key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-venv-${{ matrix.python-version }}- | |
| - name: Cache Stanza models | |
| id: cache-stanza | |
| uses: actions/cache@v3 | |
| with: | |
| path: stanza_resources | |
| key: ${{ runner.os }}-stanza-models-v3 | |
| - name: Cache NLTK data | |
| id: cache-nltk | |
| uses: actions/cache@v3 | |
| with: | |
| path: nltk_data | |
| key: ${{ runner.os }}-nltk-data-v2 | |
| restore-keys: | | |
| ${{ runner.os }}-nltk-data- | |
| - name: Install dependencies | |
| run: | | |
| export ZEEGUU_RESOURCES_FOLDER=`pwd` | |
| echo "ZEEGUU_RESOURCES_FOLDER=$ZEEGUU_RESOURCES_FOLDER" >> $GITHUB_ENV | |
| echo $ZEEGUU_RESOURCES_FOLDER | |
| # Create and activate virtual environment | |
| if [ ! -d "venv" ]; then | |
| echo "Creating virtual environment..." | |
| python -m venv venv | |
| fi | |
| source venv/bin/activate | |
| # Only install if cache missed or requirements changed | |
| if [ "${{ steps.cache-venv.outputs.cache-hit }}" != 'true' ]; then | |
| echo "Installing Python dependencies..." | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| python setup.py develop | |
| else | |
| echo "Using cached virtual environment" | |
| fi | |
| # Ensure NLTK data is downloaded (even if venv cached) | |
| if [ ! -d "nltk_data" ] || [ -z "$(ls -A nltk_data)" ]; then | |
| echo "Downloading NLTK data..." | |
| python -c "import nltk; import os; nltk_data_dir = os.path.join(os.getcwd(), 'nltk_data'); nltk.download('punkt', download_dir=nltk_data_dir); nltk.download('punkt_tab', download_dir=nltk_data_dir); nltk.download('averaged_perceptron_tagger', download_dir=nltk_data_dir)" | |
| else | |
| echo "NLTK data cached" | |
| fi | |
| # Only install Stanza models if not cached | |
| if [ ! -d "stanza_resources" ] || [ -z "$(ls -A stanza_resources)" ]; then | |
| echo "Installing Stanza models..." | |
| python install_stanza_models.py | |
| else | |
| echo "Stanza models cached, skipping installation" | |
| fi | |
| - name: Test with pytest | |
| run: | | |
| source venv/bin/activate | |
| export NLTK_DATA=$ZEEGUU_RESOURCES_FOLDER/nltk_data | |
| export DEV_SKIP_TRANSLATION=1 | |
| pytest |