production-heartbeat #26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: production-heartbeat | |
on: | |
workflow_dispatch: # As per documentation, the colon is necessary even though no config is required. | |
schedule: | |
# Cron syntax is "minute[0-59] hour[0-23] date[1-31] month[1-12] day[0-6]". '*' is 'any value', and multiple values | |
# can be specified with comma-separated lists. All times are UTC. | |
# So this expression means "run at 45 minutes past 1, 5, and 9 AM/PM UTC". The hours were chosen so that | |
# the jobs run only close to business hours of Central Time. | |
# Days were chosen to run only from Monday through Friday. | |
- cron: '45 13,17,21 * * 1,2,3,4,5' | |
jobs: | |
production-heartbeat: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [{vm: ubuntu-latest, exe: .sh}, {vm: windows-2019, exe: .cmd}, {vm: macos-latest, exe: .sh}] | |
node: ['lts/*'] | |
runs-on: ${{ matrix.os.vm }} | |
timeout-minutes: 60 | |
steps: | |
# 1 Install VS Code and Extension on Ubuntu | |
- name: Install VS Code on Ubuntu | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt update | |
sudo apt install wget gpg -y | |
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg | |
sudo install -o root -g root -m 644 packages.microsoft.gpg /usr/share/keyrings/ | |
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list' | |
sudo apt update | |
sudo apt install code -y | |
- name: Install Salesforce Code Analyzer Extension on Ubuntu | |
if: runner.os == 'Linux' | |
run: | | |
code --install-extension salesforce.sfdx-code-analyzer-vscode | |
- name: Verify Extension Installation on Ubuntu | |
if: runner.os == 'Linux' | |
run: | | |
if code --list-extensions | grep -q 'salesforce.sfdx-code-analyzer-vscode'; then | |
echo "Extension installed successfully" | |
else | |
echo "Extension installation failed" && exit 1 | |
fi | |
# 2 Install VS Code and Extension on Windows | |
- name: Install VS Code on Windows | |
if: runner.os == 'Windows' | |
run: | | |
# Ensure no conflicting instances of VS Code are running | |
Stop-Process -Name "Code" -Force -ErrorAction SilentlyContinue | |
# Download and install Visual Studio Code | |
Write-Host "Downloading VS Code..." | |
Invoke-WebRequest -Uri "https://code.visualstudio.com/sha/download?build=stable&os=win32-x64-user" -OutFile vscode_installer.exe | |
Write-Host "Downloading VS Code complete" | |
# Install VS Code silently | |
Write-Host "Installing Visual Studio Code..." | |
./vscode_installer.exe | |
Write-Host "VS Code installation complete" | |
Write-Host "Adding VS Code CLI (code) to PATH..." | |
$codePath = "C:\Users\${env:USERPROFILE}\AppData\Local\Programs\Microsoft VS Code\bin" | |
[System.Environment]::SetEnvironmentVariable("PATH", $env:PATH + ";" + $codePath, [System.EnvironmentVariableTarget]::Process) | |
Write-Host "VS Code CLI added to PATH." | |
- name: Install Salesforce Code Analyzer Extension on Windows | |
if: runner.os == 'Windows' | |
run: | | |
Write-Host "Installing Code Analyzer Extension..." | |
DIR C:\ | |
DIR "C:\Program Files\" | |
DIR "C:\Program Files (x86)\" | |
# 3 Install VS Code and Extension on macOS | |
- name: Install VS Code on macOS | |
if: runner.os == 'macOS' | |
run: | | |
brew install --cask visual-studio-code | |
- name: Install Salesforce Code Analyzer Extension on macOS | |
if: runner.os == 'macOS' | |
run: | | |
code --install-extension salesforce.sfdx-code-analyzer-vscode | |
- name: Verify Extension Installation on macOS | |
if: runner.os == 'macOS' | |
run: | | |
if code --list-extensions | grep -q 'salesforce.sfdx-code-analyzer-vscode'; then | |
echo "Extension installed successfully" | |
else | |
echo "Extension installation failed" && exit 1 | |
fi |