-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (35 loc) · 1.35 KB
/
pr-dev.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
name: Pull Request to Develop
on:
pull_request:
branches: [ dev ]
jobs:
validate_pull_request:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Salesforce CLI
run: |
wget https://developer.salesforce.com/media/salesforce-cli/sf/channels/stable/sf-linux-x64.tar.xz
mkdir sfdx-cli
tar xJf sf-linux-amd64.tar.xz -C sfdx-cli --strip-components 1
./sfdx-cli/install
- name: Install jq
run: |
sudo apt-get install jq
- name: Populate auth file
shell: bash
run: 'echo ${{secrets.DEVHUB_SFDX_URL}} > ./DEVHUB_SFDX_URL.txt'
- name: Authenticate Dev Hub
run: 'sfdx force:auth:sfdxurl:store -f ./DEVHUB_SFDX_URL.txt -a devhub -d'
- name: Create scratch org
run: 'sfdx force:org:create -f config/project-scratch-def.json -a ci_scratch -s -d 1'
- name: Push source to scratch org
run: 'sfdx force:source:push'
- name: Check code coverage
run: |
sfdx force:apex:test:run --codecoverage --resultformat json --synchronous --testlevel RunLocalTests --wait 10 > tests.json
coverage=$(jq .result.summary.orgWideCoverage tests.json | grep -Eo "[[:digit:]]+")
test $coverage -ge 75
- name: Delete scratch org
if: always()
run: 'sfdx force:org:delete -p -u ci_scratch'