presubmit #166
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: presubmit | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| # Job 1: Build Plugin | |
| build-plugin: | |
| runs-on: [ubuntu-latest, macos-latest, windows-latest] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 # Use the latest stable version of actions/checkout | |
| - name: Set up JDK | |
| uses: actions/setup-java@v4 # 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: | |
| strategy: | |
| matrix: | |
| # TODO(https://github.com/flutter/dart-intellij-third-party/pull/33) Fix and enable execution on Windows | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} # Use the OS from the matrix | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 # Use the latest stable version of actions/checkout | |
| - name: Set up JDK | |
| uses: actions/setup-java@v4 # 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 | |
| - name: Publish Test Report | |
| uses: ctrf-io/github-test-reporter@v1 | |
| with: | |
| report-path: "./target/surefire-reports/*.xml" | |
| integrations-config: | | |
| { | |
| "junit-to-ctrf": { | |
| "enabled": true, | |
| "action": "convert", | |
| "options": { | |
| "output": "./ctrf-reports/ctrf-report.json", | |
| "toolname": "junit-to-ctrf", | |
| "useSuiteName": false | |
| } | |
| } | |
| } | |
| if: always() | |
| - name: Generate Unit Test Reports | |
| uses: ctrf-io/github-test-reporter@v1 | |
| if: ${{ !cancelled() }} # run this step even if previous step failed | |
| with: | |
| name: JUnit Tests # Name of the check run which will be created | |
| # Job 3: Dart Analysis Server Tests | |
| dart-analysis-server-tests: | |
| strategy: | |
| matrix: | |
| # https://github.com/dart-lang/setup-dart | |
| # Define the Dart SDK versions to test against. | |
| # 'stable' and 'beta' will fetch the latest respective versions. | |
| # You can also specify exact versions like '3.0.0', '3.8.1'. | |
| # dart-version: ['3.0.0', 'stable', 'beta', 'dev' ] | |
| # TODO(https://github.com/flutter/dart-intellij-third-party/issues/47) | |
| # Fix tests to run over additional operating systems as well as Dart SDK versions: | |
| dart-version: ["stable"] | |
| os: [macos-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} # Use the OS from the matrix | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: "temurin" | |
| java-version: "21" | |
| cache: "gradle" | |
| - name: Set up Dart SDK ${{ matrix.dart-version }} | |
| # This action installs the specified Dart SDK version. | |
| # It sets the DART_SDK environment variable to the SDK root. | |
| uses: dart-lang/setup-dart@v1 | |
| with: | |
| sdk: ${{ matrix.dart-version }} | |
| - name: Run Dart Analysis Server Tests with Dart SDK ${{ matrix.dart-version }} | |
| if: always() #runner.os == 'Linux' || runner.os == 'macOS' # Run even if one SDK version fails | |
| # Pass the Dart SDK path with DART_HOME | |
| run: | | |
| ./gradlew :test --tests "com.jetbrains.dart.analysisServer.*" | |
| working-directory: third_party | |
| - name: Generate Server Test Reports | |
| uses: step-security/test-reporter@v2 | |
| if: ${{ !cancelled() }} # run this step even if previous step failed | |
| with: | |
| name: JEST Tests # Name of the check run which will be created | |
| path: reports/jest-*.xml # Path to test results | |
| reporter: jest-junit # Format of test results | |
| #- name: (WINDOWS) Run Dart Analysis Server Tests with Dart SDK ${{ matrix.dart-version }} | |
| # if: runner.os == 'Windows' # Run even if one SDK version fails | |
| # # Pass the Dart SDK path with DART_HOME | |
| # run: | | |
| # ${DART_HOME}/bin/dart --version | |
| # pwd | |
| # ./gradlew :test --tests com.jetbrains.dart.analysisServer.* | |
| # working-directory: third_party | |
| # Job 4: Verify Plugin | |
| verify-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@v4 # Use the latest stable version of actions/checkout | |
| - name: Set up JDK | |
| uses: actions/setup-java@v4 # 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 |