move Simple Check to python

This commit is contained in:
Yakov Olkhovskiy 2022-07-05 23:37:01 -04:00
parent aff10f6654
commit 19365597eb
6 changed files with 29 additions and 36 deletions

View File

@ -1,21 +0,0 @@
### Сomplementary to PullRequestCI (pull_request.yml) - should pass
name: PRPassCI
on:
pull_request:
types:
- synchronize
- reopened
- opened
branches:
- master
# Сomplementary paths
paths:
- 'docker/docs/**'
- 'docs/**'
- 'website/**'
jobs:
SimpleCheck:
runs-on: ubuntu-latest
steps:
- name: Pass
run: exit 0

View File

@ -179,17 +179,6 @@ jobs:
# shellcheck disable=SC2046
docker rm -f $(docker ps -a -q) ||:
sudo rm -fr "$TEMP_PATH" "$CACHES_PATH"
SimpleCheck:
needs: [StyleCheck, FastTest]
runs-on: ubuntu-latest
if: ${{ always() }}
steps:
- name: Allow simple fail
if: ${{ contains(github.event.pull_request.labels.*.name, 'skip simple check') }}
run: exit 0
- name: Simple failed
if: ${{ (needs.StyleCheck.result != 'success' || needs.FastTest.result != 'success') && !contains(github.event.pull_request.labels.*.name, 'skip simple check') }}
run: exit 1
CompatibilityCheck:
needs: [BuilderDebRelease]
runs-on: [self-hosted, style-checker]

View File

@ -8,8 +8,9 @@ import sys
from github import Github
from env_helper import CACHES_PATH, TEMP_PATH
from pr_info import FORCE_TESTS_LABEL, PRInfo
from commit_status_helper import get_commit
from env_helper import CACHES_PATH, TEMP_PATH, GITHUB_SERVER_URL, GITHUB_REPOSITORY
from pr_info import FORCE_TESTS_LABEL, PRInfo, SKIP_SIMPLE_CHECK_LABEL
from s3_helper import S3Helper
from get_robot_token import get_best_robot_token
from upload_result_helper import upload_results
@ -219,4 +220,13 @@ if __name__ == "__main__":
if FORCE_TESTS_LABEL in pr_info.labels and state != "error":
print(f"'{FORCE_TESTS_LABEL}' enabled, will report success")
else:
if SKIP_SIMPLE_CHECK_LABEL not in pr_info.labels:
url = (
f"{GITHUB_SERVER_URL}/{GITHUB_REPOSITORY}/"
"blob/master/.github/PULL_REQUEST_TEMPLATE.md?plain=1"
)
commit = get_commit(gh, pr_info.sha)
commit.create_status(
context="Simple Check", description=f"{NAME} failed", state="failed", target_url=url
)
sys.exit(1)

View File

@ -15,6 +15,7 @@ from env_helper import (
)
FORCE_TESTS_LABEL = "force tests"
SKIP_SIMPLE_CHECK_LABEL = "skip simple check"
DIFF_IN_DOCUMENTATION_EXT = [
".html",

View File

@ -223,6 +223,10 @@ if __name__ == "__main__":
if pr_labels_to_remove:
remove_labels(gh, pr_info, pr_labels_to_remove)
commit.create_status(
context="Simple Check", description="Skipped", state="success", target_url=GITHUB_RUN_URL
)
if description_error:
print(
"::error ::Cannot run, PR description does not match the template: "

View File

@ -7,9 +7,10 @@ import sys
from github import Github
from env_helper import RUNNER_TEMP, GITHUB_WORKSPACE
from commit_status_helper import get_commit
from env_helper import RUNNER_TEMP, GITHUB_WORKSPACE, GITHUB_REPOSITORY, GITHUB_SERVER_URL
from s3_helper import S3Helper
from pr_info import PRInfo
from pr_info import PRInfo, SKIP_SIMPLE_CHECK_LABEL
from get_robot_token import get_best_robot_token
from upload_result_helper import upload_results
from docker_pull_helper import get_image_with_version
@ -120,4 +121,13 @@ if __name__ == "__main__":
ch_helper.insert_events_into(db="default", table="checks", events=prepared_events)
if state == "error":
if SKIP_SIMPLE_CHECK_LABEL not in pr_info.labels:
url = (
f"{GITHUB_SERVER_URL}/{GITHUB_REPOSITORY}/"
"blob/master/.github/PULL_REQUEST_TEMPLATE.md?plain=1"
)
commit = get_commit(gh, pr_info.sha)
commit.create_status(
context="Simple Check", description=f"{NAME} failed", state="failed", target_url=url
)
sys.exit(1)