Run tests each PR #541
  
    
      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
    
  
  
    
  | # This workflow will install Python dependencies and run tests with a variety of Python versions | |
| # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
| name: Run tests each PR | |
| on: | |
| schedule: | |
| - cron: "0 0 * * 0" | |
| push: | |
| branches: [master] | |
| pull_request: | |
| branches: [master] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - uses: actions/setup-node@v3 | |
| with: | |
| node-version: 20 | |
| - name: build streamlit-folium JS | |
| run: | | |
| cd streamlit_folium/frontend/ | |
| npm install | |
| npm run build | |
| - name: Install python dependencies | |
| run: | | |
| uv sync --group dev --group test | |
| - name: Install playwright dependencies | |
| run: | | |
| uv run playwright install --with-deps | |
| - name: Install annotate-failures-plugin | |
| run: uv add pytest-github-actions-annotate-failures --dev | |
| - name: Test with pytest and retry flaky tests up to 3 times | |
| run: | | |
| uv run pytest --browser chromium -s --reruns 3 --junit-xml=test-results.xml | |
| - name: Surface failing tests | |
| if: always() | |
| uses: pmeier/pytest-results-action@main | |
| with: | |
| path: test-results.xml | |
| fail-on-empty: false | |
| - uses: actions/upload-artifact@v4 | |
| if: failure() | |
| with: | |
| name: screenshots | |
| path: screenshot*.png |