forked from pytorch/pytorch
-
Notifications
You must be signed in to change notification settings - Fork 1
73 lines (65 loc) · 2.45 KB
/
lint-bc.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
name: BC Lint
on:
pull_request:
types:
- opened
- synchronize
- reopened
- labeled
- unlabeled
workflow_dispatch:
jobs:
bc_linter:
runs-on: ubuntu-latest
steps:
- name: Check if user is in the dogfooding group
id: check_user
run: |
allowed_users=("albanD" "ezyang" "izaitsevfb")
pr_author="${{ github.event.pull_request.user.login }}"
allowed="false"
for user in "${allowed_users[@]}"; do
if [[ "$pr_author" == "$user" ]]; then
allowed="true"
break
fi
done
echo "allowed=${allowed}" >> "${GITHUB_OUTPUT}"
- name: Checkout PyTorch
if: steps.check_user.outputs.allowed == 'true'
uses: malfet/checkout@silent-checkout
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: -1
submodules: false
quiet-checkout: true
path: pytorch
- name: Checkout pytorch/test-infra repository
if: steps.check_user.outputs.allowed == 'true'
uses: actions/checkout@v3
with:
repository: pytorch/test-infra
path: test-infra
- name: Check for suppression by label
id: check_label
if: contains(github.event.pull_request.labels.*.name, 'suppress-api-compatibility-check')
run: |
echo "API compatibility check is suppressed by label"
echo "suppression=--suppressed" >> "${GITHUB_OUTPUT}"
- name: Build and run BC-linter
if: steps.check_user.outputs.allowed == 'true'
working-directory: pytorch
run: |
set -eux
../test-infra/tools/stronghold/bin/build-check-api-compatibility
# Run the BC-linter script.
# The script checks for BC-breaking changes in the PR.
# When suppressed by label or #suppress-api-compatibility-check tag in the commit message
# the job will not fail and will output notices instead of warnings.
../test-infra/tools/stronghold/bin/check-api-compatibility \
--base-commit=${{ github.event.pull_request.base.sha }} \
--head-commit=${{ github.event.pull_request.head.sha }} \
${{ steps.check_label.outputs.suppression }}
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
cancel-in-progress: true