langflow/.github/workflows/store_pytest_durations.yml
Gabriel Luiz Freitas Almeida 0ddc310122
ci: limit test duration update to unit tests and allow to continue on error (#5730)
* fix: update pytest command to target unit tests directory in GitHub Actions workflow

Modified the command in the store_pytest_durations.yml workflow to run pytest on the 'unit' tests directory instead of the 'backend' tests directory, ensuring more accurate duration tracking for unit tests.

* ci: update GitHub Actions workflow to improve pytest execution

Modified the store_pytest_durations.yml workflow to enhance the pytest command execution by removing the retry action and adding an ID for better tracking. The command now runs directly with the option to continue on error, ensuring that test durations are accurately recorded without unnecessary retries.

* refactor: update test durations and improve pytest tracking

This commit modifies the test duration tracking in the `.test_durations` file, reflecting updated execution times for various unit tests. The changes include adjustments to the duration values for multiple test cases across different modules, ensuring more accurate performance metrics. This update aims to enhance the reliability of test duration reporting in the CI pipeline.
2025-01-16 16:13:26 +00:00

66 lines
2.1 KiB
YAML

name: Store pytest durations
on:
workflow_dispatch:
schedule:
# Run job at 6:30 UTC, 10.30pm PST, or 11.30pm PDT
- cron: "30 6 * * *"
env:
PYTEST_RUN_PATH: "src/backend/tests"
jobs:
build:
name: Run pytest and store durations
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ASTRA_DB_API_ENDPOINT: ${{ secrets.ASTRA_DB_API_ENDPOINT }}
ASTRA_DB_APPLICATION_TOKEN: ${{ secrets.ASTRA_DB_APPLICATION_TOKEN }}
UV_CACHE_DIR: /tmp/.uv-cache
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Restore uv cache
uses: actions/cache@v4
with:
path: /tmp/.uv-cache
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
uv-${{ runner.os }}
- name: Install the project
run: uv sync --dev
- name: Run unit tests
id: run_tests
continue-on-error: true
run: uv run pytest src/backend/tests/unit --durations-path src/backend/tests/.test_durations --splitting-algorithm least_duration --store-durations
- name: Minimize uv cache
run: uv cache prune --ci
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch-token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore: update test durations"
title: "chore: update test durations"
body: |
Automated PR to update test durations file.
This PR was automatically created by the store_pytest_durations workflow.
branch: update-test-durations
branch-suffix: timestamp
delete-branch: true
maintainer-can-modify: true