Automated packaing #4
This file contains 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: Pull Request to Develop | |
on: | |
pull_request: | |
branches: [ dev ] | |
jobs: | |
validate_pull_request: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Salesforce CLI | |
run: | | |
wget https://developer.salesforce.com/media/salesforce-cli/sf/channels/stable/sf-linux-x64.tar.xz | |
mkdir sfdx-cli | |
tar xJf sf-linux-amd64.tar.xz -C sfdx-cli --strip-components 1 | |
./sfdx-cli/install | |
- name: Install jq | |
run: | | |
sudo apt-get install jq | |
- name: Populate auth file | |
shell: bash | |
run: 'echo ${{secrets.DEVHUB_SFDX_URL}} > ./DEVHUB_SFDX_URL.txt' | |
- name: Authenticate Dev Hub | |
run: 'sfdx force:auth:sfdxurl:store -f ./DEVHUB_SFDX_URL.txt -a devhub -d' | |
- name: Create scratch org | |
run: 'sfdx force:org:create -f config/project-scratch-def.json -a ci_scratch -s -d 1' | |
- name: Push source to scratch org | |
run: 'sfdx force:source:push' | |
- name: Check code coverage | |
run: | | |
sfdx force:apex:test:run --codecoverage --resultformat json --synchronous --testlevel RunLocalTests --wait 10 > tests.json | |
coverage=$(jq .result.summary.orgWideCoverage tests.json | grep -Eo "[[:digit:]]+") | |
test $coverage -ge 75 | |
- name: Delete scratch org | |
if: always() | |
run: 'sfdx force:org:delete -p -u ci_scratch' |