| 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 | version: 7.1 |
| 48 | token: ${{ inputs.github-token }} |
| 49 | |
| 50 | - name: Setup Gradle |
| 51 | uses: gradle/actions/setup-gradle@v3 |
| 52 | |
| 53 | - uses: actions/cache@v4 |
| 54 | with: |
| 55 | path: ~/.npm |
| 56 | key: ${{ runner.os }}-npm-cache-jetbrains-${{ hashFiles('extensions/vscode/package-lock.json') }} |
| 57 | |
| 58 | - uses: actions/cache@v4 |
| 59 | id: vscode-extension-cache |
| 60 | with: |
| 61 | path: extensions/vscode/node_modules |
| 62 | key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }} |
| 63 | |
| 64 | - uses: actions/cache@v4 |
| 65 | id: gui-cache |
| 66 | with: |
| 67 | path: gui/node_modules |
| 68 | key: ${{ runner.os }}-gui-node-modules-${{ hashFiles('gui/package-lock.json') }} |
| 69 | |
| 70 | # Cache prepackaged extension build to share with other jobs |
| 71 | - uses: actions/cache@v4 |
| 72 | id: vscode-prepackage-cache |
| 73 | with: |
| 74 | path: extensions/vscode/build |
| 75 | key: ${{ runner.os }}-vscode-prepackage-${{ hashFiles('extensions/vscode/package-lock.json', 'extensions/vscode/**/*.ts', 'extensions/vscode/**/*.json') }} |
| 76 | |
| 77 | # Only run prepackage if not cached - saves ~1 minute |
| 78 | - name: Run prepackage script |
| 79 | if: steps.vscode-prepackage-cache.outputs.cache-hit != 'true' |
| 80 | shell: bash |
| 81 | run: | |
| 82 | cd extensions/vscode |
| 83 | if [ "${{ steps.vscode-extension-cache.outputs.cache-hit }}" != "true" ]; then |
| 84 | npm ci |
| 85 | fi |
| 86 | npm run prepackage |
| 87 | env: |
| 88 | # https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333 |
| 89 | GITHUB_TOKEN: ${{ inputs.ci-github-token }} |
| 90 | |
| 91 | - uses: actions/cache@v4 |
| 92 | id: binary-cache |
| 93 | with: |
| 94 | path: binary/node_modules |
| 95 | key: ${{ runner.os }}-binary-node-modules-${{ hashFiles('binary/package-lock.json') }} |
| 96 | |
| 97 | - name: Install binary dependencies |
| 98 | if: steps.binary-cache.outputs.cache-hit != 'true' |
| 99 | shell: bash |
| 100 | run: | |
| 101 | cd binary |
| 102 | npm ci |
| 103 | |
| 104 | - name: Build the binaries |
| 105 | shell: bash |
| 106 | run: | |
| 107 | cd binary |
| 108 | npm run build |
| 109 | |
| 110 | - name: Run tests |
| 111 | shell: bash |
| 112 | run: | |
| 113 | cd extensions/intellij |
| 114 | export DISPLAY=:99.0 |
| 115 | Xvfb -ac :99 -screen 0 1920x1080x24 & |
| 116 | sleep 10 |
| 117 | mkdir -p build/reports |
| 118 | ./gradlew test testIntegration |
| 119 | |
| 120 | - name: Move video |
| 121 | if: ${{ failure() }} |
| 122 | shell: bash |
| 123 | run: | |
| 124 | cd extensions/intellij |
| 125 | if [ -d "video" ]; then |
| 126 | mv video build/reports |
| 127 | else |
| 128 | echo "No video directory found to move" |
| 129 | fi |
| 130 | |
| 131 | - name: Copy logs |
| 132 | if: ${{ failure() }} |
| 133 | shell: bash |
| 134 | run: | |
| 135 | cd extensions/intellij |
| 136 | if [ -d "build/idea-sandbox/system/log/" ]; then |
| 137 | mv build/idea-sandbox/system/log/ build/reports |
| 138 | else |
| 139 | echo "No log directory found to copy" |
| 140 | fi |
| 141 | |
| 142 | - name: Save fails report |
| 143 | if: ${{ failure() }} |
| 144 | uses: actions/upload-artifact@v4 |
| 145 | with: |
| 146 | name: jb-failure-report |
| 147 | path: | |
| 148 | ${{ github.workspace }}/extensions/intellij/build/reports |