This repository was archived by the owner on Jul 9, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 108
94 lines (78 loc) · 3.55 KB
/
Copy pathscratch-org-sfdx-ci-pr.yml
File metadata and controls
94 lines (78 loc) · 3.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# Unique name for this workflow
name: Salesforce DX PR (scratch org)
# Definition when the workflow should run
on:
pull_request:
types: [opened, edited, synchronize, reopened]
branches-ignore:
- prerelease/spring[2-9][0-9]
- prerelease/summer[2-9][0-9]
- prerelease/winter[2-9][0-9]
# Jobs to be executed
jobs:
formatting-and-linting:
runs-on: ubuntu-latest
steps:
# Checkout the code in the pull request
- name: 'Checkout source code'
uses: actions/checkout@v2
# Cache node_modules to speed up the process
- name: Restore node_modules cache
id: cache-npm
uses: actions/cache@v1
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
scratch-org-test:
runs-on: ubuntu-latest
needs: formatting-and-linting
steps:
# Install Salesforce CLI
- name: Install Salesforce CLI
run: |
wget https://developer.salesforce.com/media/salesforce-cli/sfdx-linux-amd64.tar.xz
mkdir sfdx-cli
tar xJf sfdx-linux-amd64.tar.xz -C sfdx-cli --strip-components 1
./sfdx-cli/install
# Checkout the code in the pull request
- name: 'Checkout source code'
uses: actions/checkout@v2
# 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'
# 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'
# Create dummy Experience site to provision Experience Cloud metadata
- name: 'Create dummy Experience site'
run: sfdx force:community:create --name "Dummy" --templatename "Aloha" -p dummy
# Deploy standard metadata
- name: 'Deploy standard metadata'
run: sfdx force:source:deploy -m ApexClass,Layout,CustomObject,LightningComponentBundle,ManagedContentType,CustomObject,StaticResource,CustomTab,PermissionSet,Flow
# Deploy Experience site metadata
- name: 'Deploy Experience site metadata'
run: sfdx force:source:deploy -m ApexPage,CustomSite,ExperienceBundle,NavigationMenu,Network,Profile
# Assign permissionset to default user
- name: 'Assign permissionset to default user'
run: 'sfdx force:user:permset:assign -n LWR_Marketing_Builder'
# Housekeeping
- name: 'Delete scratch org'
if: always()
run: 'sfdx force:org:delete -p -u scratch-org'