adjustments required to remove dependency on shane-sfdx-plugins #147
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 SF CLI and authorize DevHub | |
uses: apex-enterprise-patterns/setup-sfdx@v2 #We're using a fork of https://github.com/sfdx-actions/setup-sfdx for safety | |
with: | |
sfdx-auth-url: ${{ secrets.DEVHUB_SFDXURL }} | |
# - name: Install the required plugins | |
# run: echo y | sf plugins install shane-sfdx-plugins | |
- name: Setup the config parameters needed | |
run: sf config set target-dev-hub SFDX-ENV --global #Even though the setup-sfdx action uses --setdefaultdevhubusername, it doesn't seem to stick since it uses --setdefaultusername so we brute force it here | |
- name: Create the scratch org | |
run: sf org create scratch --definition-file config/project-scratch-def.json --set-default --duration-days 1 --no-track-source | |
# - name: Install required dependency frameworks | |
# run: sf shane github src install --convert --githubuser apex-enterprise-patterns --repo fflib-apex-mocks --path sfdx-source/apex-mocks | |
# - run: sf shane github src install --convert --githubuser apex-enterprise-patterns --repo fflib-apex-common --path sfdx-source/apex-common | |
# - run: sf shane github src install --convert --githubuser apex-enterprise-patterns --repo force-di --path force-di | |
- name: Clone fflib-apex-mocks repo | |
run: mkdir temp && git clone https://github.com/apex-enterprise-patterns/fflib-apex-mocks.git "temp/fflib-apex-mocks" | |
- name: Deploy and compile the fflib-apex-mocks codebase | |
run: cd temp/fflib-apex-mocks && sf project deploy start --ignore-conflicts && cd ../.. | |
- name: Clone fflib-apex-common repo | |
run: mkdir temp && git clone https://github.com/apex-enterprise-patterns/fflib-apex-common.git "temp/fflib-apex-common" | |
- name: Deploy and compile the fflib-apex-common codebase | |
run: cd temp/fflib-apex-common && sf project deploy start --ignore-conflicts && cd ../.. | |
- name: Clone force-di repo | |
run: mkdir temp && git clone https://github.com/apex-enterprise-patterns/force-di.git "temp/force-di" | |
- name: Deploy and compile the force-di codebase | |
run: cd temp/force-di && sf project deploy start --ignore-conflicts && cd ../.. | |
- name: Deploy and compile the codebase | |
run: sf project deploy start | |
- name: Run the core framework tests | |
run: sf apex run test --wait 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. | |
# - name: Install sample code project to verify with | |
# run: sf shane github src install --convert --githubuser apex-enterprise-patterns --repo at4dx-samplecode --path sfdx-source/reference-implementation-common | |
# - run: sf shane github src install --convert --githubuser apex-enterprise-patterns --repo at4dx-samplecode --path sfdx-source/reference-implementation-marketing | |
# - run: sf shane github src install --convert --githubuser apex-enterprise-patterns --repo at4dx-samplecode --path sfdx-source/reference-implementation-sales | |
# - run: sf shane github src install --convert --githubuser apex-enterprise-patterns --repo at4dx-samplecode --path sfdx-source/reference-implementation-service | |
- name: Install sample code project to verify with | |
run: git clone https://github.com/apex-enterprise-patterns/at4dx-samplecode.git "temp/fflib-apex-common-samplecode" && cd temp/fflib-apex-common-samplecode | |
- run: sf project deploy start --ignore-conflicts --source-dir sfdx-source/reference-implementation-common | |
- run: sf project deploy start --ignore-conflicts --source-dir sfdx-source/reference-implementation-marketing | |
- run: sf project deploy start --ignore-conflicts --source-dir sfdx-source/reference-implementation-sales | |
- run: sf project deploy start --ignore-conflicts --source-dir sfdx-source/reference-implementation-service | |
- run: cd ../.. | |
# Run the core framework tests and the sample code project tests | |
- name: Run the core framework tests and the sample code project tests | |
run: sf apex run test --wait 5 | |
- name: Destroy scratch org | |
run: sf org delete scratch --no-prompt | |
if: always() |