Skip to content

Commit d45903f

Browse files
Merge pull request #29 from apex-enterprise-patterns/add-gh-action-worfklow
Add GH Action Workflow just like all of the others; update README with badge
2 parents e91df95 + a9f5807 commit d45903f

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

.github/workflows/deploy.and.test.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Create a Scratch Org, Push Source and Run Apex Tests
2+
3+
on:
4+
push:
5+
pull_request_target:
6+
7+
jobs:
8+
build:
9+
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
with:
15+
ref: ${{github.event.pull_request.head.ref}}
16+
repository: ${{github.event.pull_request.head.repo.full_name}}
17+
- name: Install SFDX CLI and authorize DevHub
18+
uses: apex-enterprise-patterns/setup-sfdx@v1 #We're using a fork of https://github.com/sfdx-actions/setup-sfdx for safety
19+
with:
20+
sfdx-auth-url: ${{ secrets.DEVHUB_SFDXURL }}
21+
- 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
22+
- run: echo y | sfdx plugins:install shane-sfdx-plugins
23+
- run: sfdx force:org:create -f config/project-scratch-def.json --setdefaultusername -d 1
24+
- run: sfdx shane:github:src:install -c -g apex-enterprise-patterns -r fflib-apex-mocks -p sfdx-source/apex-mocks
25+
- run: sfdx shane:github:src:install -c -g apex-enterprise-patterns -r fflib-apex-common -p sfdx-source/apex-common
26+
- run: sfdx force:source:push
27+
- run: sfdx force:apex:test:run -w 5
28+
- name: Destroy scratch org
29+
run: sfdx force:org:delete -p
30+
if: always()
31+

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
FFLib Apex Common Sample
22
========================
3+
![Push Source and Run Apex Tests](https://github.com/apex-enterprise-patterns/fflib-apex-common-samplecode/workflows/Create%20a%20Scratch%20Org,%20Push%20Source%20and%20Run%20Apex%20Tests/badge.svg)
34

45
**Dependencies:** Must deploy [Apex Mocks](https://github.com/apex-enterprise-patterns/fflib-apex-mocks) and [Apex Common](https://github.com/apex-enterprise-patterns/fflib-apex-common) before deploying this library
56

0 commit comments

Comments
 (0)