-
Notifications
You must be signed in to change notification settings - Fork 80
117 lines (103 loc) · 4.08 KB
/
update_disabled_tests.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: Update disabled tests
on:
schedule:
# Every 15 minutes
- cron: "*/15 * * * *"
# Have the ability to trigger this job manually through the API
workflow_dispatch:
pull_request:
paths:
- .github/workflows/update_disabled_tests.yml
- .github/scripts/update_disabled_issues.py
permissions:
contents: write
jobs:
update-disabled-tests:
runs-on: ubuntu-latest
environment: trigger-nightly
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Generate new disabled tests and jobs jsons
env:
# The token is used to confirm issue creator's write permission before
# allowing them to disable jobs. Note that the token needs to have access
# to the target repo, i.e. pytorch/pytorch instead of test-infra. Using
# PyTorch bot token is the most obvious choice.
GH_PYTORCHBOT_TOKEN: ${{ secrets.GH_PYTORCHBOT_TOKEN }}
run: |
python3 .github/scripts/update_disabled_issues.py
- name: Print the list of disabled tests
run: |
cat disabled-tests-condensed.json
- name: Print the list of disabled and unstable jobs
run: |
echo "Disabled jobs:"
cat disabled-jobs.json
echo
echo "Unstable jobs:"
cat unstable-jobs.json
- name: Push disable tests to test-infra repository
if: github.event_name != 'pull_request'
uses: dmnemec/copy_file_to_another_repo_action@eebb594efdf52bc12e1b461988d7254322dac131
env:
API_TOKEN_GITHUB: ${{ secrets.GITHUB_TOKEN }}
with:
source_file: "disabled-tests-condensed.json"
destination_repo: "pytorch/test-infra"
destination_folder: "stats"
destination_branch: generated-stats
user_email: "[email protected]"
user_name: "Pytorch Test Infra"
commit_message: "Updating condensed disabled tests stats"
- name: Push disable jobs to test-infra repository
if: github.event_name != 'pull_request'
uses: dmnemec/copy_file_to_another_repo_action@eebb594efdf52bc12e1b461988d7254322dac131
env:
API_TOKEN_GITHUB: ${{ secrets.GITHUB_TOKEN }}
with:
source_file: "disabled-jobs.json"
destination_repo: "pytorch/test-infra"
destination_folder: "stats"
destination_branch: generated-stats
user_email: "[email protected]"
user_name: "Pytorch Test Infra"
commit_message: "Updating disabled jobs"
- name: Push unstable jobs to test-infra repository
if: github.event_name != 'pull_request'
uses: dmnemec/copy_file_to_another_repo_action@eebb594efdf52bc12e1b461988d7254322dac131
env:
API_TOKEN_GITHUB: ${{ secrets.GITHUB_TOKEN }}
with:
source_file: "unstable-jobs.json"
destination_repo: "pytorch/test-infra"
destination_folder: "stats"
destination_branch: generated-stats
user_email: "[email protected]"
user_name: "Pytorch Test Infra"
commit_message: "Updating unstable jobs"
- uses: actions/upload-artifact@v3
with:
name: disabled-artifacts
if-no-files-found: error
path: |
disabled-tests-condensed.json
disabled-jobs.json
unstable-jobs.json
# NB: Use our self-hosted runner to upload the files to S3, the runners already
# have access to the bucket
upload-disabled-tests-s3:
runs-on: linux.large
needs: update-disabled-tests
steps:
- name: Download disabled artifacts
uses: actions/download-artifact@v3
with:
name: disabled-artifacts
- name: Upload files to s3
if: github.event_name != 'pull_request'
run: |
python3 -mpip install awscli==1.27.69
aws s3 cp disabled-tests-condensed.json s3://ossci-metrics/disabled-tests-condensed.json
aws s3 cp disabled-jobs.json s3://ossci-metrics/disabled-jobs.json
aws s3 cp unstable-jobs.json s3://ossci-metrics/unstable-jobs.json