Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parallelize Github Actions #3292

Merged
merged 20 commits into from
Dec 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
236 changes: 175 additions & 61 deletions .github/workflows/pr_checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,90 +4,204 @@ on:
pull_request:
branches:
- main

paths:
- "extensions/vscode/**"
- "core/**"
- "gui/**"
- ".github/workflows**"

jobs:
tsc-check:
install-root:
runs-on: ubuntu-latest

steps:
# 1. Check-out repository
- name: Check-out repository
uses: actions/checkout@v4

# 2. Install npm dependencies
- name: Use Node.js from .nvmrc
uses: actions/setup-node@v4
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"

- name: Cache root node_modules
uses: actions/cache@v3
- uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }}

- name: Cache extension node_modules
uses: actions/cache@v3
with:
path: extensions/vscode/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('extensions/vscode/package-lock.json') }}
- name: Install root dependencies
run: npm ci

- name: Cache core node_modules
uses: actions/cache@v3
core-checks:
needs: install-root
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
path: core/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('core/package-lock.json') }}
node-version-file: ".nvmrc"

- name: Cache gui node_modules
uses: actions/cache@v3
- uses: actions/cache@v3
with:
path: gui/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('gui/package-lock.json') }}
path: node_modules
key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }}

- name: Cache binary node_modules
uses: actions/cache@v3
- uses: actions/cache@v3
with:
path: binary/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('binary/package-lock.json') }}
path: core/node_modules
key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }}

- name: root install
- name: Install core dependencies
run: |
cd core
npm ci

- name: extensions/vscode install
- name: Type check and lint
run: |
cd extensions/vscode
npm ci
cd core
npx tsc --noEmit
npm run lint
env:
# https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333
GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }}
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@v3
with:
path: node_modules
key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }}

- uses: actions/cache@v3
with:
path: core/node_modules
key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }}

- name: core install
- uses: actions/cache@v3
with:
path: gui/node_modules
key: ${{ runner.os }}-gui-node-modules-${{ hashFiles('gui/package-lock.json') }}

- name: Install gui dependencies
run: |
cd core
cd gui
npm ci

- name: gui install
- 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@v3
with:
path: node_modules
key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }}

- uses: actions/cache@v3
with:
path: core/node_modules
key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }}

- uses: actions/cache@v3
with:
path: binary/node_modules
key: ${{ runner.os }}-binary-node-modules-${{ hashFiles('binary/package-lock.json') }}

- name: Install binary dependencies
run: |
cd binary
npm ci

- name: binary install
- 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@v3
with:
path: node_modules
key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }}

- uses: actions/cache@v3
with:
path: core/node_modules
key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }}

- uses: actions/cache@v3
with:
path: extensions/vscode/node_modules
key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }}

- name: Install vscode dependencies
run: |
cd extensions/vscode
npm ci
env:
GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }}

- name: extensions/vscode checks
- 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@v3
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@v3
with:
path: extensions/vscode/node_modules
key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }}

- uses: actions/cache@v3
with:
path: core/node_modules
key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }}

- name: Install Xvfb for Linux and run e2e tests
run: |
sudo apt-get install -y xvfb # Install Xvfb
Expand All @@ -97,29 +211,29 @@ jobs:
npm run package
npm run e2e:ci

- name: core checks
run: |
cd core
npm ci
npx tsc --noEmit
npm run lint
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
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"

- name: gui checks
run: |
cd gui
npx tsc --noEmit
- uses: actions/cache@v3
with:
path: gui/node_modules
key: ${{ runner.os }}-gui-node-modules-${{ hashFiles('gui/package-lock.json') }}

- name: binary checks
run: |
cd binary
npx tsc --noEmit
- uses: actions/cache@v3
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
- name: Install GUI dependencies
run: cd gui && npm ci
env:
GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }}

- name: Run gui tests
run: |
Expand Down
Loading