forked from openvinotoolkit/openvino
-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (88 loc) · 3.99 KB
/
workflow_rerunner.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: Rerun Workflow with Known Errors
on:
workflow_run:
workflows:
- Linux (Ubuntu 20.04, Python 3.9)
- Linux (Ubuntu 22.04, Python 3.11)
- Linux (Ubuntu 24.04, Python 3.12)
- Debian 10 ARM
- Android ARM64 with vcpkg
- Android x64
- Linux ARM64 (Ubuntu 20.04, Python 3.11)
- Linux Static CC (Ubuntu 22.04, Python 3.11, Clang)
- Linux RISC-V with Conan (Ubuntu 22.04, Python 3.10)
- Windows (VS 2019, Python 3.11, Release)
- Windows (VS 2019, Python 3.11, Debug)
- Windows Conditional Compilation (VS 2022, Python 3.11)
types:
- completed
pull_request:
paths:
- '.github/workflows/workflow_rerunner.yml'
- '.github/scripts/workflow_rerun/**'
permissions: read-all
jobs:
rerun:
name: Rerun Workflow
# Run only for the failed workflows in openvinotoolkit org
if: ${{ github.event.workflow_run.conclusion == 'failure' && github.repository_owner == 'openvinotoolkit' }}
runs-on: aks-linux-2-cores-8gb
permissions:
actions: write
contents: read
statuses: read
checks: read
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
sparse-checkout: '.github/scripts/workflow_rerun'
- name: Install deps
run: pip3 install PyGithub==2.2.0 requests==2.31.0
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Rerun
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
export PYTHONPATH=${{ github.workspace }}/.github/scripts/workflow_rerun:${{ github.workspace }}/.github/scripts:$PYTHONPATH
python3 ${{ github.workspace }}/.github/scripts/workflow_rerun/rerunner.py \
--run-id ${{ github.event.workflow_run.id }} \
--repository-name ${GITHUB_REPOSITORY}
- name: Rerun Retriggered (Ticket ${{ env.FOUND_ERROR_TICKET }})
if: ${{ env.PIPELINE_RETRIGGERED == 'true' }}
run: echo "Rerun retriggered for ${{ github.event.workflow_run.html_url }} with ticket ${{ env.FOUND_ERROR_TICKET }}"
- name: ${{ github.event.workflow_run.html_url }}
if: ${{ env.PIPELINE_RETRIGGERED == 'true' }}
run: echo "Step for statistics gathering"
rerunner_tests:
name: Rerunner Tests
if: ${{ github.event_name == 'pull_request' && github.repository_owner == 'openvinotoolkit' }}
runs-on: aks-linux-2-cores-8gb
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
sparse-checkout: '.github/scripts/workflow_rerun'
lfs: true
- name: Install deps
run: pip3 install PyGithub==2.2.0 requests==2.31.0
- name: Test Rerunner (Tests)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
working-directory: ${{ github.workspace }}/.github/scripts/workflow_rerun
run: |
export PYTHONPATH=${{ github.workspace }}/.github/scripts/workflow_rerun:${{ github.workspace }}/.github/scripts:$PYTHONPATH
python3 -m unittest tests/*_test.py
- name: Test Rerunner (CLI)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
working-directory: ${{ github.workspace }}/.github/scripts/workflow_rerun
run: |
export PYTHONPATH=${{ github.workspace }}/.github/scripts/workflow_rerun:${{ github.workspace }}/.github/scripts:$PYTHONPATH
# Need to get a run id with successful status for log analyzing
# cannot lock a run id as logs get deleted after some time
run_id=$(python3 -c "from github import Github, Auth; import os; github=Github(auth=Auth.Token(token=os.environ.get('GITHUB_TOKEN'))); repo = github.get_repo('${GITHUB_REPOSITORY}'); run_id = repo.get_workflow_runs(status='success')[0].id; print(run_id)")
python3 rerunner.py --repository-name ${GITHUB_REPOSITORY} --run-id $run_id --dry-run