Skip to content

Set support for some of the collection functions #437

Set support for some of the collection functions

Set support for some of the collection functions #437

Workflow file for this run

name: PR Build
on:
pull_request:
branches: [main]
types: [opened, reopened, synchronize, closed]
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
with:
node-version: "16"
- name: Install dependencies
run: npm install
- name: Install SFDX
uses: sfdx-actions/setup-sfdx@v1
with:
sfdx-auth-url: ${{ secrets.DEV_HUB_AUTH_URL }}
- name: Populate auth file with SFDX_URL secret
shell: bash
run: echo ${{ secrets.DEV_HUB_AUTH_URL}} > ./SFDX_URL_STORE.txt
- name: Authenticate against dev hub
run: sfdx force:auth:sfdxurl:store --sfdxurlfile=./SFDX_URL_STORE.txt --setalias=devhub --setdefaultdevhubusername
- name: Create scratch org
run: sfdx force:org:create --definitionfile=config/dev.json --setalias=scratch-org --setdefaultusername --nonamespace --durationdays=1
- name: Push source
run: sfdx force:source:push
- name: Run tests
run: sf apex run test --code-coverage --result-format json -w 30 > test-results.json
- name: Check code coverage
run: |
COVERAGE=$(jq -r '.result.summary.testRunCoverage' test-results.json)
COVERAGE=${COVERAGE%\%}
echo "Code coverage: $COVERAGE%"
if (( $(echo "$COVERAGE < 90" | bc -l) )); then
echo "Code coverage is less than 90%, failing the build."
exit 1
fi
- name: Clean up scratch org
run: sfdx force:org:delete --targetusername=scratch-org --noprompt