Run Pytest #17
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: Run Pytest | |
| on: | |
| # Automatic runs | |
| push: | |
| branches: ["main", "master"] | |
| pull_request: | |
| branches: ["main", "master"] | |
| # Manual run with parameter | |
| workflow_dispatch: | |
| inputs: | |
| suite: | |
| description: 'Test suite to run (sanity / smoke / regression)' | |
| required: true | |
| default: 'sanity' | |
| # ⏰ Scheduled run every 5 minutes | |
| schedule: | |
| - cron: "*/5 * * * *" | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.10" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| # ⭐ Normalize parameter (Jenkins-style) | |
| - name: Set test suite | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| echo "SUITE=${{ github.event.inputs.suite }}" >> $GITHUB_ENV | |
| else | |
| echo "SUITE=sanity" >> $GITHUB_ENV | |
| fi | |
| - name: Run pytest | |
| run: | | |
| echo "Running test suite: $SUITE" | |
| pytest -vs -m $SUITE |