Creating an in-memory database so queries don't have to go through Salesforce and instead can be executed through code. #446
Workflow file for this run
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: 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 |