Last active
July 28, 2021 01:27
-
-
Save sjurgis/561fdbf59f30c00f2ed73145d527ddcf to your computer and use it in GitHub Desktop.
sfdx github actions example
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
#!/bin/bash | |
set -e | |
set -o pipefail | |
CLIENT_ID=$1 | |
rm -f ./server.key | |
cat > ./server.key | |
sfdx auth:jwt:grant --setdefaultusername --clientid "$CLIENT_ID" --jwtkeyfile ./server.key --username [email protected] -a HubOrg | |
sfdx force:org:create -v HubOrg -s -f ./config/project-scratch-def.json -d 1 -w 10 -a ciorg --noancestors | |
rm -f ./server.key |
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: Apex unit tests | |
on: | |
push: | |
paths-ignore: | |
- "force-app/main/ui/lwc/**" | |
- "ci" | |
branches-ignore: | |
- 'master' | |
jobs: | |
apex-test: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- name: Set environment variables | |
run: | | |
echo "SFDX_IMPROVED_CODE_COVERAGE=true" >> $GITHUB_ENV | |
echo "SFDX_DISABLE_SOURCE_MEMBER_POLLING=true" >> $GITHUB_ENV | |
- name: Checkout | |
uses: actions/checkout@v1 | |
- name: Install sfdx | |
uses: sfdx-actions/setup-sfdx@v1 | |
- name: Create org | |
run: echo "${{secrets.DEVHUB_CI_CERT_2021_PRIVATEKEY}}" | ./scripts/create-org.sh "${{secrets.DEVHUB_CI_CERT_2021_CONSUMERKEY}}" | |
- name: Push source | |
run: sfdx force:source:push | |
- name: Run apex tests | |
run: sfdx force:apex:test:run -r tap --codecoverage --wait 45 | |
- name: Delete org | |
if: always() | |
run: sfdx force:org:delete -p |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment