|
| 1 | +name: Integration Tests |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + pr_number: |
| 7 | + type: number |
| 8 | + required: true |
| 9 | + sha: |
| 10 | + type: string |
| 11 | + required: true |
| 12 | + |
| 13 | +permissions: |
| 14 | + contents: read |
| 15 | + checks: write |
| 16 | + pull-requests: write |
| 17 | + |
| 18 | +jobs: |
| 19 | + build-for-e2e-test: |
| 20 | + strategy: |
| 21 | + fail-fast: false |
| 22 | + matrix: |
| 23 | + target-os: [windows-latest, ubuntu-latest, macos-latest] |
| 24 | + runs-on: ubuntu-latest |
| 25 | + steps: |
| 26 | + - uses: actions/checkout@v5 |
| 27 | + with: |
| 28 | + ref: 'refs/pull/${{ github.event.inputs.pr_number }}/merge' |
| 29 | + fetch-depth: 0 |
| 30 | + |
| 31 | + - name: Check SHA |
| 32 | + run: | |
| 33 | + git fetch origin refs/pull/${{ github.event.inputs.pr_number }}/head:pr-head |
| 34 | + prsha=`git rev-parse pr-head | awk '{ print $1 }'` |
| 35 | +
|
| 36 | + echo "PR SHA: $prsha" |
| 37 | + echo "expected SHA: ${{ github.event.inputs.SHA }}" |
| 38 | +
|
| 39 | + if [ "$prsha" != "${{ github.event.inputs.SHA }}" ]; then |
| 40 | + echo "SHA must match" >&2 |
| 41 | + exit 1 |
| 42 | + fi |
| 43 | +
|
| 44 | + - name: Setup .NET |
| 45 | + uses: actions/setup-dotnet@v2 |
| 46 | + with: |
| 47 | + global-json-file: global.json |
| 48 | + |
| 49 | + - name: Build Artifacts (Linux) |
| 50 | + if: matrix.target-os == 'ubuntu-latest' |
| 51 | + run: ./publish.ps1 |
| 52 | + shell: pwsh |
| 53 | + env: |
| 54 | + SKIP_WINDOWS: "true" |
| 55 | + SKIP_MACOS: "true" |
| 56 | + |
| 57 | + - name: Build Artifacts (Windows) |
| 58 | + if: matrix.target-os == 'windows-latest' |
| 59 | + run: ./publish.ps1 |
| 60 | + shell: pwsh |
| 61 | + env: |
| 62 | + SKIP_LINUX: "true" |
| 63 | + SKIP_MACOS: "true" |
| 64 | + |
| 65 | + - name: Build Artifacts (MacOS) |
| 66 | + if: matrix.target-os == 'macos-latest' |
| 67 | + run: ./publish.ps1 |
| 68 | + shell: pwsh |
| 69 | + env: |
| 70 | + SKIP_WINDOWS: "true" |
| 71 | + SKIP_LINUX: "true" |
| 72 | + |
| 73 | + - name: Upload Binaries |
| 74 | + uses: actions/upload-artifact@v4 |
| 75 | + with: |
| 76 | + name: binaries-${{ matrix.target-os }} |
| 77 | + path: | |
| 78 | + dist/linux-x64/ado2gh-linux-amd64 |
| 79 | + dist/linux-x64/bbs2gh-linux-amd64 |
| 80 | + dist/linux-x64/gei-linux-amd64 |
| 81 | + dist/osx-x64/ado2gh-darwin-amd64 |
| 82 | + dist/osx-x64/bbs2gh-darwin-amd64 |
| 83 | + dist/osx-x64/gei-darwin-amd64 |
| 84 | + dist/win-x64/ado2gh-windows-amd64.exe |
| 85 | + dist/win-x64/bbs2gh-windows-amd64.exe |
| 86 | + dist/win-x64/gei-windows-amd64.exe |
| 87 | +
|
| 88 | + e2e-test: |
| 89 | + needs: [ build-for-e2e-test ] |
| 90 | + strategy: |
| 91 | + fail-fast: false |
| 92 | + matrix: |
| 93 | + runner-os: [windows-latest, ubuntu-latest, macos-latest] |
| 94 | + source-vcs: [AdoBasic, AdoCsv, Bbs, Ghes, Github] |
| 95 | + runs-on: ${{ matrix.runner-os }} |
| 96 | + concurrency: integration-test-${{ matrix.source-vcs }}-${{ matrix.runner-os }} |
| 97 | + steps: |
| 98 | + - uses: actions/checkout@v5 |
| 99 | + with: |
| 100 | + ref: 'refs/pull/${{ github.event.inputs.pr_number }}/merge' |
| 101 | + fetch-depth: 0 |
| 102 | + |
| 103 | + - name: Get PR Commit |
| 104 | + if: always() && matrix.runner-os == 'ubuntu-latest' |
| 105 | + run: | |
| 106 | + prsha=`git ls-remote origin refs/pull/${{ github.event.inputs.pr_number }}/head | awk '{ print $1 }'` |
| 107 | + echo "SHA: $prsha" |
| 108 | + echo "PR_SHA=$(echo $prsha)" >> $GITHUB_ENV |
| 109 | +
|
| 110 | + - name: Setup .NET |
| 111 | + uses: actions/setup-dotnet@v2 |
| 112 | + with: |
| 113 | + global-json-file: global.json |
| 114 | + |
| 115 | + - name: Download Binaries |
| 116 | + uses: actions/download-artifact@v4 |
| 117 | + with: |
| 118 | + name: binaries-${{ matrix.runner-os }} |
| 119 | + path: dist |
| 120 | + |
| 121 | + - name: Copy binary to root (linux) |
| 122 | + if: matrix.runner-os == 'ubuntu-latest' |
| 123 | + run: | |
| 124 | + New-Item -Path "./" -Name "gh-gei" -ItemType "directory" |
| 125 | + New-Item -Path "./" -Name "gh-ado2gh" -ItemType "directory" |
| 126 | + New-Item -Path "./" -Name "gh-bbs2gh" -ItemType "directory" |
| 127 | + Copy-Item ./dist/linux-x64/gei-linux-amd64 ./gh-gei/gh-gei |
| 128 | + Copy-Item ./dist/linux-x64/ado2gh-linux-amd64 ./gh-ado2gh/gh-ado2gh |
| 129 | + Copy-Item ./dist/linux-x64/bbs2gh-linux-amd64 ./gh-bbs2gh/gh-bbs2gh |
| 130 | + shell: pwsh |
| 131 | + |
| 132 | + - name: Copy binary to root (windows) |
| 133 | + if: matrix.runner-os == 'windows-latest' |
| 134 | + run: | |
| 135 | + New-Item -Path "./" -Name "gh-gei" -ItemType "directory" |
| 136 | + New-Item -Path "./" -Name "gh-ado2gh" -ItemType "directory" |
| 137 | + New-Item -Path "./" -Name "gh-bbs2gh" -ItemType "directory" |
| 138 | + Copy-Item ./dist/win-x64/gei-windows-amd64.exe ./gh-gei/gh-gei.exe |
| 139 | + Copy-Item ./dist/win-x64/ado2gh-windows-amd64.exe ./gh-ado2gh/gh-ado2gh.exe |
| 140 | + Copy-Item ./dist/win-x64/bbs2gh-windows-amd64.exe ./gh-bbs2gh/gh-bbs2gh.exe |
| 141 | + shell: pwsh |
| 142 | + |
| 143 | + - name: Copy binary to root (macos) |
| 144 | + if: matrix.runner-os == 'macos-latest' |
| 145 | + run: | |
| 146 | + New-Item -Path "./" -Name "gh-gei" -ItemType "directory" |
| 147 | + New-Item -Path "./" -Name "gh-ado2gh" -ItemType "directory" |
| 148 | + New-Item -Path "./" -Name "gh-bbs2gh" -ItemType "directory" |
| 149 | + Copy-Item ./dist/osx-x64/gei-darwin-amd64 ./gh-gei/gh-gei |
| 150 | + Copy-Item ./dist/osx-x64/ado2gh-darwin-amd64 ./gh-ado2gh/gh-ado2gh |
| 151 | + Copy-Item ./dist/osx-x64/bbs2gh-darwin-amd64 ./gh-bbs2gh/gh-bbs2gh |
| 152 | + shell: pwsh |
| 153 | + |
| 154 | + - name: Set execute permissions |
| 155 | + run: | |
| 156 | + chmod +x ./gh-gei/gh-gei |
| 157 | + chmod +x ./gh-ado2gh/gh-ado2gh |
| 158 | + chmod +x ./gh-bbs2gh/gh-bbs2gh |
| 159 | +
|
| 160 | + - name: Install gh-gei extension |
| 161 | + run: gh extension install . |
| 162 | + shell: pwsh |
| 163 | + working-directory: ./gh-gei |
| 164 | + env: |
| 165 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 166 | + |
| 167 | + - name: Install gh-ado2gh extension |
| 168 | + run: gh extension install . |
| 169 | + shell: pwsh |
| 170 | + working-directory: ./gh-ado2gh |
| 171 | + env: |
| 172 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 173 | + |
| 174 | + - name: Install gh-bbs2gh extension |
| 175 | + run: gh extension install . |
| 176 | + shell: pwsh |
| 177 | + working-directory: ./gh-bbs2gh |
| 178 | + env: |
| 179 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 180 | + |
| 181 | + - name: Integration Test |
| 182 | + env: |
| 183 | + ADO_PAT: ${{ secrets.ADO_PAT }} |
| 184 | + GHEC_PAT: ${{ secrets.GHEC_PAT }} |
| 185 | + GHES_PAT: ${{ secrets.GHES_PAT }} |
| 186 | + ADO_SERVER_PAT: ${{ secrets.ADO_SERVER_PAT }} |
| 187 | + BBS_USERNAME: ${{ secrets.BBS_USERNAME }} |
| 188 | + BBS_PASSWORD: ${{ secrets.BBS_PASSWORD }} |
| 189 | + SSH_KEY_BBS: ${{ secrets.SSH_KEY_BBS }} |
| 190 | + SSH_PORT_BBS: ${{ secrets.SSH_PORT_BBS }} |
| 191 | + SMB_PASSWORD: ${{ secrets.SMB_PASSWORD }} |
| 192 | + AZURE_STORAGE_CONNECTION_STRING_BBS_LINUX: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING_BBS_LINUX }} |
| 193 | + AZURE_STORAGE_CONNECTION_STRING_BBS_MACOS: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING_BBS_MACOS }} |
| 194 | + AZURE_STORAGE_CONNECTION_STRING_BBS_WINDOWS: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING_BBS_WINDOWS }} |
| 195 | + AZURE_STORAGE_CONNECTION_STRING_GHES_LINUX: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING_GHES_LINUX }} |
| 196 | + AZURE_STORAGE_CONNECTION_STRING_GHES_MACOS: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING_GHES_MACOS }} |
| 197 | + AZURE_STORAGE_CONNECTION_STRING_GHES_WINDOWS: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING_GHES_WINDOWS }} |
| 198 | + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 199 | + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 200 | + AWS_BUCKET_NAME: ${{ secrets.AWS_BUCKET_NAME }} |
| 201 | + GEI_DEBUG_MODE: 'true' |
| 202 | + LD_LIBRARY_PATH: '$LD_LIBRARY_PATH:${{ github.workspace }}/src/OctoshiftCLI.IntegrationTests/bin/Debug/net8.0/runtimes/ubuntu.18.04-x64/native' |
| 203 | + 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 |
| 204 | + |
| 205 | + - name: Publish Integration Test Results |
| 206 | + uses: EnricoMi/publish-unit-test-result-action@v2 |
| 207 | + if: always() && matrix.runner-os == 'ubuntu-latest' |
| 208 | + with: |
| 209 | + files: "**/*-tests.xml" |
| 210 | + check_name: "Integration Test Results - ${{ matrix.source-vcs }}" |
| 211 | + comment_mode: off |
| 212 | + commit: ${{ env.PR_SHA }} |
| 213 | + |
| 214 | + - name: Upload test logs |
| 215 | + uses: actions/upload-artifact@v4 |
| 216 | + if: always() |
| 217 | + with: |
| 218 | + name: integration-test-logs-${{ matrix.source-vcs }}-${{ matrix.runner-os }} |
| 219 | + path: dist/**/*.log |
| 220 | + |
| 221 | + - name: Test Logs |
| 222 | + if: always() |
| 223 | + run: Get-ChildItem . -Filter *.octoshift.log -Recurse | ForEach-Object { Get-Content -Path $_.FullName } |
| 224 | + working-directory: ./dist |
| 225 | + shell: pwsh |
| 226 | + |
| 227 | + - name: Test Logs (Verbose) |
| 228 | + if: always() |
| 229 | + run: Get-ChildItem . -Filter *.octoshift.verbose.log -Recurse | ForEach-Object { Get-Content -Path $_.FullName } |
| 230 | + working-directory: ./dist |
| 231 | + shell: pwsh |
0 commit comments