-
Notifications
You must be signed in to change notification settings - Fork 66
175 lines (153 loc) · 5.83 KB
/
pull-request.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
164
165
166
167
168
169
170
171
172
173
174
175
# workflow on pull request to main
name: pull-request-validation
on:
workflow_dispatch: # allow for manual workflow triggering as needed
pull_request:
branches: [ main ]
jobs:
build-and-test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
fail-fast: false
env:
RUNNER_DEBUG: 1
WF_USERNAME: [email protected]
WF_USER_ROLE: "Bot Author"
WF_USER_AAD_OBJECT_ID: "85fd1857-ddef-46f6-acf4-22a0d1df2cda"
WF_APP_USER_ID: "82e66a08-8bf9-42bf-883a-7e2d17c7cede"
steps:
- uses: actions/checkout@v3
with:
lfs: true
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: 16.x
registry-url: https://npm.pkg.github.com
- name: Install npm@9
run: npm i -g npm@9
- name: Build and test
run: |
npm config set //npm.pkg.github.com/:_authToken=${{ secrets.GPR_ACCESS_TOKEN }}
npm ci
npm run ci
env:
AZ_DevOps_Read_PAT: ${{ secrets.AZ_DevOps_Read_PAT }}
- name: Install PAC
uses: ./actions-install
id: actions-install
- name: Test create-environment action with username/password
uses: ./create-environment
id: create-environment
env:
PP_ENV_NAME: ${{ format('pp-actions-{0}-pr-{1}', runner.os, github.event.number) }}
with:
user-name: ${{ env.WF_USERNAME }}
password-secret: ${{ secrets.PASSWORD_PPDEVTOOLS }}
name: ${{ env.PP_ENV_NAME }}
type: Sandbox
region: unitedstates
domain: ${{ env.PP_ENV_NAME }}
- name: Test who-am-i action
uses: ./who-am-i
id: who-am-i
with:
environment-url: ${{ steps.create-environment.outputs.environment-url }}
user-name: ${{ env.WF_USERNAME }}
password-secret: ${{ secrets.PASSWORD_PPDEVTOOLS }}
- name: Show who-am-i output
run: |
echo create-environment.outputs.environment-id: ${{ steps.create-environment.outputs.environment-id }}
echo create-environment.outputs.environment-url: ${{ steps.create-environment.outputs.environment-url }}
echo who-am-i.outputs.environment-id: ${{ steps.who-am-i.outputs.environment-id }}
echo who-am-i.outputs.environment-url: ${{ steps.who-am-i.outputs.environment-url }}
- name: Test who-am-i output
if: ${{ steps.create-environment.outputs.environment-id != steps.who-am-i.outputs.environment-id }}
run: |
exit 1
- name: Test assign-user action with role assignment
uses: ./assign-user
with:
user-name: ${{ env.WF_USERNAME }}
password-secret: ${{ secrets.PASSWORD_PPDEVTOOLS }}
environment: ${{ steps.create-environment.outputs.environment-url }}
user: ${{ env.WF_USER_AAD_OBJECT_ID}}
role: ${{ env.WF_USER_ROLE}}
- name: Test assign-user action with application user
uses: ./assign-user
with:
user-name: ${{ env.WF_USERNAME }}
password-secret: ${{ secrets.PASSWORD_PPDEVTOOLS }}
environment: ${{ steps.create-environment.outputs.environment-url }}
user: ${{ env.WF_APP_USER_ID}}
role: ${{ env.WF_USER_ROLE}}
application-user: true
- name: Test assign-group action
uses: ./assign-group
with:
user-name: ${{ env.WF_USERNAME }}
password-secret: ${{ secrets.PASSWORD_PPDEVTOOLS }}
environment: ${{ steps.create-environment.outputs.environment-url }}
group: 'fef01b9b-da30-4cb5-b6b9-ff34c5d2ca2e'
group-name: 'Test Group'
role: 'System Customizer'
team-type: 'AadSecurityGroup'
membership-type: 'Members'
- name: Test unpack-solution action
uses: ./unpack-solution
with:
solution-folder: 'out/CI/emptySolution/src'
solution-file: 'src/test/data/TrivialCanvasSolution.zip'
solution-type: 'Unmanaged'
overwrite-files: true
locale-template: 'en-US'
localize: true
process-canvas-apps: true
- name: Test pack-solution action
uses: ./pack-solution
with:
solution-folder: 'src/test/data/emptySolution'
solution-file: 'out/CI/emptySolution.zip'
solution-type: 'Unmanaged'
localize: true
process-canvas-apps: true
- name: Test import-solution action with username/password
uses: ./import-solution
with:
environment-url: ${{ steps.create-environment.outputs.environment-url }}
user-name: ${{ env.WF_USERNAME }}
password-secret: ${{ secrets.PASSWORD_PPDEVTOOLS }}
solution-file: 'src/test/data/emptySolution_0_1_0_0.zip'
force-overwrite: true
run-asynchronously: true
- name: Test add-solution-component action
uses: ./add-solution-component
with:
environment-url: ${{ steps.create-environment.outputs.environment-url }}
user-name: ${{ env.WF_USERNAME }}
password-secret: ${{ secrets.PASSWORD_PPDEVTOOLS }}
solution-name: emptySolution
component: account
component-type: 1
add-required-components: true
- name: Test delete-environment action with username/password
if: always() # Clean up created environments even on failed run
uses: ./delete-environment
with:
environment-url: ${{ steps.create-environment.outputs.environment-url }}
user-name: ${{ env.WF_USERNAME }}
password-secret: ${{ secrets.PASSWORD_PPDEVTOOLS }}
- name: Upload pac CLI logs
if: always()
uses: actions/upload-artifact@v3
with:
name: pac-cli-log ${{ matrix.os }}
path: ./dist/pac*/tools/logs/pac-log.txt
- name: Upload test logs
if: always()
uses: actions/upload-artifact@v3
with:
name: Test Logs ${{ matrix.os }}
path: ./out/logs/*-tests.log