-
Notifications
You must be signed in to change notification settings - Fork 2
111 lines (99 loc) · 4.12 KB
/
Copy pathci.yml
File metadata and controls
111 lines (99 loc) · 4.12 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
name: CI
on:
push:
branches: [main]
pull_request:
# A second push to a PR makes the first run's answer worthless — the verifier job downloads
# IDEs, so letting both finish is minutes of runner time spent on a stale commit.
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build and test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 21
- uses: gradle/actions/setup-gradle@v6.3.0
# :core holds the parser and its tests; :plugin has none by design (its test task is
# disabled in build.gradle.kts), so `gradlew test` alone reports success either way.
# Naming :core:test means a removed test suite shows up as a task that no longer exists.
- id: coretest
run: ./gradlew :core:test
- name: Test report
if: always()
run: |
set -euo pipefail
shopt -s nullglob
files=(core/build/test-results/test/TEST-*.xml)
if [ ${#files[@]} -eq 0 ]; then
# No results after a *failed* test step says nothing new — the job is already red
# for the real reason. It is only a finding when the step claimed success.
if [ "${{ steps.coretest.outcome }}" != "success" ]; then
echo "::notice::no test results, but the test step failed above — see it for the cause"
exit 0
fi
echo "::error:::core:test succeeded and produced no results — did the suite disappear?"
exit 1
fi
awk -F'"' '/<testsuite /{for(i=1;i<=NF;i++){
if($(i-1)~/tests=$/)t+=$i; if($(i-1)~/failures=$/)f+=$i; if($(i-1)~/errors=$/)e+=$i}}
END{printf ":core — %d tests, %d failures, %d errors\n", t, f, e}' "${files[@]}" \
>> "$GITHUB_STEP_SUMMARY"
- run: ./gradlew build verifyPluginProjectConfiguration verifyPluginStructure
- name: Build the distributable
run: ./gradlew buildPlugin
- uses: actions/upload-artifact@v7
with:
name: plugin-zip
path: plugin/build/distributions/*.zip
if-no-files-found: error
verify:
name: Plugin Verifier
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 21
- uses: gradle/actions/setup-gradle@v6.3.0
# Each IDE under test is a ~1GB download. Caching them separately from the Gradle cache
# keeps a dependency change from evicting them.
- uses: actions/cache@v6
with:
path: |
~/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea
~/.pluginVerifier
key: ide-verifier-${{ hashFiles('plugin/build.gradle.kts') }}
restore-keys: ide-verifier-
- run: ./gradlew verifyPlugin
# The task passes when an IDE reports problems below the failure level, and it passes
# just as quietly when the ides {} block resolves to nothing. Assert on the reports:
# one directory per verified IDE, and the count has to match what is declared.
- name: Every declared IDE was actually verified
run: |
set -euo pipefail
shopt -s nullglob
reports=plugin/build/reports/pluginVerifier
declared=$(grep -c '^ *create(IntelliJPlatformType' plugin/build.gradle.kts)
dirs=("$reports"/*/)
echo "declared=$declared verified=${#dirs[@]}"
if [ "${#dirs[@]}" -ne "$declared" ]; then
echo "::error::$declared IDEs declared in pluginVerification, ${#dirs[@]} verified"
for d in "${dirs[@]}"; do echo " $(basename "$d")"; done
exit 1
fi
for d in "${dirs[@]}"; do
echo "- verified against $(basename "$d")" >> "$GITHUB_STEP_SUMMARY"
done
- uses: actions/upload-artifact@v7
if: always()
with:
name: plugin-verifier-reports
path: plugin/build/reports/pluginVerifier
if-no-files-found: warn