-
Notifications
You must be signed in to change notification settings - Fork 1
128 lines (113 loc) · 5.28 KB
/
copado.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# 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:
repository_dispatch:
types: [deployment, release]
# 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:
provar_major_version: latest
provar_build_version: latest
provar_home: ${{ github.workspace }}/ProvarHome
test_environment: ${{ github.event.client_payload.environment }}
# 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
- 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-copado.json
- name: Insert Test Environment
run: sed -i "s|ENVIRONMENT|${{ github.event.client_payload.environment }}|" $GITHUB_WORKSPACE/provardx-properties-github-copado.json
- name: Validate ProvarDX property file
run: sfdx provar:validate -p provardx-properties-github-copado.json
- name: Compile Provar Project
run: sfdx provar:compile -p provardx-properties-github-copado.json
- name: Reload Metadata Cache
run: sfdx provar:metadatacache -m 'Reload' -c '.provarCaches' -p provardx-properties-github-copado.json
- name: Run Provar Tests
run: yes | xvfb-run sfdx provar:runtests -p provardx-properties-github-copado.json
- 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"
# 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
post_results_copado:
name: "Resume Copado Deployment"
needs: [linux_regression, test_results]
runs-on: ubuntu-latest
if: '!cancelled()'
steps:
- name: Resume Copado Deployment - PASS
if: success()
uses: fjogeleit/http-request-action@v1
with:
url: '${{ github.event.client_payload.resume_url }}'
method: 'POST'
- name: Resume Copado Deployment - FAILURE
if: failure()
uses: fjogeleit/http-request-action@v1
with:
url: 'https://api.backend.copado.com/json/v1/webhook/resumeDeployment/a3P8d000000ZLzgEAG?api_key=22bb1a83a9d4931ad2d27fb5368e6868&deploymentId=a3R8d0000005RKOEA2&success=FALSE'
method: 'POST'