400 lines
11 KiB
YAML
400 lines
11 KiB
YAML
name: PR checks
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- "extensions/vscode/**"
|
|
- "core/**"
|
|
- "gui/**"
|
|
- ".github/workflows/**"
|
|
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- "extensions/intellij/**"
|
|
- "extensions/vscode/**"
|
|
- "core/**"
|
|
- "gui/**"
|
|
- ".github/workflows/**"
|
|
|
|
jobs:
|
|
install-root:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: ".nvmrc"
|
|
|
|
- uses: actions/cache@v4
|
|
id: root-cache
|
|
with:
|
|
path: node_modules
|
|
key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }}
|
|
|
|
- name: Install root dependencies
|
|
if: steps.root-cache.outputs.cache-hit != 'true'
|
|
run: npm ci
|
|
|
|
core-checks:
|
|
needs: install-root
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: ".nvmrc"
|
|
|
|
- uses: actions/cache@v4
|
|
id: root-cache
|
|
with:
|
|
path: node_modules
|
|
key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }}
|
|
|
|
- uses: actions/cache@v4
|
|
id: core-cache
|
|
with:
|
|
path: core/node_modules
|
|
key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }}
|
|
|
|
- name: Install core dependencies
|
|
if: steps.core-cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
cd core
|
|
npm ci
|
|
|
|
- name: Type check and lint
|
|
run: |
|
|
cd core
|
|
npx tsc --noEmit
|
|
npm run lint
|
|
env:
|
|
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
|
|
|
gui-checks:
|
|
needs: [install-root, core-checks]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: ".nvmrc"
|
|
|
|
- uses: actions/cache@v4
|
|
with:
|
|
path: node_modules
|
|
key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }}
|
|
|
|
- uses: actions/cache@v4
|
|
with:
|
|
path: core/node_modules
|
|
key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }}
|
|
|
|
- uses: actions/cache@v4
|
|
id: gui-cache
|
|
with:
|
|
path: gui/node_modules
|
|
key: ${{ runner.os }}-gui-node-modules-${{ hashFiles('gui/package-lock.json') }}
|
|
|
|
- name: Install gui dependencies
|
|
if: steps.gui-cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
cd gui
|
|
npm ci
|
|
|
|
- name: Type check
|
|
run: |
|
|
cd gui
|
|
npx tsc --noEmit
|
|
|
|
binary-checks:
|
|
needs: [install-root, core-checks]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: ".nvmrc"
|
|
|
|
- uses: actions/cache@v4
|
|
with:
|
|
path: node_modules
|
|
key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }}
|
|
|
|
- uses: actions/cache@v4
|
|
with:
|
|
path: core/node_modules
|
|
key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }}
|
|
|
|
- uses: actions/cache@v4
|
|
id: binary-cache
|
|
with:
|
|
path: binary/node_modules
|
|
key: ${{ runner.os }}-binary-node-modules-${{ hashFiles('binary/package-lock.json') }}
|
|
|
|
- name: Install binary dependencies
|
|
if: steps.binary-cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
cd binary
|
|
npm ci
|
|
|
|
- name: Type check
|
|
run: |
|
|
cd binary
|
|
npx tsc --noEmit
|
|
|
|
vscode-checks:
|
|
needs: [install-root, core-checks]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: ".nvmrc"
|
|
|
|
- uses: actions/cache@v4
|
|
with:
|
|
path: node_modules
|
|
key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }}
|
|
|
|
- uses: actions/cache@v4
|
|
with:
|
|
path: core/node_modules
|
|
key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }}
|
|
|
|
- uses: actions/cache@v4
|
|
id: vscode-cache
|
|
with:
|
|
path: extensions/vscode/node_modules
|
|
key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }}
|
|
|
|
- name: Install vscode dependencies
|
|
if: steps.vscode-cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
cd extensions/vscode
|
|
npm ci
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }}
|
|
|
|
- name: Type check and lint
|
|
run: |
|
|
cd extensions/vscode
|
|
npx tsc --noEmit
|
|
npm run lint
|
|
|
|
core-tests:
|
|
needs: [core-checks]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: ".nvmrc"
|
|
|
|
- uses: actions/cache@v4
|
|
with:
|
|
path: core/node_modules
|
|
key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }}
|
|
|
|
- name: Run core tests
|
|
run: |
|
|
cd core
|
|
npm test
|
|
|
|
vscode-tests:
|
|
needs: [vscode-checks, core-checks]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: ".nvmrc"
|
|
|
|
- uses: actions/cache@v4
|
|
id: vscode-node-modules-cache
|
|
with:
|
|
path: extensions/vscode/node_modules
|
|
key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }}
|
|
|
|
- uses: actions/cache@v4
|
|
id: core-node-modules-cache
|
|
with:
|
|
path: core/node_modules
|
|
key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }}
|
|
|
|
- uses: actions/cache@v4
|
|
id: storage-cache
|
|
with:
|
|
path: extensions/vscode/e2e/storage
|
|
key: ${{ runner.os }}-vscode-storage-${{ hashFiles('extensions/vscode/package-lock.json') }}
|
|
|
|
- name: Download Dependencies if Cache Miss
|
|
if: steps.storage-cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
cd extensions/vscode
|
|
npm run e2e:ci:download
|
|
|
|
- name: Set up SSH
|
|
env:
|
|
SSH_KEY: ${{ secrets.GH_ACTIONS_SSH_TEST_KEY_PEM }}
|
|
SSH_HOST: ${{ secrets.GH_ACTIONS_SSH_TEST_DNS_NAME }}
|
|
run: |
|
|
mkdir -p ~/.ssh
|
|
echo "$SSH_KEY" > ~/.ssh/id_rsa
|
|
chmod 600 ~/.ssh/id_rsa
|
|
ssh-keyscan -H "$SSH_HOST" >> ~/.ssh/known_hosts
|
|
echo -e "Host ssh-test-container\n\tHostName $SSH_HOST\n\tUser ec2-user\n\tIdentityFile ~/.ssh/id_rsa" >> ~/.ssh/config
|
|
|
|
- name: Install Xvfb for Linux and run e2e tests
|
|
run: |
|
|
sudo apt-get install -y xvfb # Install Xvfb
|
|
Xvfb :99 & # Start Xvfb
|
|
export DISPLAY=:99 # Export the display number to the environment
|
|
cd extensions/vscode
|
|
npm run package
|
|
npm run e2e:ci:run
|
|
|
|
- name: Upload e2e test screenshots
|
|
if: failure()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: e2e-screenshots
|
|
path: extensions/vscode/e2e/storage/screenshots
|
|
|
|
gui-tests:
|
|
needs: [gui-checks, core-checks]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: ".nvmrc"
|
|
|
|
- uses: actions/cache@v4
|
|
id: gui-cache
|
|
with:
|
|
path: gui/node_modules
|
|
key: ${{ runner.os }}-gui-node-modules-${{ hashFiles('gui/package-lock.json') }}
|
|
|
|
- uses: actions/cache@v4
|
|
with:
|
|
path: core/node_modules
|
|
key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }}
|
|
|
|
- name: Install GUI dependencies
|
|
if: steps.gui-cache.outputs.cache-hit != 'true'
|
|
run: cd gui && npm ci
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }}
|
|
|
|
- name: Run gui tests
|
|
run: |
|
|
cd gui
|
|
npm test
|
|
|
|
jetbrains-tests:
|
|
needs: [install-root, core-checks]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/cache@v4
|
|
with:
|
|
path: core/node_modules
|
|
key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }}
|
|
|
|
- name: Setup Java
|
|
uses: actions/setup-java@v4.5.0
|
|
with:
|
|
distribution: zulu
|
|
java-version: 17
|
|
|
|
- name: Setup FFmpeg
|
|
uses: AnimMouse/setup-ffmpeg@v1
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Setup Gradle
|
|
uses: gradle/actions/setup-gradle@v3
|
|
|
|
- name: Use Node.js from .nvmrc
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: ".nvmrc"
|
|
|
|
- uses: actions/cache@v4
|
|
id: gui-cache
|
|
with:
|
|
path: gui/node_modules
|
|
key: ${{ runner.os }}-gui-node-modules-${{ hashFiles('gui/package-lock.json') }}
|
|
|
|
- name: Build GUI
|
|
run: |
|
|
cd gui
|
|
npm ci
|
|
npm run build
|
|
|
|
- name: Run prepackage script
|
|
run: |
|
|
cd extensions/vscode
|
|
npm ci
|
|
npm run prepackage
|
|
env:
|
|
# https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333
|
|
GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }}
|
|
|
|
- uses: actions/cache@v4
|
|
id: binary-cache
|
|
with:
|
|
path: binary/node_modules
|
|
key: ${{ runner.os }}-binary-node-modules-${{ hashFiles('binary/package-lock.json') }}
|
|
|
|
- name: Build the binaries
|
|
run: |
|
|
cd binary
|
|
npm run build
|
|
|
|
- name: Start test IDE
|
|
run: |
|
|
cd extensions/intellij
|
|
export DISPLAY=:99.0
|
|
Xvfb -ac :99 -screen 0 1920x1080x24 &
|
|
sleep 10
|
|
mkdir -p build/reports
|
|
./gradlew runIdeForUiTests &
|
|
|
|
- name: Wait for JB connection
|
|
uses: jtalk/url-health-check-action@v3
|
|
with:
|
|
url: http://127.0.0.1:8082
|
|
max-attempts: 15
|
|
retry-delay: 30s
|
|
|
|
- name: Run tests
|
|
run: |
|
|
cd extensions/intellij
|
|
export DISPLAY=:99.0
|
|
./gradlew test
|
|
|
|
- name: Move video
|
|
if: ${{ failure() }}
|
|
run: |
|
|
cd extensions/intellij
|
|
mv video build/reports
|
|
|
|
- name: Copy logs
|
|
if: ${{ failure() }}
|
|
run: |
|
|
cd extensions/intellij
|
|
mv build/idea-sandbox/system/log/ build/reports
|
|
|
|
- name: Save fails report
|
|
if: ${{ failure() }}
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: jb-failure-report
|
|
path: |
|
|
${{ github.workspace }}/extensions/intellij/build/reports
|