-
Notifications
You must be signed in to change notification settings - Fork 136
232 lines (205 loc) · 8.25 KB
/
integration-tests.yml
File metadata and controls
232 lines (205 loc) · 8.25 KB
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
name: Integration Tests
on:
workflow_dispatch:
inputs:
pr_number:
type: number
required: true
sha:
type: string
required: true
permissions:
contents: read
checks: write
pull-requests: write
jobs:
build-for-e2e-test:
strategy:
fail-fast: false
matrix:
target-os: [windows-latest, ubuntu-latest, macos-latest]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
ref: 'refs/pull/${{ github.event.inputs.pr_number }}/merge'
fetch-depth: 0
- name: Check SHA
run: |
git fetch origin refs/pull/${{ github.event.inputs.pr_number }}/head:pr-head
prsha=`git rev-parse pr-head | awk '{ print $1 }'`
echo "PR SHA: $prsha"
echo "expected SHA: ${{ github.event.inputs.SHA }}"
if [ "$prsha" != "${{ github.event.inputs.SHA }}" ]; then
echo "SHA must match" >&2
exit 1
fi
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
global-json-file: global.json
- name: Build Artifacts (Linux)
if: matrix.target-os == 'ubuntu-latest'
run: ./publish.ps1
shell: pwsh
env:
SKIP_WINDOWS: "true"
SKIP_MACOS: "true"
- name: Build Artifacts (Windows)
if: matrix.target-os == 'windows-latest'
run: ./publish.ps1
shell: pwsh
env:
SKIP_LINUX: "true"
SKIP_MACOS: "true"
- name: Build Artifacts (MacOS)
if: matrix.target-os == 'macos-latest'
run: ./publish.ps1
shell: pwsh
env:
SKIP_WINDOWS: "true"
SKIP_LINUX: "true"
- name: Upload Binaries
uses: actions/upload-artifact@v6
with:
name: binaries-${{ matrix.target-os }}
path: |
dist/linux-x64/ado2gh-linux-amd64
dist/linux-x64/bbs2gh-linux-amd64
dist/linux-x64/gei-linux-amd64
dist/osx-x64/ado2gh-darwin-amd64
dist/osx-x64/bbs2gh-darwin-amd64
dist/osx-x64/gei-darwin-amd64
dist/win-x64/ado2gh-windows-amd64.exe
dist/win-x64/bbs2gh-windows-amd64.exe
dist/win-x64/gei-windows-amd64.exe
e2e-test:
needs: [ build-for-e2e-test ]
strategy:
fail-fast: false
matrix:
runner-os: [windows-latest, ubuntu-latest, macos-latest]
source-vcs: [AdoBasic, AdoCsv, Bbs, Ghes, Github]
runs-on: ${{ matrix.runner-os }}
concurrency: integration-test-${{ matrix.source-vcs }}-${{ matrix.runner-os }}
steps:
- uses: actions/checkout@v6
with:
ref: 'refs/pull/${{ github.event.inputs.pr_number }}/merge'
fetch-depth: 0
- name: Get PR Commit
if: always() && matrix.runner-os == 'ubuntu-latest'
run: |
prsha=`git ls-remote origin refs/pull/${{ github.event.inputs.pr_number }}/head | awk '{ print $1 }'`
echo "SHA: $prsha"
echo "PR_SHA=$(echo $prsha)" >> $GITHUB_ENV
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
global-json-file: global.json
- name: Download Binaries
uses: actions/download-artifact@v8
with:
name: binaries-${{ matrix.runner-os }}
path: dist
- name: Copy binary to root (linux)
if: matrix.runner-os == 'ubuntu-latest'
run: |
New-Item -Path "./" -Name "gh-gei" -ItemType "directory"
New-Item -Path "./" -Name "gh-ado2gh" -ItemType "directory"
New-Item -Path "./" -Name "gh-bbs2gh" -ItemType "directory"
Copy-Item ./dist/linux-x64/gei-linux-amd64 ./gh-gei/gh-gei
Copy-Item ./dist/linux-x64/ado2gh-linux-amd64 ./gh-ado2gh/gh-ado2gh
Copy-Item ./dist/linux-x64/bbs2gh-linux-amd64 ./gh-bbs2gh/gh-bbs2gh
shell: pwsh
- name: Copy binary to root (windows)
if: matrix.runner-os == 'windows-latest'
run: |
New-Item -Path "./" -Name "gh-gei" -ItemType "directory"
New-Item -Path "./" -Name "gh-ado2gh" -ItemType "directory"
New-Item -Path "./" -Name "gh-bbs2gh" -ItemType "directory"
Copy-Item ./dist/win-x64/gei-windows-amd64.exe ./gh-gei/gh-gei.exe
Copy-Item ./dist/win-x64/ado2gh-windows-amd64.exe ./gh-ado2gh/gh-ado2gh.exe
Copy-Item ./dist/win-x64/bbs2gh-windows-amd64.exe ./gh-bbs2gh/gh-bbs2gh.exe
shell: pwsh
- name: Copy binary to root (macos)
if: matrix.runner-os == 'macos-latest'
run: |
New-Item -Path "./" -Name "gh-gei" -ItemType "directory"
New-Item -Path "./" -Name "gh-ado2gh" -ItemType "directory"
New-Item -Path "./" -Name "gh-bbs2gh" -ItemType "directory"
Copy-Item ./dist/osx-x64/gei-darwin-amd64 ./gh-gei/gh-gei
Copy-Item ./dist/osx-x64/ado2gh-darwin-amd64 ./gh-ado2gh/gh-ado2gh
Copy-Item ./dist/osx-x64/bbs2gh-darwin-amd64 ./gh-bbs2gh/gh-bbs2gh
shell: pwsh
- name: Set execute permissions
run: |
chmod +x ./gh-gei/gh-gei
chmod +x ./gh-ado2gh/gh-ado2gh
chmod +x ./gh-bbs2gh/gh-bbs2gh
- name: Install gh-gei extension
run: gh extension install .
shell: pwsh
working-directory: ./gh-gei
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install gh-ado2gh extension
run: gh extension install .
shell: pwsh
working-directory: ./gh-ado2gh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install gh-bbs2gh extension
run: gh extension install .
shell: pwsh
working-directory: ./gh-bbs2gh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Integration Test
env:
ADO_PAT: ${{ secrets.ADO_PAT }}
GHEC_PAT: ${{ secrets.GHEC_PAT }}
GHES_PAT: ${{ secrets.GHES_PAT }}
ADO_SERVER_PAT: ${{ secrets.ADO_SERVER_PAT }}
BBS_USERNAME: ${{ secrets.BBS_USERNAME }}
BBS_PASSWORD: ${{ secrets.BBS_PASSWORD }}
SSH_KEY_BBS: ${{ secrets.SSH_KEY_BBS }}
SSH_PORT_BBS: ${{ secrets.SSH_PORT_BBS }}
SMB_PASSWORD: ${{ secrets.SMB_PASSWORD }}
AZURE_STORAGE_CONNECTION_STRING_BBS_LINUX: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING_BBS_LINUX }}
AZURE_STORAGE_CONNECTION_STRING_BBS_MACOS: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING_BBS_MACOS }}
AZURE_STORAGE_CONNECTION_STRING_BBS_WINDOWS: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING_BBS_WINDOWS }}
AZURE_STORAGE_CONNECTION_STRING_GHES_LINUX: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING_GHES_LINUX }}
AZURE_STORAGE_CONNECTION_STRING_GHES_MACOS: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING_GHES_MACOS }}
AZURE_STORAGE_CONNECTION_STRING_GHES_WINDOWS: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING_GHES_WINDOWS }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_BUCKET_NAME: ${{ secrets.AWS_BUCKET_NAME }}
GEI_DEBUG_MODE: 'true'
LD_LIBRARY_PATH: '$LD_LIBRARY_PATH:${{ github.workspace }}/src/OctoshiftCLI.IntegrationTests/bin/Debug/net8.0/runtimes/ubuntu.18.04-x64/native'
run: dotnet test src/OctoshiftCLI.IntegrationTests/OctoshiftCLI.IntegrationTests.csproj --filter "${{ matrix.source-vcs }}ToGithub" --logger:"junit;LogFilePath=integration-tests.xml" --logger "console;verbosity=normal" /p:VersionPrefix=9.9
- name: Publish Integration Test Results
# 6e8f8c55b476f977d1c58cfbd7e337cbf86d917f is tag v2, pinned to avoid supply chain attacks
uses: EnricoMi/publish-unit-test-result-action@c950f6fb443cb5af20a377fd0dfaa78838901040
if: always() && matrix.runner-os == 'ubuntu-latest'
with:
files: "**/*-tests.xml"
check_name: "Integration Test Results - ${{ matrix.source-vcs }}"
comment_mode: off
commit: ${{ env.PR_SHA }}
- name: Upload test logs
uses: actions/upload-artifact@v6
if: always()
with:
name: integration-test-logs-${{ matrix.source-vcs }}-${{ matrix.runner-os }}
path: dist/**/*.log
- name: Test Logs
if: always()
run: Get-ChildItem . -Filter *.octoshift.log -Recurse | ForEach-Object { Get-Content -Path $_.FullName }
working-directory: ./dist
shell: pwsh
- name: Test Logs (Verbose)
if: always()
run: Get-ChildItem . -Filter *.octoshift.verbose.log -Recurse | ForEach-Object { Get-Content -Path $_.FullName }
working-directory: ./dist
shell: pwsh