[tests] add test and problem report uploading to the server test workflow #221
Workflow file for this run
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 | |
| 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: | |
| needs: build-plugin | |
| 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 | |
| # Job 3: Dart Analysis Server Tests | |
| dart-analysis-server-tests: | |
| needs: build-plugin | |
| 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 ] | |
| 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() # 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 | |
| # Job 4: Verify Plugin | |
| verify-plugin: | |
| 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@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 | |
| # Job 5: Upload Test Report | |
| upload-test-report: | |
| needs: 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 ] | |
| runs-on: ${{ matrix.os }} # Use the OS from the matrix | |
| steps: | |
| - name: Upload Test Report Artifact | |
| uses: actions/upload-artifact@v4 | |
| if: always() # IMPORTANT: Upload reports even if the tests fail | |
| with: | |
| name: gradle-test-report-${{ matrix.dart-version }}-${{ matrix.os }} | |
| path: Users/runner/work/dart-intellij-third-party/dart-intellij-third-party/third_party/build/reports/tests/test/index.html | |
| retention-days: 7 | |
| # Job 6: Upload Test Report | |
| upload-problems: | |
| needs: 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 ] | |
| runs-on: ${{ matrix.os }} # Use the OS from the matrix | |
| steps: | |
| - name: Upload Problem Report Artifact | |
| uses: actions/upload-artifact@v4 | |
| if: always() # IMPORTANT: Upload reports even if the tests fail | |
| with: | |
| name: gradle-problem-report-${{ matrix.dart-version }}-${{ matrix.os }} | |
| path: ///Users/runner/work/dart-intellij-third-party/dart-intellij-third-party/third_party/build/reports/problems/problems-report.html | |
| retention-days: 7 |