Skip to content

[WIP] PearAI Inventory Feature #9

[WIP] PearAI Inventory Feature

[WIP] PearAI Inventory Feature #9

name: Build Verification
on:
workflow_dispatch:
pull_request:
branches:
- main
jobs:
windows:
name: Windows
runs-on: windows-2022
timeout-minutes: 60
env:
CHILD_CONCURRENCY: "1"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Cache node modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Cache Yarn dependencies
uses: actions/cache@v4
with:
path: ~/.cache/yarn
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install --network-timeout 180000
- name: Create node_modules archive
run: |
mkdir -Force .build
node build/azure-pipelines/common/listNodeModules.js .build/node_modules_list.txt
mkdir -Force .build/node_modules_cache
7z.exe a .build/node_modules_cache/cache.7z -mx3 `@.build/node_modules_list.txt
- name: Compile and Download
run: yarn npm-run-all --max-old-space-size=4095 -lp compile playwright-install download-builtin-extensions
- name: Compile Integration Tests
run: yarn --cwd test/integration/browser compile
# Runner is getting caught on this,
# commenting out until resolved
- name: Run Unit Tests (Electron)
run: .\scripts\test.bat
continue-on-error: true
- name: Run Unit Tests (node.js)
run: yarn test-node
- name: Run Unit Tests (Browser, Chromium)
run: yarn test-browser-no-install --browser chromium
- name: Run Integration Tests (Electron)
run: .\scripts\test-integration.bat
continue-on-error: true
- name: Run Integration Tests (Browser, Firefox)
timeout-minutes: 20
run: .\scripts\test-web-integration.bat --browser firefox
- name: Run Integration Tests (Remote)
timeout-minutes: 20
run: .\scripts\test-remote-integration.bat
continue-on-error: true
linux:
name: Linux
runs-on: ubuntu-latest
timeout-minutes: 40
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
# TODO: rename azure-pipelines/linux/xvfb.init to github-actions
- name: Setup Build Environment
run: |
sudo apt-get update
sudo apt-get install -y libxkbfile-dev pkg-config libkrb5-dev libxss1 dbus xvfb libgtk-3-0 libgbm1
sudo cp ./build/azure-pipelines/linux/xvfb.init /etc/init.d/xvfb
sudo chmod +x /etc/init.d/xvfb
sudo update-rc.d xvfb defaults
sudo service xvfb start
- name: Compute node modules cache key
id: nodeModulesCacheKey
run: echo "value=$(node build/azure-pipelines/common/computeNodeModulesCacheKey.js)" >> $GITHUB_OUTPUT
- name: Cache node modules
id: cacheNodeModules
uses: actions/cache@v4
with:
path: "**/node_modules"
key: ${{ runner.os }}-cacheNodeModulesLinux-${{ steps.nodeModulesCacheKey.outputs.value }}
restore-keys: ${{ runner.os }}-cacheNodeModulesLinux-
- name: Get yarn cache directory path
id: yarnCacheDirPath
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Cache yarn directory
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
uses: actions/cache@v4
with:
path: ${{ steps.yarnCacheDirPath.outputs.dir }}
key: ${{ runner.os }}-yarnCacheDir-${{ steps.nodeModulesCacheKey.outputs.value }}
restore-keys: ${{ runner.os }}-yarnCacheDir-
- name: Execute yarn
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: |
yarn --network-timeout 180000
yarn playwright install
- name: Compile and Download
run: ./scripts/pearai/setup-environment.sh
- name: Compile Integration Tests
run: yarn --cwd test/integration/browser compile
# Runner is getting caught on this,
# commenting out until resolved
# - name: Run Unit Tests (Electron)
# id: electron-unit-tests
# run: DISPLAY=:10 ./scripts/test.sh
# continue-on-error: true
# Part of the VSCode Scripts
# Disabling since it isn't relevant to PearAI
# - name: Run Unit Tests (node.js)
# id: nodejs-unit-tests
# run: yarn test-node
- name: Run Unit Tests (Browser, Chromium)
id: browser-unit-tests
run: DISPLAY=:10 yarn test-browser-no-install --browser chromium
# Part of the VSCode Scripts
# Disabling since it isn't relevant to PearAI
# - name: Run Integration Tests (Electron)
# id: electron-integration-tests
# run: DISPLAY=:10 ./scripts/test-integration.sh
- name: Run Integration Tests (Browser, Chromium)
id: browser-integration-tests
run: DISPLAY=:10 ./scripts/test-web-integration.sh --browser chromium
- name: Run Integration Tests (Remote)
id: electron-remote-integration-tests
timeout-minutes: 15
run: DISPLAY=:10 ./scripts/test-remote-integration.sh
continue-on-error: true
darwin:
name: macOS
runs-on: macos-latest
timeout-minutes: 40
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- name: Setup MacOS Environment
run: softwareupdate --install-rosetta --agree-to-license
- name: Install Dependencies
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: |
./scripts/pearai/setup-environment.sh
yarn install
yarn add --dev npm-run-all
- name: Compile and Download
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ELECTRON_VERSION: v31.1.1 # or whatever the latest version is
run: yarn npm-run-all --max-old-space-size=4095 -lp compile playwright-install download-builtin-extensions
- name: Compile Integration Tests
run: yarn --cwd test/integration/browser compile
# This is required for SecretStorage unittests
- name: Create temporary keychain
run: |
security create-keychain -p pwd $RUNNER_TEMP/buildagent.keychain
security default-keychain -s $RUNNER_TEMP/buildagent.keychain
security unlock-keychain -p pwd $RUNNER_TEMP/buildagent.keychain
# Part of the VSCode Scripts, currently not working
# due to Electron issues.
- name: Run Unit Tests (Electron)
run: DISPLAY=:10 ./scripts/test.sh
continue-on-error: True
- name: Run Unit Tests (node.js)
run: yarn test-node
- name: Run Unit Tests (Browser, Chromium)
run: |
DISPLAY=:10 yarn test-browser-no-install --browser chromium
DISPLAY=:10 yarn test-browser-no-install --browser webkit
# Part of the VSCode Scripts, currently not working
# due to Electron issues.
- name: Run Integration Tests (Electron)
run: DISPLAY=:10 ./scripts/test-integration.sh
# Passed Locally
- name: Run Integration Tests (Browser, Webkit)
run: |
DISPLAY=:10 ./scripts/test-web-integration.sh --browser webkit
DISPLAY=:10 ./scripts/test-web-integration.sh --browser chromium
# Part of the VSCode Scripts, currently not working
# due to Electron issues.
# - name: Run Integration Tests (Remote)
# timeout-minutes: 15
# run: DISPLAY=:10 ./scripts/test-remote-integration.sh
# continue-on-error: true
hygiene:
runs-on: ubuntu-latest
timeout-minutes: 40
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libkrb5-dev
- name: Compute cache keys
id: cache-keys
run: |
echo "node_modules_key=$(node build/azure-pipelines/common/computeNodeModulesCacheKey.js)" >> $GITHUB_OUTPUT
echo "yarn_cache_dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Cache node_modules
uses: actions/cache@v4
id: cache-node-modules
with:
path: "**/node_modules"
key: ${{ runner.os }}-node-modules-${{ steps.cache-keys.outputs.node_modules_key }}
- name: Cache Yarn directory
uses: actions/cache@v4
if: steps.cache-node-modules.outputs.cache-hit != 'true'
with:
path: ${{ steps.cache-keys.outputs.yarn_cache_dir }}
key: ${{ runner.os }}-yarn-${{ steps.cache-keys.outputs.node_modules_key }}
restore-keys: ${{ runner.os }}-yarn-
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: yarn --network-timeout 180000
- name: Download Playwright
run: yarn playwright-install
- name: Run checks
run: |
yarn valid-layers-check
yarn --cwd build compile
yarn eslint
yarn vscode-dts-compile-check
yarn tsec-compile-check
# Uncomment when issues are resolved
# - name: Run Hygiene Checks
# run: yarn gulp hygiene
# - name: Check clean git state
# run: ./.github/workflows/check-clean-git-state.sh