Skip to content

Commit 21061b6

Browse files
committed
Update on "std/var: Deprecate overloads with "unbiased" argument"
[ghstack-poisoned]
2 parents a0deaae + 66f9ea1 commit 21061b6

377 files changed

Lines changed: 12763 additions & 5552 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.circleci/config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,8 @@ jobs:
818818
when: always
819819
- store_test_results:
820820
path: test/test-reports
821+
- store_artifacts:
822+
path: test/coverage.xml
821823
binary_linux_build:
822824
<<: *binary_linux_build_params
823825
steps:

.circleci/verbatim-sources/job-specs/pytorch-job-specs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,3 +380,5 @@ jobs:
380380
when: always
381381
- store_test_results:
382382
path: test/test-reports
383+
- store_artifacts:
384+
path: test/coverage.xml

.github/scripts/ensure_consistent_workflows.py

Lines changed: 0 additions & 40 deletions
This file was deleted.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env python
2+
'''
3+
This file verifies that the workflows that are potentially canceled in our cancel_redundant_workflow.yml
4+
match the workflows we have running on pull requests (found in .github/workflows). This way, anytime a
5+
workflow is added or removed, people can be reminded to modify the cancel_redundant_workflow.yml accordingly.
6+
'''
7+
8+
9+
import ruamel.yaml
10+
from pathlib import Path
11+
12+
13+
yaml = ruamel.yaml.YAML()
14+
yaml.preserve_quotes = True
15+
yaml.boolean_representation = ['False', 'True']
16+
yaml.default_flow_style = False
17+
18+
19+
if __name__ == '__main__':
20+
workflow_paths = (Path(__file__).parent.parent / 'workflows').rglob('*')
21+
workflows = []
22+
for path in workflow_paths:
23+
if path.suffix in {'.yml', '.yaml'}:
24+
with open(path) as f:
25+
data = yaml.load(f)
26+
assert 'name' in data, 'Every GHA workflow must have a name.'
27+
if 'pull_request' in data['on']:
28+
workflows.append(data['name'])
29+
30+
with open('.github/workflows/cancel_redundant_workflows.yml', 'r') as f:
31+
data = yaml.load(f)
32+
33+
# Replace workflows to cancel
34+
data['on']['workflow_run']['workflows'] = sorted(workflows)
35+
36+
with open('.github/workflows/cancel_redundant_workflows.yml', 'w') as f:
37+
yaml.dump(data, f)

.github/workflows/add_annotations.yml

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,23 @@ jobs:
1515
name:
1616
- flake8-py3
1717
- clang-tidy
18-
if: github.event.workflow_run.event == 'pull_request'
1918
runs-on: ubuntu-18.04
2019
steps:
2120
- name: Download artifact
2221
uses: actions/github-script@v3
22+
env:
23+
RUN_ID: ${{ github.event.workflow_run.id }}
24+
LINT_NAME: ${{ matrix.name }}
2325
with:
2426
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
2527
script: |
2628
const artifacts = await github.actions.listWorkflowRunArtifacts({
2729
owner: context.repo.owner,
2830
repo: context.repo.repo,
29-
run_id: ${{ github.event.workflow_run.id }},
31+
run_id: process.env.RUN_ID,
3032
});
3133
const filteredArtifacts = artifacts.data.artifacts.filter(artifact => {
32-
return artifact.name == '${{ matrix.name }}';
34+
return artifact.name == process.env.LINT_NAME;
3335
});
3436
if (filteredArtifacts.length > 0) {
3537
const matchArtifact = filteredArtifacts[0];
@@ -41,27 +43,24 @@ jobs:
4143
});
4244
const fs = require('fs');
4345
fs.writeFileSync(
44-
'${{ github.workspace }}/linter-output.zip',
46+
`${process.env.GITHUB_WORKSPACE}/linter-output.zip`,
4547
Buffer.from(download.data),
4648
);
4749
}
4850
- name: Unzip artifact
4951
id: unzip
5052
run: |
51-
FILENAME=linter-output.zip
52-
EXISTS=$([ -f $FILENAME ]; echo $?)
53-
echo ::set-output name=exists::"$EXISTS"
54-
if [ "$EXISTS" -eq 0 ]; then
55-
unzip $FILENAME
56-
echo ::set-output name=commit-sha::"$(cat commit-sha.txt)"
53+
if unzip linter-output.zip annotations.json commit-sha.txt; then
54+
echo ::set-output \
55+
name=sha::"$(grep -Em1 '^[[:xdigit:]]{40}$' commit-sha.txt)"
5756
fi
58-
- if: steps.unzip.outputs.exists == '0' # i.e. true
57+
- if: steps.unzip.outputs.sha
5958
name: Add annotations
6059
uses: pytorch/add-annotations-github-action@master
60+
env:
61+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6162
with:
6263
check_name: ${{ matrix.name }}
6364
linter_output_path: annotations.json
64-
commit_sha: ${{ steps.unzip.outputs.commit-sha }}
65+
commit_sha: ${{ steps.unzip.outputs.sha }}
6566
mode: json
66-
env:
67-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/auto_label.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ jobs:
1212
steps:
1313
- name: Retrieve information
1414
id: vars
15+
env:
16+
EVENT_NAME: ${{ github.event_name }}
17+
PR_TITLE: ${{ github.event.pull_request.title }}
18+
PR_NUMBER: ${{ github.event.pull_request.number }}
19+
ISSUE_TITLE: ${{ github.event.issue.title }}
20+
ISSUE_NUMBER: ${{ github.event.issue.number }}
1521
run: |
1622
set -eux
1723
if [[ "$EVENT_NAME" == "pull_request_target" ]]; then
@@ -23,13 +29,13 @@ jobs:
2329
fi
2430
echo ::set-output name=TITLE::"${TITLE}"
2531
echo ::set-output name=ISSUE_NUMBER::"${ISSUE_NUMBER}"
26-
env:
27-
EVENT_NAME: ${{ github.event_name }}
28-
PR_TITLE: ${{ github.event.pull_request.title }}
29-
PR_NUMBER: ${{ github.event.pull_request.number }}
30-
ISSUE_TITLE: ${{ github.event.issue.title }}
31-
ISSUE_NUMBER: ${{ github.event.issue.number }}
3232
- name: Auto-label ROCm
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
TITLE: ${{ steps.vars.outputs.TITLE }}
36+
ISSUE_NUMBER: ${{ steps.vars.outputs.ISSUE_NUMBER }}
37+
OWNER: ${{ github.repository_owner }}
38+
REPO: ${{ github.event.repository.name }}
3339
run: |
3440
set -eux
3541
if [[ "${TITLE,,}" == *rocm* ]]; then
@@ -39,9 +45,3 @@ jobs:
3945
"https://api.github.com/repos/${OWNER}/${REPO}/issues/${ISSUE_NUMBER}/labels" \
4046
-d '{"labels":["module: rocm"]}'
4147
fi
42-
env:
43-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44-
TITLE: ${{ steps.vars.outputs.TITLE }}
45-
ISSUE_NUMBER: ${{ steps.vars.outputs.ISSUE_NUMBER }}
46-
OWNER: ${{ github.repository_owner }}
47-
REPO: ${{ github.event.repository.name }}

.github/workflows/cancel_redundant_workflows.yml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,21 @@ name: Cancel redundant workflows
22
on:
33
workflow_run:
44
types:
5-
- requested
5+
- requested
66
# NOTE: Make sure to add to this list as you add more workflows running on 'pull_request'
77
workflows:
8-
- clang-format
9-
- Lint
10-
- Test tools
11-
8+
- Lint
9+
- Test tools
10+
- clang-format
1211
jobs:
1312
cancel:
1413
# We do not want to cancel reruns on master
1514
if: github.event.workflow_run.head_branch != 'master'
1615
runs-on: ubuntu-18.04
1716
steps:
18-
- name: Cancel duplicate workflow runs
19-
uses: potiuk/cancel-workflow-runs@a81b3c4d59c61e27484cfacdc13897dd908419c9
20-
with:
21-
cancelMode: duplicates
22-
token: ${{ secrets.GITHUB_TOKEN }}
23-
sourceRunId: ${{ github.event.workflow_run.id }}
17+
- name: Cancel duplicate workflow runs
18+
uses: potiuk/cancel-workflow-runs@a81b3c4d59c61e27484cfacdc13897dd908419c9
19+
with:
20+
cancelMode: duplicates
21+
token: ${{ secrets.GITHUB_TOKEN }}
22+
sourceRunId: ${{ github.event.workflow_run.id }}

.github/workflows/clang_format.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ jobs:
1717
with:
1818
fetch-depth: 0 # deep clone, to allow us to use git merge-base
1919
- name: Run clang-format
20+
env:
21+
BASE_SHA: ${{ github.event.pull_request.base.sha }}
2022
run: |
2123
set -eu
2224
# This is necessary to get the same results regardless of whether the
@@ -40,5 +42,3 @@ jobs:
4042
fi
4143
echo "$GIT_DIFF"
4244
exit 1
43-
env:
44-
BASE_SHA: ${{ github.event.pull_request.base.sha }}

.github/workflows/lint.yml

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,17 @@ jobs:
2222
- name: Ensure consistent CircleCI YAML config
2323
run: cd .circleci && ./ensure-consistency.py
2424
- name: Ensure consistent GHA workflows in cancel_redundant_workflows.yml
25-
run: .github/scripts/ensure_consistent_workflows.py
25+
run: |
26+
pip install ruamel.yaml==0.17.4
27+
echo "Please locally run .github/scripts/regenerate_cancel_redundant_workflow.py and commit if this step fails."
28+
.github/scripts/regenerate_cancel_redundant_workflow.py
29+
git diff --exit-code .github/workflows/cancel_redundant_workflows.yml
2630
- name: Lint native_functions.yaml
2731
run: |
2832
pip install ruamel.yaml==0.17.4
2933
.github/scripts/lint_native_functions.py
34+
- name: Extract scripts from GitHub Actions workflows
35+
run: tools/extract_scripts.py --out=.extracted_scripts
3036
- name: ShellCheck
3137
# https://github.com/koalaman/shellcheck/tree/v0.7.1#installing-a-pre-compiled-binary
3238
run: |
@@ -36,9 +42,7 @@ jobs:
3642
sudo cp "shellcheck-${scversion}/shellcheck" /usr/bin/
3743
rm -r "shellcheck-${scversion}"
3844
shellcheck --version
39-
EXTRACT_DIR=.shellcheck_generated
40-
tools/extract_scripts.py --out=$EXTRACT_DIR
41-
tools/run_shellcheck.sh .jenkins/pytorch $EXTRACT_DIR
45+
tools/run_shellcheck.sh .jenkins/pytorch .extracted_scripts
4246
- name: Ensure correct trailing newlines
4347
run: |
4448
(! git grep -Il '' -- . ':(exclude)**/contrib/**' ':(exclude)third_party' ':(exclude)**.expect' ':(exclude)tools/clang_format_hash' | tools/trailing_newlines.py || (echo "The above files do not have correct trailing newlines; please normalize them"; false))
@@ -127,12 +131,12 @@ jobs:
127131
with:
128132
fetch-depth: 2 # to allow us to use github.event.pull_request.head.sha
129133
- name: Prepare output dir with HEAD commit SHA
134+
env:
135+
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
130136
run: |
131137
mkdir flake8-output
132138
cd flake8-output
133139
echo "$HEAD_SHA" > commit-sha.txt
134-
env:
135-
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
136140
- name: Run flake8
137141
run: |
138142
set -eux
@@ -143,14 +147,14 @@ jobs:
143147
cp flake8-output.txt flake8-output/annotations.json
144148
- name: Translate annotations
145149
if: github.event_name == 'pull_request'
150+
env:
151+
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
146152
run: |
147153
tools/translate_annotations.py \
148154
--file=flake8-output.txt \
149155
--regex='^(?P<filename>.*?):(?P<lineNumber>\d+):(?P<columnNumber>\d+): (?P<errorCode>\w+\d+) (?P<errorDesc>.*)' \
150156
--commit="$HEAD_SHA" \
151157
> flake8-output/annotations.json
152-
env:
153-
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
154158
- name: Upload artifact
155159
uses: actions/upload-artifact@v2
156160
with:
@@ -175,12 +179,12 @@ jobs:
175179
with:
176180
fetch-depth: 0 # to allow tools/clang_tidy.py to do its thing
177181
- name: Prepare output dir with HEAD commit SHA
182+
env:
183+
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
178184
run: |
179185
mkdir clang-tidy-output
180186
cd clang-tidy-output
181187
echo "$HEAD_SHA" > commit-sha.txt
182-
env:
183-
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
184188
- name: Install dependencies
185189
run: |
186190
set -eux
@@ -199,6 +203,9 @@ jobs:
199203
sudo apt-get install -y clang-tidy-11
200204
sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-11 1000
201205
- name: Run clang-tidy
206+
env:
207+
BASE_SHA: ${{ github.event.pull_request.base.sha }}
208+
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
202209
run: |
203210
set -eux
204211
git remote add upstream https://github.com/pytorch/pytorch
@@ -260,9 +267,6 @@ jobs:
260267
--regex='^(?P<filename>.*?):(?P<lineNumber>\d+):(?P<columnNumber>\d+): (?P<errorDesc>.*?) \[(?P<errorCode>.*)\]' \
261268
--commit="$HEAD_SHA" \
262269
> clang-tidy-output/annotations.json
263-
env:
264-
BASE_SHA: ${{ github.event.pull_request.base.sha }}
265-
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
266270
- name: Upload artifact
267271
uses: actions/upload-artifact@v2
268272
with:

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ coverage.xml
1414
.gradle
1515
.hypothesis
1616
.mypy_cache
17-
/.shellcheck_generated/
17+
/.extracted_scripts/
1818
**/.pytorch-test-times
1919
**/.pytorch-slow-tests
2020
*/*.pyc
@@ -288,3 +288,7 @@ TAGS
288288

289289
# bazel symlinks
290290
bazel-*
291+
292+
# direnv, posh-direnv
293+
.envrc
294+
.psenvrc

0 commit comments

Comments
 (0)