-
Notifications
You must be signed in to change notification settings - Fork 2.8k
163 lines (149 loc) · 5.59 KB
/
pr-vrt-comment.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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: VRT CI | Comment on PR
on:
workflow_run:
workflows: ['VRT CI']
types:
- completed
concurrency:
# see https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#example-only-cancel-in-progress-jobs-or-runs-for-the-current-workflow
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
NX_PARALLEL: 4 # ubuntu-latest = 4-core CPU / 16 GB of RAM | macos-14-xlarge (arm) = 6-core CPU / 14 GB of RAM
NX_PREFER_TS_NODE: true
NX_VERBOSE_LOGGING: true
jobs:
run_vr_diff:
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'microsoft' }} && ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }}
outputs:
pr_number: ${{ steps.pr_number.outputs.result }}
permissions:
# necessary to write comments to the PR from the vr-approval-cli
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
.github
# downloaded artifacts will contain screenshots from affected project including 'screenshots-report.json' which contains proper image mappings for affected project
# - see @{link file://./../scripts/prepare-vr-screenshots-for-upload.js#43}
# - see @{link file://./pr-vrt.yml#56}
- uses: actions/download-artifact@v4
with:
name: vrscreenshot
path: ./screenshots
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/download-artifact@v4
with:
name: pr-number
path: ./results
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Load PR number
uses: actions/github-script@v7
id: pr_number
with:
script: |
const run = require('./.github/scripts/validate-pr-number');
const result = run({filePath:'results/pr.txt'});
return result;
result-encoding: string
- name: VR App - Create Policy
run: |
echo "MAKE THIS STEP WORK"
- name: Login via Azure CLI
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Run screenshotdiff
env:
API_TOKEN: ${{ FormatPAT.NonBase64PAT }}
VR_APP_API_URL: 'https://vrapprovaldev2.azurewebsites.net/api/'
STORAGE_ACCOUNT_ID: 'https://onejstestartifactsprod.blob.core.windows.net/'
SYSTEM_ACCESSTOKEN: ${{ System.AccessToken }}
TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
PRINCIPAL_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
SERVICE_CONNECTION_ID: ${{ SERVICE-CONNECTION-ID }}
GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "MAKE THIS WORK"
npx [email protected] run-diff --screenshotsDirectory ./screenshots --buildType pr --clientType "FLUENTUI" --threshold '0.04' --cumThreshold '1'
# 💡 NOTE:
# - following is manually provided setup used in previous ADO pipeline {@link file://./../../azure-pipelines.vrt-baseline.yml }
# - keeping for future reference
# web_components:
# runs-on: ubuntu-latest
# env:
# pipelineId: '315'
# pipelineName: 'fluent-ui_VRT_Pipeline_web-components'
# steps:
# - uses: actions/checkout@v4
# with:
# fetch-depth: 0
# - name: Run and publish VR screenshot
# uses: ./.github/actions/run-publish-vr-screenshot
# with:
# fluentVersion: webcomponents
# vrTestPackageName: 'vr-tests-web-components'
# vrTestPackagePath: 'apps/vr-tests-web-components'
# locationPrefix: 'FluentUI-web-components'
# locationPostfix: 'vrscreenshotwebcomponents'
# clientName: 'fluentui-web-components-v3'
# react_components:
# runs-on: ubuntu-latest
# env:
# pipelineId: '311'
# pipelineName: 'fluent-ui_VRT_Pipeline_v9'
# steps:
# - uses: actions/checkout@v4
# with:
# fetch-depth: 0
# - name: Run and publish VR screenshot
# uses: ./.github/actions/run-publish-vr-screenshot
# with:
# fluentVersion: v9
# vrTestPackageName: 'vr-tests-react-components'
# vrTestPackagePath: 'apps/vr-tests-react-components'
# locationPrefix: 'fluentuiv9'
# locationPostfix: 'vrscreenshotv9'
# clientName: 'fluentuiv9'
# react:
# runs-on: ubuntu-latest
# env:
# pipelineId: '312'
# pipelineName: 'fluent-ui_VRT_Pipeline_v8'
# steps:
# - uses: actions/checkout@v4
# with:
# fetch-depth: 0
# - name: Run and publish VR screenshot
# uses: ./.github/actions/run-publish-vr-screenshot
# with:
# fluentVersion: v8
# vrTestPackageName: 'vr-tests'
# vrTestPackagePath: 'apps/vr-tests'
# locationPrefix: 'fluentuiv8'
# locationPostfix: 'vrscreenshotv8'
# clientName: 'fluentuiv8'
# react_northstar:
# runs-on: ubuntu-latest
# env:
# pipelineId: '313'
# pipelineName: 'fluent-ui_VRT_Pipeline_v0'
# steps:
# - uses: actions/checkout@v4
# with:
# fetch-depth: 0
# - name: Run and publish VR screenshot
# uses: ./.github/actions/run-publish-vr-screenshot
# with:
# fluentVersion: v0
# vrTestPackageName: 'docs'
# vrTestPackagePath: 'packages/fluentui/docs'
# locationPrefix: 'FluentUI-v0'
# locationPostfix: 'vrscreenshotv0'
# clientName: 'FluentUIV0'