api_trigger #372
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
# This is a basic workflow to help you get started with Actions | |
name: Regression | |
# Controls when the action will run. Triggers the workflow on push or pull request | |
# events but only for the master branch | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: [ master ] | |
types: | |
- labeled | |
- unlabeled | |
- synchronize | |
- opened | |
- edited | |
- ready_for_review | |
- reopened | |
- unlocked | |
pull_request_review: | |
types: | |
- submitted | |
push: | |
branches: [ master ] | |
repository_dispatch: | |
types: [api_trigger, provar_manager] | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
linux_regression: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
env: | |
scratch_org_alias: ProvarDX | |
provar_major_version: 2.11.2 | |
provar_build_version: 2.11.2.05 | |
dev_hub_alias: SFDX-ENV | |
provar_home: ${{ github.workspace }}/ProvarHome | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- uses: sfdx-actions/setup-sfdx@v1 | |
with: | |
sfdx-auth-url: ${{ secrets.SFDX_AUTH_URL }} | |
- name: Install ProvarDX SFDX Plugin | |
run: | | |
echo y | sfdx plugins:install @provartesting/provardx | |
sfdx plugins:update | |
- name: Download Provar CLI | |
run: | | |
wget -nv https://download.provartesting.com/${{ env.provar_major_version }}/Provar_ANT_${{ env.provar_build_version }}.zip | |
- name: Setup Provar CLI | |
run: | | |
echo "Unzip Provar ANT Files" | |
unzip -q Provar_ANT_${{ env.provar_build_version }}.zip -d $GITHUB_WORKSPACE/ProvarHome | |
ls -la ${{ env.provar_home }} | |
ls -la ${{ env.provar_home }}/provardx | |
## License check is optional in 2.11.2, will be mandatory in 2.11.3+ | |
- name: Set License check to false for CLI | |
run: | | |
#printenv | |
#find . -type d -name "Provar" | |
mkdir -p $HOME/Provar/.properties | |
echo "com.provar.licensecheck.cli=false" >> $HOME/Provar/.properties/provar.properties | |
- name: List Authenticated Orgs and Set Default Username | |
run: | | |
sfdx force:org:list --clean | |
sfdx force:config:set defaultdevhubusername=${{ env.dev_hub_alias }} defaultusername=${{ env.dev_hub_alias }} --global | |
- name: Retrieve Azure Public IP and Set in Scratch Def | |
run: | | |
IP=($(curl -s http://ipinfo.io/json | jq '.ip' | sed -e 's/^"//' -e 's/"$//')) | |
echo "This GitHub Workflow agent public IP is: $IP" | |
bash ${GITHUB_WORKSPACE}/replace_ip_in_scratch_org_def.sh ${IP} project-scratch-def.json | |
- name: Create SFDX Project with config | |
run: | | |
sfdx project generate -n ProvarDX | |
cp project-scratch-def.json ProvarDX/config/project-scratch-def.json | |
cp .forceignore ProvarDX/.forceignore | |
- name: Insert Secrets Password | |
run: sed -i "s|ProvarSecretsPassword|${{ secrets.SECRETS_PASSWORD }}|" $GITHUB_WORKSPACE/provardx-properties-github.json | |
- name: Create Scratch Org | |
run: | | |
sfdx force:org:create -f $GITHUB_WORKSPACE/ProvarDX/config/project-scratch-def.json -a ${{ env.scratch_org_alias }} | |
sfdx force:org:display -u ${{ env.scratch_org_alias }} | |
- name: Setup Dreamhouse App in Scratch Org | |
run: bash ${GITHUB_WORKSPACE}/setup_dreamhouse.sh ${{ env.scratch_org_alias }} | |
- name: Validate ProvarDX property file | |
run: sfdx provar:validate -p provardx-properties-github.json | |
- name: Compile Provar Project | |
run: sfdx provar:compile -p provardx-properties-github.json | |
- name: Reload Metadata Cache | |
run: sfdx provar:metadatacache -m 'Reload' -c '.provarCaches' -p provardx-properties-github.json | |
- name: Run Provar Tests | |
run: yes | xvfb-run sfdx provar:runtests -p provardx-properties-github.json | |
- name: Delete Scratch Org | |
run: sfdx force:org:delete -u ${{ env.scratch_org_alias }} --noprompt | |
- name: Upload Test Results Folder | |
uses: actions/upload-artifact@v3 | |
with: | |
# Artifact name | |
name: TestResults # optional, default is artifact | |
# A file, directory or wildcard pattern that describes what to upload | |
path: '**/ANT/Results' | |
# The desired behavior if no files are found using the provided path. | |
if-no-files-found: error | |
retention-days: 14 # optional | |
test_results: | |
name: "Publish Test Results" | |
needs: linux_regression | |
runs-on: ubuntu-latest | |
# the linux_regression job might be skipped, we don't need to run this job then | |
if: success() || failure() | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: artifacts | |
- name: Publish JUnit Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
check_name: "Provar Regression Test Report" | |
# The created test result check run has failure state if any test fails or test errors occur. Never fails when set to "nothing", fails only on errors when set to "errors". Default is "test failures". | |
# fail_on: errors # optional, default is test failures | |
# When set "true", the action itself fails when tests have failed (see option fail_on). | |
action_fail: true # optional, default is false | |
# File pattern of test result files | |
files: '**/Results/*.xml' | |
# Individual runs of the same test may see different failures. Reports all individual failures when set "true" or the first only otherwise | |
report_individual_runs: true | |
# De-duplicates classes with same name by their file name when set "true", combines test results for those classes otherwise | |
deduplicate_classes_by_file_name: false |