Skip to content

build: bumped dependencies #99

build: bumped dependencies

build: bumped dependencies #99

Workflow file for this run

# Unique name for this workflow
name: CI
# Definition when the workflow should run
on:
workflow_dispatch:
push:
branches:
- main
paths-ignore:
- 'sfdx-project.json'
- 'README.md'
# Jobs to be executed
jobs:
format-lint-lwc-tests:
runs-on: trailheadapps-Ubuntu
steps:
# Checkout the source code
- name: 'Checkout source code'
uses: actions/checkout@v3
# 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: npm ci
# Prettier formatting
- name: 'Code formatting verification with Prettier'
run: npm run prettier:verify
# Lint LWC
- name: 'Lint Lightning Web Components'
run: npm run lint
# LWC unit tests
- name: 'Unit test Lightning Web Components'
run: npm run test:unit:coverage
# Upload code coverage data
- name: 'Upload code coverage for LWC to Codecov.io'
uses: codecov/codecov-action@v3
with:
flags: LWC
scratch-org-test:
runs-on: trailheadapps-Ubuntu
needs: format-lint-lwc-tests
if: ${{ github.actor != 'dependabot[bot]' }}
steps:
# Install Salesforce CLI
- name: 'Install Salesforce CLI'
run: |
npm install sfdx-cli --location=global
nodeInstallPath=$(npm config get prefix)
echo "$nodeInstallPath/bin" >> $GITHUB_PATH
sfdx --version
# Checkout the source code
- name: 'Checkout source code'
uses: actions/checkout@v3
# Store secret for dev hub
- name: 'Populate auth file with DEVHUB_SFDX_URL secret'
shell: bash
run: |
echo ${{ secrets.DEVHUB_SFDX_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: sfdx auth:sfdxurl:store -f ./DEVHUB_SFDX_URL.txt -a devhub -d
# Create scratch org
- name: 'Create scratch org'
run: sfdx force:org:create -f config/project-scratch-def.json -a scratch-org -s -d 1
# Deploy source to scratch org
- name: 'Push source to scratch org'
run: sfdx force:source:push
# Assign permissionset
- name: 'Assign permissionset to default user'
run: sfdx force:user:permset:assign -n ebikes
# Import sample data
- name: 'Import sample data'
run: sfdx force:data:tree:import -p ./data/sample-data-plan.json
# Wait for XP Cloud activation
- name: 'Wait for two min for XP Cloud activation'
uses: maddox/actions/sleep@master
with:
args: 120
# Publish XP Cloud site
- name: 'Publish XP Cloud site'
run: sfdx force:community:publish -n E-Bikes
# Deploy guest profile for XP Cloud site
- name: 'Deploy guest profile for XP Cloud site'
run: sfdx force:mdapi:deploy -d guest-profile-metadata -w 10
# Run Apex tests in scratch org
- name: 'Run Apex tests'
run: sfdx force: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: sfdx force:org:delete -p -u scratch-org