-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (40 loc) · 1.39 KB
/
apex-tests-pr.yml
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
name: Salesforce CI - Build and Test Package on Open PR & Merge
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v1
with:
node-version: "21.x"
- name: Install Salesforce CLI
run: |
npm install --global sfdx-cli
sfdx --version
sfdx plugins --core
- name: Checkout repository
uses: actions/checkout@v2
# Store Secret for debhub
- name: Populate auth file with DEVHUB_SFDX_URL secrets
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 "DEVHUB_SFDX_URL secret is empty or not set. Is this workflow running on a fork? Exiting...";
exit 1;
fi
- name: Authenticate to Dev Hub
run: sfdx auth:sfdxurl:store -f ./DEVHUB_SFDX_URL.txt -a devhub -d
- name: Create Scratch Org
run: sfdx force:org:create -s -f config/project-scratch-def.json -a MyScratchOrg
- name: Push Source to Scratch Org
run: sfdx force:source:push -u MyScratchOrg
- name: Run Apex Tests
run: sfdx force:apex:test:run -u MyScratchOrg --wait 10 --resultformat human --codecoverage