ci: cap the pytest job so a hung test cannot hold a runner all day #7056
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: Build and Test | |
| on: | |
| push: | |
| pull_request: | |
| jobs: | |
| react-build-test: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: DashAI/front | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Enable Corepack and use Yarn 3 | |
| run: corepack enable | |
| - name: Use Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: "18.x" | |
| cache: "yarn" | |
| cache-dependency-path: DashAI/front/yarn.lock | |
| - run: yarn install --frozen-lockfile | |
| - run: yarn build | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: react-build | |
| path: DashAI/front/build | |
| retention-days: 1 | |
| - run: yarn test --passWithNoTests | |
| pytest: | |
| needs: react-build-test | |
| runs-on: ${{ matrix.os }} | |
| # Without this a hung test holds the runner for GitHub's six hour default. | |
| # The suite takes four to nine minutes depending on the platform, so thirty | |
| # leaves plenty of headroom while turning a deadlock into a red job with a | |
| # readable log instead of a silent afternoon of runner time. | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ${{ github.event_name == 'pull_request' && fromJson('["3.10", "3.11", "3.12", "3.13"]') || fromJson('["3.12"]') }} | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| enable-cache: true | |
| - name: Install dependencies | |
| run: uv sync --locked --extra cpu --no-install-package llama-cpp-python | |
| - name: Prepare frontend build | |
| run: mkdir -p DashAI/front/build | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: react-build | |
| path: DashAI/front/build | |
| - name: Test with pytest | |
| run: uv run --no-sync pytest -v |