Skip to content

Commit

Permalink
Merge branch 'main' into merge_release/2.147.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas1312 authored Oct 3, 2023
2 parents ba35975 + 1787d98 commit 077d732
Show file tree
Hide file tree
Showing 64 changed files with 2,805 additions and 1,086 deletions.
14 changes: 6 additions & 8 deletions .github/scripts/upload_test_stats_datadog.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import sys
import time
import zipfile
from collections import defaultdict
from dataclasses import dataclass
from datetime import datetime
from typing import Dict, List, Literal, Optional
Expand Down Expand Up @@ -38,7 +39,7 @@
url = f"https://api.github.com/repos/{OWNER}/{REPO}/actions/workflows/{WORKFLOW}/runs?per_page={BATCH_SIZE}"


PYTEST_TEST_DURATIONS_REGEX_PATTERN = r"=+ slowest \d+ durations =+"
PYTEST_TEST_DURATIONS_REGEX_PATTERN = r"=+ slowest .*durations =+"


def get_and_dump_data() -> None:
Expand Down Expand Up @@ -166,18 +167,15 @@ def get_test_durations_from_logs(logs: str, run_id: str) -> List[TestDuration]:
"""Extract the test durations from the logs of a workflow run."""
logs_split = [l for l in logs.split("\n") if l]

test_name_to_infos = {}
test_name_to_infos = defaultdict(list)

# find all matches
# Twice, one for e2e tests, the other one for notebook tests.
for match in re.finditer(PYTEST_TEST_DURATIONS_REGEX_PATTERN, logs):
assert match is not None
index = match.start()
nb_tests_in_log = int(match.group().split(" ")[2])
lines = logs[index:].splitlines()
for line in lines:
if nb_tests_in_log == 0:
break
if "FAILED" in line or "ERROR" in line or "PASSED" in line:
continue
if "test" in line and ("call" in line or "setup" in line):
Expand All @@ -202,8 +200,7 @@ def get_test_durations_from_logs(logs: str, run_id: str) -> List[TestDuration]:
lines_matching_test_name[0].split(" ")[0][:19], r"%Y-%m-%dT%H:%M:%S"
)

test_name_to_infos[test_name] = (date, call_or_setup, duration)
nb_tests_in_log -= 1
test_name_to_infos[test_name].append((date, call_or_setup, duration))

return [
TestDuration(
Expand All @@ -213,7 +210,8 @@ def get_test_durations_from_logs(logs: str, run_id: str) -> List[TestDuration]:
date=date,
run_id=run_id,
)
for test_name, (date, call_or_setup, duration) in test_name_to_infos.items()
for test_name, test_entries in test_name_to_infos.items()
for (date, call_or_setup, duration) in test_entries
]


Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/utils.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

get_sdk_version_from_pyproject_toml() {
sdk_version=$(cat pyproject.toml | grep version | cut -d ' ' -f 3 | sed -r s,"^\"(.*)\"$","\1",)
sdk_version=$(cat pyproject.toml | grep "^version" | cut -d '"' -f 2)
echo "$sdk_version"
}

Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,15 @@ jobs:
pip install -e ".[dev]"
- name: Build
run: mkdocs build
run: |
mkdocs build 2>&1 | tee doc-build.log
- name: Look for Warnings
run: |
if grep -q "WARNING" doc-build.log; then
echo $(grep "WARNING" doc-build.log)
echo "::error::Documentation build completed with warnings"
exit 1
else
echo "Documentation build completed successfully"
fi
16 changes: 13 additions & 3 deletions .github/workflows/create_draft_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ on:
required: true
type: string
default: "X.XXX.0"
checkAgainstLatestRelease:
description: >
"Check that the release version is greater than the latest release on github.
If not, the workflow will fail.
Enter 'true' to check against the latest release on github, 'false' otherwise:"
required: true
type: boolean
default: true

jobs:
create_draft_release:
Expand Down Expand Up @@ -54,9 +62,11 @@ jobs:
# make sure release_version is greater than last github release
latest_release=$(get_last_release_tag_github)
echo "Latest release: $latest_release"
if ! [[ $(version_to_int "$release_version") -gt $(version_to_int "$latest_release") ]]; then
echo "The release you are trying to create ($release_version) is older than the latest release on github ($latest_release)"
exit 1
if [[ ${{ inputs.checkAgainstLatestRelease }} == true ]]; then
if ! [[ $(version_to_int "$release_version") -gt $(version_to_int "$latest_release") ]]; then
echo "The release you are trying to create ($release_version) is lower than the latest release on github ($latest_release)"
exit 1
fi
fi
# tag and push the tag
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/e2e_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,8 @@ jobs:
- name: E2E tests
id: e2e
if: github.event.inputs.runE2ETests != 'false'
timeout-minutes: 30
run: pytest -ra -sv --color yes --code-highlight yes --durations=0 -vv --ignore tests/e2e/test_notebooks.py tests/e2e
timeout-minutes: 60
run: pytest --timeout=600 -ra -sv --color yes --code-highlight yes --durations=0 -vv --ignore tests/e2e/test_notebooks.py tests/e2e
env:
KILI_API_CLOUD_VISION: ${{ secrets.KILI_API_CLOUD_VISION }}
KILI_API_ENDPOINT: ${{ env.KILI_API_ENDPOINT }}
Expand All @@ -267,9 +267,9 @@ jobs:
- name: Notebook tests
# we don't run notebook tests on push to main
# we run regardless of the outcome of the e2e tests
if: ${{ !cancelled() }} && github.event.inputs.runNotebookTests != 'false' && (github.event_name != 'push' || github.ref_name != 'main') && (steps.e2e.outcome != 'cancelled')
timeout-minutes: 45
run: pytest -ra -sv --color yes --code-highlight yes --durations=0 -vv tests/e2e/test_notebooks.py
if: ${{ !cancelled() && github.event.inputs.runNotebookTests != 'false' && (github.event_name != 'push' || github.ref_name != 'main') && (steps.e2e.outcome != 'cancelled') }}
timeout-minutes: 60
run: pytest --timeout=600 -ra -sv --color yes --code-highlight yes --durations=0 -vv tests/e2e/test_notebooks.py
env:
KILI_API_CLOUD_VISION: ${{ secrets.KILI_API_CLOUD_VISION }}
KILI_API_ENDPOINT: ${{ env.KILI_API_ENDPOINT }}
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repos:
args: [--in-place, --black, --wrap-summaries=0, --wrap-descriptions=0]

- repo: https://github.com/asottile/pyupgrade
rev: v3.13.0
rev: v3.14.0
hooks:
- id: pyupgrade
args: [--py38-plus]
Expand All @@ -29,7 +29,7 @@ repos:
- --

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.291
rev: v0.0.292
hooks:
- id: ruff
args:
Expand Down
Loading

0 comments on commit 077d732

Please sign in to comment.