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: Code Coverage and Release | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- "batch-orchestrator/**" | |
pull_request: | |
branches: | |
- master | |
paths: | |
- "batch-orchestrator/**" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: "Install Salesforce CLI" | |
run: | | |
wget https://developer.salesforce.com/media/salesforce-cli/sfdx/channels/stable/sfdx-linux-x64.tar.xz | |
mkdir ~/sfdx | |
tar xJf sfdx-linux-x64.tar.xz -C ~/sfdx --strip-components 1 | |
echo "$HOME/sfdx/bin" >> $GITHUB_PATH | |
~/sfdx/bin/sfdx version | |
- name: Populate auth file | |
run: 'echo "${{ secrets.SFDX_AUTH_URL }}" > ./SALESFORCE_AUTH_URL.txt' | |
- name: Authenticate Dev Hub | |
run: "sf org login sfdx-url -f ./SALESFORCE_AUTH_URL.txt -a devhub -d" | |
- name: Create Scratch Org | |
run: sf org create scratch --target-dev-hub devhub -d --definition-file config/project-scratch-def.json --alias ciorg -y 1 | |
- name: Deploy source | |
run: sf project deploy start | |
- name: Run Apex tests | |
run: sf apex run test -c --resultformat human -d ./ | |
- name: Delete Scratch Org | |
run: sf org delete scratch --no-prompt | |
- name: Upload code coverage for Apex to Codecov.io | |
uses: codecov/codecov-action@v2 | |
with: | |
flags: Apex | |
- name: Increment Package Version in sfdx-project.json | |
if: github.actor == github.event.repository.owner.login && github.event_name == 'pull_request' && github.event.action == 'opened' | |
run: | | |
chmod +x scripts/increment-package-version.sh | |
./scripts/increment-package-version.sh | |
- name: Create new Package version | |
if: github.event.action != 'closed' && github.event_name == 'pull_request' && github.actor == github.event.repository.owner.login | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
REPO_NAME: ${{ github.repository }} | |
run: | | |
chmod +x scripts/create-new-package-verison.sh | |
./scripts/create-new-package-verison.sh | |
- name: Promote current latest Package version | |
if: github.ref == 'refs/heads/master' && github.actor == github.event.repository.owner.login | |
run: | | |
chmod +x scripts/promote-latest-package-version.sh | |
./scripts/promote-latest-package-version.sh |