-
Notifications
You must be signed in to change notification settings - Fork 1
239 lines (208 loc) · 10.4 KB
/
check.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
name: check
on:
push:
branches:
- master
- staging
- trying
pull_request:
# Trigger workflow every day to create/update caches for other builds
# See https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache
# to get more details about cache access
schedule:
- cron: '0 3 * * *'
# Allow cancelling all previous runs for the same branch
# See https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
OLD_IDEA_VERSION: IU-2024.1.4
OLD_CLION_VERSION: CL-2024.1.4
OLD_NATIVE_DEBUG_PLUGIN: "com.intellij.nativeDebug:241.15989.65"
jobs:
get-rust-versions:
uses: ./.github/workflows/get-rust-versions.yml
calculate-git-info:
runs-on: ubuntu-latest
outputs:
is_bors_branch: ${{ steps.calculate-git-info.outputs.is_bors_branch }}
is_master_branch: ${{ steps.calculate-git-info.outputs.is_master_branch }}
checked: ${{ steps.calculate-git-info.outputs.checked }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Calculate git info
id: calculate-git-info
run: |
echo "is_bors_branch=${{ github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/trying' }}" >> $GITHUB_OUTPUT
echo "is_master_branch=${{ github.ref == 'refs/heads/master'}}" >> $GITHUB_OUTPUT
echo "checked=$(python scripts/has_successful_status.py --token ${{ github.token }} --ref ${{ github.sha }} --check_name check)" >> $GITHUB_OUTPUT
- name: Check git info
run: |
echo "is_bors_branch: ${{ steps.calculate-git-info.outputs.is_bors_branch }}"
echo "is_master_branch: ${{ steps.calculate-git-info.outputs.is_master_branch }}"
echo "checked: ${{ steps.calculate-git-info.outputs.checked }}"
check-license:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check license
run: python scripts/check_license.py
build-native-code:
needs: [ calculate-git-info, get-rust-versions ]
# `fromJSON` is used here to convert string output to boolean
# We always want to trigger all workflow jobs on `schedule` event because it creates/updates caches for other builds.
# See https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache
# to get more details about cache access
if: ${{ github.event_name == 'schedule' || !fromJSON(needs.calculate-git-info.outputs.is_master_branch) || !fromJSON(needs.calculate-git-info.outputs.checked) }}
uses: ./.github/workflows/build-native-code.yml
with:
rust-version: ${{ needs.get-rust-versions.outputs.stable }}
cache: true
check-plugin:
needs: [ calculate-git-info, build-native-code, get-rust-versions ]
strategy:
# `fromJSON` is used here to convert string output to boolean
fail-fast: ${{ fromJSON(needs.calculate-git-info.outputs.is_bors_branch) }}
matrix:
os: [ ubuntu-latest, windows-latest ]
# `fromJSON` is used here to convert string output to sequence.
# `matrix` is a string with list of stable and nightly versions.
# Make sequence from two outputs with version is not possible here.
rust-version: ${{ fromJSON(needs.get-rust-versions.outputs.matrix) }}
base-ide: [ idea ]
platform-version: [ 241 ]
# it's enough to verify plugin structure only once per platform version
verify-plugin: [ false ]
default-edition-for-tests: [ 2021 ]
include:
- os: ubuntu-latest
rust-version: ${{ needs.get-rust-versions.outputs.old }}
base-ide: idea
platform-version: 241
verify-plugin: true
default-edition-for-tests: 2021
runs-on: ${{ matrix.os }}
timeout-minutes: 120
env:
ORG_GRADLE_PROJECT_baseIDE: ${{ matrix.base-ide }}
ORG_GRADLE_PROJECT_platformVersion: ${{ matrix.platform-version }}
ORG_GRADLE_PROJECT_compileNativeCode: false
DEFAULT_EDITION_FOR_TESTS: ${{ matrix.default-edition-for-tests }}
EVCXR_REPL_VERSION: 0.17.0
CARGO_GENERATE_VERSION: 0.21.3
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: corretto
java-version: 17
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust-version }}
components: rust-src, rustfmt, clippy
default: true
# Requires for tests with overridden toolchain
- name: Set up nightly Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
components: rust-src, rustfmt
default: false
- name: Cache cargo binaries
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/evcxr
~/.cargo/bin/evcxr.exe
~/.cargo/bin/cargo-generate
~/.cargo/bin/cargo-generate.exe
~/.cargo/.crates.toml
~/.cargo/.crates2.json
key: ${{ runner.os }}-cache-cargo-binaries-${{ matrix.rust-version }}-${{ github.run_id }} # https://github.com/actions/cache/issues/342#issuecomment-673371329
restore-keys: |
${{ runner.os }}-cache-cargo-binaries-${{ matrix.rust-version }}-
- name: Install evcxr
# BACKCOMPAT: Evcxr 0.17 requires at least stable-1.74
if: matrix.os != 'windows-latest' && matrix.rust-version >= '1.74.0'
uses: actions-rs/cargo@v1
with:
command: install
# https://github.com/intellij-rust/intellij-rust/issues/9406
args: evcxr_repl --locked --version ${{ env.EVCXR_REPL_VERSION }}
- name: Install cargo-generate
# BACKCOMPAT: cargo-generate 0.21.3 requires Rust 1.74.0 or newer
if: matrix.rust-version >= '1.74.0'
uses: actions-rs/cargo@v1
with:
command: install
args: cargo-generate --locked --version ${{ env.CARGO_GENERATE_VERSION }}
- name: Check environment
run: |
rustc --version
rustup component list --installed
cargo install --list
- name: Set up additional env variables
if: matrix.rust-version == needs.get-rust-versions.outputs.old
# see https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
run: |
echo "ORG_GRADLE_PROJECT_ideaVersion=${{ env.OLD_IDEA_VERSION }}" >> $GITHUB_ENV
echo "ORG_GRADLE_PROJECT_nativeDebugPlugin=${{ env.OLD_NATIVE_DEBUG_PLUGIN }}" >> $GITHUB_ENV
- name: Set up test env variables
run: echo "RUST_SRC_WITH_SYMLINK=$HOME/.rust-src" >> $GITHUB_ENV
- name: Create symlink for Rust stdlib Unix
if: matrix.os != 'windows-latest'
run: ln -s $(rustc --print sysroot)/lib/rustlib/src/rust $RUST_SRC_WITH_SYMLINK
# FIXME: find out why it doesn't work on CI
# - name: Create symlink for Rust stdlib Windows
# if: matrix.os == 'windows-latest'
# run: New-Item -ItemType Junction -Path "$env:RUST_SRC_WITH_SYMLINK" -Target "$(rustc --print sysroot)/lib/rustlib/src/rust"
- name: Load native binaries
uses: ./.github/actions/load-native-binaries
- name: Download
uses: gradle/gradle-build-action@v3
with:
arguments: ":resolveDependencies -Pkotlin.incremental=false --no-daemon"
gradle-home-cache-excludes: |
caches/modules-2/files-2.1/com.jetbrains.intellij.idea
- name: Build
uses: gradle/gradle-build-action@v3
with:
arguments: "assemble testClasses -Pkotlin.incremental=false --no-daemon"
gradle-home-cache-excludes: |
caches/modules-2/files-2.1/com.jetbrains.intellij.idea
- name: Check
uses: gradle/gradle-build-action@v3
with:
arguments: "check -PexcludeTests=org/rustPerformanceTests/** --continue -Pkotlin.incremental=false --no-daemon"
gradle-home-cache-excludes: |
caches/modules-2/files-2.1/com.jetbrains.intellij.idea
- name: Collect fail reports
if: failure()
uses: actions/upload-artifact@v4
with:
name: tests-report-${{ matrix.os }}-${{ matrix.rust-version }}-${{ matrix.base-ide }}-${{ matrix.platform-version }}
path: |
build/reports/tests
*/build/reports/tests
build/*sandbox*/system-test/testlog/idea.log
*/build/*sandbox*/system-test/testlog/idea.log
- name: Verify plugin
if: matrix.verify-plugin
uses: gradle/gradle-build-action@v3
with:
arguments: ":plugin:verifyPlugin"
gradle-home-cache-excludes: |
caches/modules-2/files-2.1/com.jetbrains.intellij.idea
check:
needs: [ check-license, check-plugin ]
runs-on: ubuntu-latest
steps:
- name: Finish check
run: echo "Check finished successfully!"