| 1 | name: "Run JetBrains Tests" |
| 2 | description: "Setup and run JetBrains IntelliJ tests with all dependencies" |
| 3 | |
| 4 | inputs: |
| 5 | github-token: |
| 6 | description: "GitHub token for accessing repositories" |
| 7 | required: true |
| 8 | ci-github-token: |
| 9 | description: "CI GitHub token for vscode extension build" |
| 10 | required: true |
| 11 | |
| 12 | runs: |
| 13 | using: "composite" |
| 14 | steps: |
| 15 | - uses: actions/setup-node@v4 |
| 16 | with: |
| 17 | node-version-file: ".nvmrc" |
| 18 | |
| 19 | - uses: actions/cache@v4 |
| 20 | with: |
| 21 | path: core/node_modules |
| 22 | key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} |
| 23 | |
| 24 | - name: Build packages and install core dependencies |
| 25 | shell: bash |
| 26 | run: | |
| 27 | node ./scripts/build-packages.js |
| 28 | cd core |
| 29 | npm ci |
| 30 | |
| 31 | - name: Install gui node_modules and build |
| 32 | shell: bash |
| 33 | run: | |
| 34 | cd gui |
| 35 | npm ci |
| 36 | npm run build |
| 37 | |
| 38 | - name: Setup Java |
| 39 | uses: actions/setup-java@v4.5.0 |
| 40 | with: |
| 41 | distribution: zulu |
| 42 | java-version: 17 |
| 43 | |
| 44 | - name: Setup FFmpeg |
| 45 | uses: AnimMouse/setup-ffmpeg@v1 |
| 46 | with: |
| 47 | token: ${{ inputs.github-token }} |
| 48 | |
| 49 | - name: Setup Gradle |
| 50 | uses: gradle/actions/setup-gradle@v3 |
| 51 | |
| 52 | - uses: actions/cache@v4 |
| 53 | with: |
| 54 | path: ~/.npm |
| 55 | key: ${{ runner.os }}-npm-cache-jetbrains-${{ hashFiles('extensions/vscode/package-lock.json') }} |
| 56 | |
| 57 | - uses: actions/cache@v4 |
| 58 | id: vscode-extension-cache |
| 59 | with: |
| 60 | path: extensions/vscode/node_modules |
| 61 | key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }} |
| 62 | |
| 63 | - uses: actions/cache@v4 |
| 64 | id: gui-cache |
| 65 | with: |
| 66 | path: gui/node_modules |
| 67 | key: ${{ runner.os }}-gui-node-modules-${{ hashFiles('gui/package-lock.json') }} |
| 68 | |
| 69 | # Cache prepackaged extension build to share with other jobs |
| 70 | - uses: actions/cache@v4 |
| 71 | id: vscode-prepackage-cache |
| 72 | with: |
| 73 | path: extensions/vscode/build |
| 74 | key: ${{ runner.os }}-vscode-prepackage-${{ hashFiles('extensions/vscode/package-lock.json', 'extensions/vscode/**/*.ts', 'extensions/vscode/**/*.json') }} |
| 75 | |
| 76 | # Only run prepackage if not cached - saves ~1 minute |
| 77 | - name: Run prepackage script |
| 78 | if: steps.vscode-prepackage-cache.outputs.cache-hit != 'true' |
| 79 | shell: bash |
| 80 | run: | |
| 81 | cd extensions/vscode |
| 82 | if [ "${{ steps.vscode-extension-cache.outputs.cache-hit }}" != "true" ]; then |
| 83 | npm ci |
| 84 | fi |
| 85 | npm run prepackage |
| 86 | env: |
| 87 | # https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333 |
| 88 | GITHUB_TOKEN: ${{ inputs.ci-github-token }} |
| 89 | |
| 90 | - uses: actions/cache@v4 |
| 91 | id: binary-cache |
| 92 | with: |
| 93 | path: binary/node_modules |
| 94 | key: ${{ runner.os }}-binary-node-modules-${{ hashFiles('binary/package-lock.json') }} |
| 95 | |
| 96 | - name: Build the binaries |
| 97 | shell: bash |
| 98 | run: | |
| 99 | cd binary |
| 100 | npm run build |
| 101 | |
| 102 | - name: Start test IDE |
| 103 | shell: bash |
| 104 | run: | |
| 105 | cd extensions/intellij |
| 106 | export DISPLAY=:99.0 |
| 107 | Xvfb -ac :99 -screen 0 1920x1080x24 & |
| 108 | sleep 10 |
| 109 | mkdir -p build/reports |
| 110 | ./gradlew runIdeForUiTests & |
| 111 | |
| 112 | - name: Wait for JB connection |
| 113 | uses: jtalk/url-health-check-action@v3 |
| 114 | with: |
| 115 | url: http://127.0.0.1:8082 |
| 116 | max-attempts: 15 |
| 117 | retry-delay: 30s |
| 118 | |
| 119 | - name: Run tests |
| 120 | shell: bash |
| 121 | run: | |
| 122 | cd extensions/intellij |
| 123 | export DISPLAY=:99.0 |
| 124 | ./gradlew test |
| 125 | |
| 126 | - name: Move video |
| 127 | if: ${{ failure() }} |
| 128 | shell: bash |
| 129 | run: | |
| 130 | cd extensions/intellij |
| 131 | mv video build/reports |
| 132 | |
| 133 | - name: Copy logs |
| 134 | if: ${{ failure() }} |
| 135 | shell: bash |
| 136 | run: | |
| 137 | cd extensions/intellij |
| 138 | mv build/idea-sandbox/system/log/ build/reports |
| 139 | |
| 140 | - name: Save fails report |
| 141 | if: ${{ failure() }} |
| 142 | uses: actions/upload-artifact@v4 |
| 143 | with: |
| 144 | name: jb-failure-report |
| 145 | path: | |
| 146 | ${{ github.workspace }}/extensions/intellij/build/reports |