-
Notifications
You must be signed in to change notification settings - Fork 1
66 lines (57 loc) · 3 KB
/
run-apex-tests.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
54
55
56
57
58
59
60
61
62
63
64
65
66
# Run tests in an environment and publish the results
name: Run Apex tests
on:
# This workflow is always manually executed.
workflow_dispatch:
inputs:
environmentName:
description: "Name of the environment to run tests in:"
required: true
testClassesToRun:
description: "A commma separated list of test classes to run (omit to run all local tests in the org):"
required: false
# This action uses GitHub's built in token authentication for Git repositories.
# Read more at https://docs.github.com/en/actions/security-guides/automatic-token-authentication.
permissions:
# Ensure that the mikepenz/action-junit-report action can write checks to the repository:
checks: write
jobs:
env-test:
name: Run tests in environment
runs-on: ubuntu-latest
steps:
# Verify secrets:
- name: Verify secrets
run: |
if ["${{ secrets.ORGFLOW_STACKNAME }}" == ""]; then echo "::error title=Missing input value::Repository secret ORGFLOW_STACKNAME has not been set. See the Readme for more details." && exit 1; fi;
if ["${{ secrets.ORGFLOW_LICENSEKEY }}" == ""]; then echo "::error title=Missing input value::Repository secret ORGFLOW_LICENSEKEY has not been set. See the Readme for more details." && exit 1; fi;
if ["${{ secrets.SALESFORCE_USERNAME }}" == ""]; then echo "::error title=Missing input value::Repository secret SALESFORCE_USERNAME has not been set. See the Readme for more details." && exit 1; fi;
if ["${{ secrets.SALESFORCE_PASSWORD }}" == ""]; then echo "::error title=Missing input value::Repository secret SALESFORCE_PASSWORD has not been set. See the Readme for more details." && exit 1; fi;
# Install and configure OrgFlow:
- name: Install OrgFlow
uses: orgflow-actions/setup@v1
with:
version: 3
license-key: ${{ secrets.ORGFLOW_LICENSEKEY }}
salesforce-username: ${{ secrets.SALESFORCE_USERNAME }}
salesforce-password: ${{ secrets.SALESFORCE_PASSWORD }}
stack-name: ${{ secrets.ORGFLOW_STACKNAME }}
env:
ORGFLOW__ACCEPTEULA: "true"
# Conditionally build the argument to run a subset of tests:
- name: Build test classes arg
if: ${{ github.event.inputs.testClassesToRun != '' }}
id: test-classes-arg
run: |
echo "test-classes=--classes='${{ github.event.inputs.testClassesToRun }}'" >> $GITHUB_OUTPUT;
# Run OrgFlow command to execute tests in Salesforce:
- name: Run env:test
run: orgflow env:test --environment="${{ github.event.inputs.environmentName }}" --jUnitTo="junit.xml" ${{ steps.test-classes-arg.outputs.test-classes }}
# Publish the test results using an action from the marketplace:
- name: Publish test results
uses: mikepenz/action-junit-report@v3
if: always() # always run even if the previous step fails
with:
report_paths: junit.xml
detailed_summary: true
include_passed: true