Skip to content

Implement LinkedMap class #108

Implement LinkedMap class

Implement LinkedMap class #108

Workflow file for this run

# Unique name for this workflow
name: CI on PR
# Definition when the workflow should run
on:
workflow_dispatch:
inputs:
prerelease:
description: 'Run on a prerelease org?'
required: false
type: boolean
pull_request:
types: [opened, edited, synchronize, reopened]
paths:
- 'force-app/**'
# Workflow environment variables
env:
# Is the PR base branch a prerelease branch
IS_PRERELEASE: ${{ startsWith(github.event.pull_request.base.ref, 'prerelease/') || inputs.prerelease }}
# Jobs to be executed
jobs:
# GPT-4 code review
review:
runs-on: ubuntu-latest
steps:
- uses: fluxninja/openai-pr-reviewer@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
with:
debug: false
review_comment_lgtm: false
# Formatting only runs on human-submitted and Dependabot PRs
format-and-linting:
runs-on: ubuntu-latest
container:
image: salesforce/cli:2.12.4-full
steps:
# Checkout the source code
- name: 'Checkout source code'
uses: actions/checkout@v4
# Run PMD scan
- name: 'Run PMD scan'
uses: pmd/pmd-github-action@main
id: pmd
with:
version: 'latest'
sourcePath: 'force-app'
rulesets: 'pmd/ruleset.xml'
- name: Upload violations file in SARIF format
if: steps.pmd.outputs.violations != 0
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: pmd-report.sarif
category: PMD analysis
# Check for PMD violations
- name: 'Check for PMD violations'
if: steps.pmd.outputs.violations != 0
run: exit 1
# Install Volta to enforce proper node and package manager versions
- name: 'Install Volta'
uses: volta-cli/action@v4
# Cache node_modules to speed up the process
- name: 'Restore node_modules cache'
id: cache-npm
uses: actions/cache@v3
with:
path: node_modules
key: npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
npm-${{ env.cache-name }}-
npm-
# Install npm dependencies for Prettier and Jest
- name: 'Install npm dependencies'
if: steps.cache-npm.outputs.cache-hit != 'true'
run: HUSKY=0 npm ci
# Start local Apex parser server for Prettier
# - name: 'Start local Apex parser server for Prettier'
# run: |
# echo 'Starting Apex language server'
# nohup npm run apex:local:start >/dev/null 2>&1 &
# echo 'Waiting on Apex language server'
# npx wait-on -t 30000 http://127.0.0.1:2117/api/ast/
# Prettier formatting
- name: 'Code formatting verification with Prettier'
run: npm run prettier:verify
# Stop local Apex parser server for Prettier
# - name: 'Stop local Apex parser server for Prettier'
# if: always()
# run: npm run apex:local:stop
# # Lint LWC
# - name: 'Lint Lightning Web Components'
# run: npm run lint
scratch-org-test:
runs-on: ubuntu-latest
container:
image: salesforce/cli:2.12.4-full
needs: format-and-linting
steps:
# Checkout the source code
- name: 'Checkout source code'
uses: actions/checkout@v4
# Install Salesforce CLI
- name: 'Install Salesforce CLI'
run: |
npm install @salesforce/cli --location=global
nodeInstallPath=$(npm config get prefix)
echo "$nodeInstallPath/bin" >> $GITHUB_PATH
sf --version
# Store secret for dev hub
- name: 'Populate auth file with DEVHUB_SFDX_URL secret'
shell: bash
run: |
echo ${{ secrets.SALESFORCE_AUTH_URL }} > ./DEVHUB_SFDX_URL.txt
secretFileSize=$(wc -c "./DEVHUB_SFDX_URL.txt" | awk '{print $1}')
if [ $secretFileSize == 1 ]; then
echo "Missing DEVHUB_SFDX_URL secret. Is this workflow running on a fork?";
exit 1;
fi
# Authenticate dev hub
- name: 'Authenticate Dev Hub'
run: sf org login sfdx-url -f ./DEVHUB_SFDX_URL.txt -a devhub -d
# Create prerelease scratch org
- name: 'Create prerelease scratch org'
if: ${{ env.IS_PRERELEASE }}
run: sf org create scratch -f config/project-scratch-def.json -a scratch-org -d -y 1 --release=preview
# Create scratch org
- name: 'Create scratch org'
if: ${{ !env.IS_PRERELEASE }}
run: sf org create scratch -f config/project-scratch-def.json -a scratch-org -d -y 1
# Deploy source to scratch org
- name: 'Push source to scratch org'
run: sf project deploy start
# Assign permissionset
- name: 'Assign permissionset to default user'
run: sf org assign permset -n Async_Log_Access
# # Import sample data
# - name: 'Import sample data'
# run: sf data tree import -p data/data-plan.json -p data/data-plan2.json
# Run Apex tests in scratch org
- name: 'Run Apex tests'
run: sf apex test run -c -r human -d ./tests/apex -w 20
# Upload code coverage data
- name: 'Upload code coverage for Apex to Codecov.io'
uses: codecov/codecov-action@v3
with:
flags: Apex
# Housekeeping
- name: 'Delete scratch org'
if: always()
run: sf org delete scratch -p -o scratch-org
trigger-packaging:
runs-on: ubuntu-latest
needs: scratch-org-test
steps:
# Checkout the source code
- name: 'Checkout source code'
uses: actions/checkout@v4
# Check for package changes using git diff
- name: 'Check for package changes'
id: checkForChanges
run: |
git fetch origin $GITHUB_BASE_REF --depth=1
changedPaths=$( git diff-tree --name-only origin/$GITHUB_BASE_REF $GITHUB_SHA )
set +e
hasChanges='false'
if [ $(echo "$changedPaths" | grep -c '^force-app') == 1 ]; then
hasChanges='true'
fi
echo "hasChanges=$hasChanges" >> $GITHUB_OUTPUT
# Trigger packaging PR workflow
- name: 'Trigger packaging PR workflow if needed'
uses: peter-evans/repository-dispatch@v2
if: steps.checkForChanges.outputs.hasChanges == 'true'
with:
token: ${{ secrets.BOT_ACCESS_TOKEN }}
event-type: start-packaging-pr
client-payload: '{ "ref": "${{ github.ref }}", "sha": "${{ github.sha }}", "isPrelease": "${{ env.IS_PRERELEASE }}" }'