Repository navigation
141 lines (124 loc) · 4.76 KB
/
Copy pathtyping_conformance.yaml
File metadata and controls
141 lines (124 loc) · 4.76 KB
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: Run typing conformance
permissions:
contents: read
on:
pull_request:
paths:
- "crates/ty*/**"
- "!crates/ty_ide/**"
- "!crates/ty_server/**"
- "!crates/ty_test/**"
- "!crates/ty_completion_eval/**"
- "!crates/ty_wasm/**"
- "crates/ruff_db"
- "crates/ruff_python_ast"
- "crates/ruff_python_edits/**"
- "crates/ruff_python_parser"
- "scripts/conformance.py"
- ".github/workflows/typing_conformance.yaml"
- "Cargo.lock"
- "!**.md"
- "!**.snap"
# It's tempting to skip all Python files in every directory, but changes to
# Python files in `ty_vendored` can affect the output of the ecosystem analysis,
# so we apply a narrow exemption for all files in the corpus directory instead.
- "!crates/ty_python_semantic/resources/corpus/**"
concurrency:
group: typing-conformance-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
UV_LOCKED: 1
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
CARGO_TERM_COLOR: always
RUSTUP_MAX_RETRIES: 10
RUST_BACKTRACE: 1
# Line-tables-only debug info: faster builds, backtraces still work.
CARGO_PROFILE_DEV_DEBUG: line-tables-only
CARGO_PROFILE_DEV_LTO: "false"
CARGO_PROFILE_DEV_OPT_LEVEL: 0
CONFORMANCE_SUITE_COMMIT: d06c5dd6bbae4a39eb7cb0210c5b2099aafd8032
PYTHON_VERSION: 3.12
jobs:
typing_conformance:
name: Compute diagnostic diff
runs-on: ${{ github.repository == 'astral-sh/ruff' && 'depot-ubuntu-22.04-32' || 'ubuntu-latest' }}
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
path: ruff
persist-credentials: false
# Faster to do this separately than to use `fetch-depth: 0` with `actions/checkout`
- name: Fetch full history without tags
env:
GH_TOKEN: ${{ github.token }}
run: |
gh auth setup-git
git -C ruff fetch --no-tags --filter=blob:none --unshallow origin
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: python/typing
ref: ${{ env.CONFORMANCE_SUITE_COMMIT }}
path: typing
persist-credentials: false
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
with:
workspaces: "ruff"
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Rust toolchain
run: rustup show
- name: Compute diagnostic diff
shell: bash
run: |
# Build the executable for the old and new commit
(
cd ruff
echo "new commit"
git rev-list --format=%s --max-count=1 "$GITHUB_SHA"
cargo build --bin ty
mv target/debug/ty ty-new
# The first parent contains any preceding layers in a stacked pull request.
MERGE_BASE="$(git rev-parse "${GITHUB_SHA}^1")"
git checkout -b old_commit "$MERGE_BASE"
echo "old commit (merge base)"
git rev-list --format=%s --max-count=1 old_commit
cargo build --bin ty
mv target/debug/ty ty-old
)
(
echo "Creating comment with conformance comparison"
cd ruff
git switch - --detach
python "./scripts/conformance.py" \
--old-ty "./ty-old" \
--new-ty "./ty-new" \
--tests-path "${GITHUB_WORKSPACE}/typing/conformance/" \
--python-version "$PYTHON_VERSION" \
--output ../typing_conformance_diagnostics.diff
)
- name: Upload diff
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: typing_conformance_diagnostics_diff
path: typing_conformance_diagnostics.diff
publish-report:
needs: typing_conformance
if: >-
!cancelled() && github.event_name == 'pull_request' &&
github.repository == 'astral-sh/ruff' &&
github.event.pull_request.head.repo.full_name == github.repository &&
(needs.typing_conformance.result == 'success' || needs.typing_conformance.result == 'failure')
uses: astral-sh/ruff/.github/workflows/publish-pull-request-report.yml@main # zizmor: ignore[unpinned-uses]
secrets:
KV_API_URL: ${{ secrets.KV_API_URL }}
STS_API_URL: ${{ secrets.STS_API_URL }}
permissions:
contents: read
id-token: write
with:
report: typing-conformance
artifact: typing_conformance_diagnostics_diff
filename: typing_conformance_diagnostics.diff