-
Notifications
You must be signed in to change notification settings - Fork 518
35 lines (30 loc) · 1.7 KB
/
deploy.and.test.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
name: Create a Scratch Org, Push Source and Run Apex Tests
on:
push:
pull_request_target:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Install SFDX CLI and authorize DevHub
uses: apex-enterprise-patterns/setup-sfdx@v1 #We're using a fork of https://github.com/sfdx-actions/setup-sfdx for safety
with:
sfdx-auth-url: ${{ secrets.DEVHUB_SFDXURL }}
- run: sfdx force:config:set defaultdevhubusername=SFDX-ENV -g #Even though the setup-sfdx action uses --setdefaultdevhubusername, it doesn't seem to stick since it uses --setdefaultusername so we brute force it here
- run: echo y | sfdx plugins:install shane-sfdx-plugins
- run: sfdx force:org:create -f config/project-scratch-def.json --setdefaultusername -d 1
- run: sfdx shane:github:src:install -c -g apex-enterprise-patterns -r fflib-apex-mocks -p sfdx-source/apex-mocks
- run: sfdx force:source:push
- run: sfdx force:apex:test:run -w 5
#Intentionally install the Sample Code after the core AEP Commons test pass succeeds so that we don't deploy anything in Sample Code
#that could mask a test failure. A much more involved solution would've been to do a workflow_dispatch to the samplecode project.
- run: sfdx shane:github:src:install -c -g apex-enterprise-patterns -r fflib-apex-common-samplecode -p sfdx-source/apex-common-samplecode
- run: sfdx force:apex:test:run -w 5
- name: Destroy scratch org
run: sfdx force:org:delete -p
if: always()