-
Notifications
You must be signed in to change notification settings - Fork 10
49 lines (37 loc) · 1.41 KB
/
ci.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
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
deploy-to-scratch-and-run-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Install Salesforce CLI with NPM
run: |
npm install @salesforce/cli --global
- name: Write the dev hub token into a file
run: 'echo ${{secrets.SFDX_AUTH_URL_DEVHUB}} > devHubAuthToken'
- name: Authorize with the dev hub
run: sf org login sfdx-url --sfdx-url-file devHubAuthToken --alias DevHub --set-default-dev-hub
- name: Create scratch org
run: sf org create scratch --definition-file config/project-scratch-def.json --alias ScratchOrg --wait 30 --duration-days 1 --set-default --json
- name: Push source
run: sf project deploy start --target-org ScratchOrg --wait 30
- name: Run tests
run: sf apex run test --target-org ScratchOrg --code-coverage --result-format human --output-dir ./tests/apex --test-level RunLocalTests --wait 30
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
flags: Apex
- name: Delete scratch org
if: always()
run: sf org delete scratch --target-org ScratchOrg --no-prompt