-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (45 loc) · 1.91 KB
/
build.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
51
52
53
name: Deploy Validation and Analysis
on:
workflow_dispatch:
pull_request:
types: [opened, synchronize, reopened]
branches: [main]
push:
branches:
- main
jobs:
deploy:
name: ValidateSource
runs-on: 'ubuntu-latest'
container: salesforce/salesforcedx:latest-rc-full
steps:
- name: Clone Repository (Latest)
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.ref }}
- name: 'Populate auth file with DevHub secret'
shell: bash
run: |
echo ${{ secrets.DEVHUB_KEY}} > ./DEVHUB_KEY.txt
secretFileSize=$(wc -c "./DEVHUB_KEY.txt" | awk '{print $1}')
if [ $secretFileSize == 1 ]; then
echo "Missing DEVHUB_KEY secret.";
exit 1;
fi
- name: 'Authenticate DevHub'
run: sfdx auth:sfdxurl:store -f ./DEVHUB_KEY.txt -a devhub
- name: 'Create Scratch Org'
run: sfdx force:org:create -f config/project-scratch-def.json -a testorg -d 1 -s -v devhub
- name: 'Install Dependencies'
run: sfdx force:package:install --package=04t08000000AzzpAAC --wait=30
- name: 'Deploy Source'
run: sfdx force:source:push
- name: 'Run Tests'
run: sfdx force:apex:test:run --testlevel=RunLocalTests --codecoverage --resultformat=json --outputdir=./tests/apex
- name: 'Delete Scratch Org'
run: sfdx force:org:delete --targetusername=testorg --noprompt
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}