-
Notifications
You must be signed in to change notification settings - Fork 13
151 lines (133 loc) · 5.38 KB
/
presubmit.yaml
File metadata and controls
151 lines (133 loc) · 5.38 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
142
143
144
145
146
147
148
149
150
151
name: presubmit
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
jobs:
# Job 1: Build Plugin
build-plugin:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6 # Use the latest stable version of actions/checkout
- name: Set up JDK
uses: actions/setup-java@v5 # https://github.com/marketplace/actions/setup-java-jdk
with:
distribution: 'temurin' # Recommended distribution
java-version: '21' # Match version in build.gradle.kts
cache: 'gradle' # Cache Gradle dependencies
- name: Build Plugin Action
run: ./gradlew buildPlugin
working-directory: third_party
# Job 2: Unit Tests
unit-tests:
needs: build-plugin
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }} # Use the OS from the matrix
steps:
- name: Checkout code
uses: actions/checkout@v6 # Use the latest stable version of actions/checkout
- name: Set up JDK
uses: actions/setup-java@v5 # https://github.com/marketplace/actions/setup-java-jdk
with:
distribution: 'temurin' # Recommended distribution
java-version: '21' # Match version in build.gradle.kts
cache: 'gradle' # Cache Gradle dependencies
- name: Unit Test Action
run: ./gradlew :test --tests "com.jetbrains.lang.dart.*"
working-directory: third_party
# Job 3: Verify Plugin
verify-plugin:
needs: build-plugin
strategy:
matrix:
# Note that `ubuntu-large` is required here lest we hit IO exceptions on linux (see, e.g., https://github.com/flutter/dart-intellij-third-party/issues/220)
os: [ ubuntu-large ]
# If we can address IO failures on other platforms, we might widen the matrix too
# os: [ ubuntu-large, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }} # Use the OS from the matrix
steps:
- name: Checkout code
uses: actions/checkout@v6 # Use the latest stable version of actions/checkout
- name: Free up disk space (on ubuntu only)
if: ${{ matrix.os == 'uubuntu-large' }}
# Inspired by the https://github.com/marketplace/actions/free-disk-space-ubuntu action
# See: https://github.com/flutter/dart-intellij-third-party/issues/220
run: |
echo "Freeing disk space...\n"
echo "Before:\n"
df -h
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo docker image prune --all --force
echo "After:\n"
df -h
- name: Set up JDK
uses: actions/setup-java@v5 # https://github.com/marketplace/actions/setup-java-jdk
with:
distribution: 'temurin' # Recommended distribution
java-version: '21' # Match version in build.gradle.kts
cache: 'gradle' # Cache Gradle dependencies
- name: Verify Plugin Actions
run: |
./gradlew verifyPlugin
./gradlew verifyPluginProjectConfiguration
./gradlew verifyPluginSignature
./gradlew verifyPluginStructure
working-directory: third_party
- name: Upload verifier results
uses: actions/upload-artifact@v7
if: always()
with:
name: build
path: |
**/build/reports/
**/build/test-results/
- name: Check baselines
run: |
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BOLD='\033[1m'
NC='\033[0m' # None (Reset)
EXIT_STATUS=0
for version in 251 252 253 261; do
echo -e "${BOLD}Checking baseline for $version...${NC}"
BASELINE="third_party/tool/baseline/$version/verifier-baseline.txt"
REPORT=$(find third_party/build/reports/pluginVerifier -path "*-$version.*/report.md" | head -n 1)
echo "Found report: $REPORT"
if [ -f "$REPORT" ]; then
echo "Comparing baseline against report in $REPORT"
grep "^*" "$REPORT" | sort > current_issues.tmp || true
if [ -f "$BASELINE" ]; then
NEW_ERRORS=$(comm -13 <(sort "$BASELINE") current_issues.tmp)
if [ -n "$NEW_ERRORS" ]; then
echo -e "${RED}${BOLD}Error: New verification issues found for version $version:${NC}"
echo "$NEW_ERRORS"
EXIT_STATUS=1
else
echo -e "${GREEN}Verification passed for version $version (no new issues).${NC}"
fi
else
echo -e "${YELLOW}Warning: No baseline file found at $BASELINE. Skipping comparison.${NC}"
fi
else
echo -e "${RED}${BOLD}Error: Report does not exist.${NC}"
EXIT_STATUS=1
fi
done
if [ $EXIT_STATUS -ne 0 ]; then
echo -e "${RED}${BOLD}Build failed: New verification issues were detected.${NC}"
echo -e "${YELLOW}To update the baselines with these new issues, run:${NC}"
echo -e "${YELLOW} ./third_party/tool/update_baselines.sh${NC}"
echo -e "${YELLOW}from the repository root and commit the changes.${NC}"
exit 1
fi