Skip to content

Replace TemplateContextType.isInContext deprecated method #1019

Replace TemplateContextType.isInContext deprecated method

Replace TemplateContextType.isInContext deprecated method #1019

Workflow file for this run

name: presubmit
on:
pull_request:
push:
branches:
- main
- '2025.2'
workflow_dispatch:
permissions:
contents: read
jobs:
# Job 0: Check Agent Skills Documentation
check-skills-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
with:
persist-credentials: false
- name: Run documentation check
run: ./tool/check_agent_skills.sh
# Job 1: Build Plugin
build-plugin:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 # Use the latest stable version of actions/checkout
with:
persist-credentials: false
- name: Set up JDK
uses: actions/setup-java@03ad4de0992f5dab5e18fcb136590ce7c4a0ac95 # v5
with:
distribution: 'temurin' # Recommended distribution
java-version: '21' # Match version in build.gradle.kts
- name: Setup Gradle
uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6
- 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@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 # Use the latest stable version of actions/checkout
with:
persist-credentials: false
- name: Set up JDK
uses: actions/setup-java@03ad4de0992f5dab5e18fcb136590ce7c4a0ac95 # v5
with:
distribution: 'temurin' # Recommended distribution
java-version: '21' # Match version in build.gradle.kts
- name: Setup Gradle
uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6
- name: Unit Test Action
run: ./gradlew :test --tests "com.jetbrains.lang.dart.*"
working-directory: third_party
- name: Upload test results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: always()
with:
name: test-results-${{ matrix.os }}
path: |
**/build/reports/
**/build/test-results/
if-no-files-found: ignore
# 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@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 # Use the latest stable version of actions/checkout
with:
persist-credentials: false
- name: Free up disk space (on ubuntu only)
if: ${{ matrix.os == 'ubuntu-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@03ad4de0992f5dab5e18fcb136590ce7c4a0ac95 # v5
with:
distribution: 'temurin' # Recommended distribution
java-version: '21' # Match version in build.gradle.kts
- name: Setup Gradle
uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6
- 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@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
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 253 261 262; 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" | grep -v "com\.intellij\.platform\.dartlsp" | 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