|
| 1 | +# Executes all the tests on all the platforms |
| 2 | +name: Tests |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + |
| 7 | +concurrency: |
| 8 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 9 | + cancel-in-progress: true |
| 10 | + |
| 11 | +jobs: |
| 12 | + # Duplicated jobs so their dependencies are not blocked on both the |
| 13 | + # setup jobs |
| 14 | + |
| 15 | + generate_tests_matrix: |
| 16 | + name: Generate test runsheet |
| 17 | + runs-on: windows-latest |
| 18 | + outputs: |
| 19 | + runsheet: ${{ steps.generate_tests_matrix.outputs.runsheet }} |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 22 | + |
| 23 | + - name: Install toolsets |
| 24 | + shell: pwsh |
| 25 | + run: | |
| 26 | + mkdir ./artifacts/tmp -force | Out-Null |
| 27 | + '<Project />' | Out-File -FilePath ./artifacts/tmp/install-toolset.proj -Encoding utf8 |
| 28 | + ./build.cmd -restore -projects ./artifacts/tmp/install-toolset.proj |
| 29 | +
|
| 30 | + - name: Generate test runsheet |
| 31 | + id: generate_tests_matrix |
| 32 | + shell: pwsh |
| 33 | + run: | |
| 34 | + ./build.cmd -test /p:TestRunnerName=TestRunsheetBuilder -bl -c Release |
| 35 | +
|
| 36 | + - name: Upload logs, and test results |
| 37 | + if: ${{ always() }} |
| 38 | + uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 |
| 39 | + with: |
| 40 | + name: runsheet-logs |
| 41 | + path: | |
| 42 | + ${{ github.workspace }}/artifacts/log/*/*.binlog |
| 43 | + ${{ github.workspace }}/artifacts/log/*/TestLogs/** |
| 44 | + ${{ github.workspace }}/artifacts/tmp/*/combined_runsheet.json |
| 45 | + retention-days: 3 |
| 46 | + |
| 47 | + generate_e2e_matrix: |
| 48 | + name: Generate E2E test runsheet |
| 49 | + runs-on: windows-latest |
| 50 | + outputs: |
| 51 | + runsheet: ${{ steps.generate_e2e_matrix.outputs.runsheet }} |
| 52 | + steps: |
| 53 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 54 | + |
| 55 | + - name: Build with packages |
| 56 | + run: | |
| 57 | + ./build.cmd -restore -build -pack -c Release -ci -bl /p:InstallBrowsersForPlaywright=false /p:SkipTestProjects=true /p:CI=false |
| 58 | +
|
| 59 | + - name: Generate test runsheet |
| 60 | + id: generate_e2e_matrix |
| 61 | + run: | |
| 62 | + ./build.cmd -test /p:TestRunnerName=TestRunsheetBuilder /p:FullE2e=true -bl -c Release |
| 63 | +
|
| 64 | + - name: Upload built NuGets |
| 65 | + uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 |
| 66 | + with: |
| 67 | + name: built-nugets |
| 68 | + path: artifacts/packages |
| 69 | + retention-days: 3 |
| 70 | + |
| 71 | + - name: Upload logs, and test results |
| 72 | + if: ${{ always() }} |
| 73 | + uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 |
| 74 | + with: |
| 75 | + name: runsheet-e2e-logs |
| 76 | + path: | |
| 77 | + ${{ github.workspace }}/artifacts/log/*/*.binlog |
| 78 | + ${{ github.workspace }}/artifacts/log/*/TestLogs/** |
| 79 | + ${{ github.workspace }}/artifacts/tmp/*/combined_runsheet.json |
| 80 | + retention-days: 3 |
| 81 | + |
| 82 | + run_tests: |
| 83 | + name: Test |
| 84 | + needs: generate_tests_matrix |
| 85 | + strategy: |
| 86 | + fail-fast: false |
| 87 | + matrix: |
| 88 | + tests: ${{ fromJson(needs.generate_tests_matrix.outputs.runsheet) }} |
| 89 | + |
| 90 | + runs-on: ${{ matrix.tests.os }} # Use the OS from the matrix |
| 91 | + |
| 92 | + steps: |
| 93 | + - name: Trust HTTPS development certificate |
| 94 | + if: runner.os == 'Linux' |
| 95 | + run: dotnet dev-certs https --trust |
| 96 | + |
| 97 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 98 | + |
| 99 | + - name: Verify Docker is running |
| 100 | + # nested docker containers not supported on windows |
| 101 | + if: runner.os == 'Linux' |
| 102 | + run: docker info |
| 103 | + |
| 104 | + - name: Install Azure Functions Core Tools |
| 105 | + if: runner.os == 'Linux' |
| 106 | + run: | |
| 107 | + sudo apt-get update |
| 108 | + sudo apt-get install -y azure-functions-core-tools-4 |
| 109 | +
|
| 110 | + - name: Test ${{ matrix.tests.project }} |
| 111 | + run: | |
| 112 | + ${{ matrix.tests.command }} |
| 113 | +
|
| 114 | + - name: Upload test results |
| 115 | + if: always() |
| 116 | + uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 |
| 117 | + with: |
| 118 | + name: ${{ matrix.tests.project }}-${{ matrix.tests.os }}-logs |
| 119 | + path: | |
| 120 | + ${{ github.workspace }}/artifacts/TestResults/*/*.trx |
| 121 | + ${{ github.workspace }}/artifacts/log/*/TestLogs/** |
| 122 | + retention-days: 3 |
| 123 | + |
| 124 | + - name: Upload logs |
| 125 | + if: failure() |
| 126 | + uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 |
| 127 | + with: |
| 128 | + name: ${{ matrix.tests.project }}-${{ matrix.tests.os }}-binlogs |
| 129 | + path: | |
| 130 | + ${{ github.workspace }}/artifacts/log/*/*.binlog |
| 131 | + retention-days: 3 |
| 132 | + |
| 133 | + run_e2e_tests: |
| 134 | + name: E2ETest |
| 135 | + needs: generate_e2e_matrix |
| 136 | + strategy: |
| 137 | + fail-fast: false |
| 138 | + matrix: |
| 139 | + tests: ${{ fromJson(needs.generate_e2e_matrix.outputs.runsheet) }} |
| 140 | + |
| 141 | + runs-on: ${{ matrix.tests.os }} # Use the OS from the matrix |
| 142 | + |
| 143 | + steps: |
| 144 | + - name: Trust HTTPS development certificate |
| 145 | + if: runner.os == 'Linux' |
| 146 | + run: dotnet dev-certs https --trust |
| 147 | + |
| 148 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 149 | + |
| 150 | + - name: Download built NuGets |
| 151 | + uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9 |
| 152 | + with: |
| 153 | + pattern: built-nugets |
| 154 | + path: ${{ github.workspace }}/artifacts/packages |
| 155 | + |
| 156 | + - name: Copy NuGets to the correct location |
| 157 | + shell: pwsh |
| 158 | + run: |
| 159 | + Move-Item -Path "${{ github.workspace }}/artifacts/packages/built-nugets/Release" -Destination "${{ github.workspace }}/artifacts/packages" |
| 160 | + |
| 161 | + - name: Verify Docker is running |
| 162 | + # nested docker containers not supported on windows |
| 163 | + if: runner.os == 'Linux' |
| 164 | + run: docker info |
| 165 | + |
| 166 | + - name: Install Azure Functions Core Tools |
| 167 | + if: runner.os == 'Linux' |
| 168 | + run: | |
| 169 | + sudo apt-get update |
| 170 | + sudo apt-get install -y azure-functions-core-tools-4 |
| 171 | +
|
| 172 | + - name: Test ${{ matrix.tests.project }} |
| 173 | + env: |
| 174 | + BUILT_NUGETS_PATH: ${{ github.workspace }}/artifacts/packages/Release/Shipping |
| 175 | + run: | |
| 176 | + ${{ matrix.tests.command }} |
| 177 | +
|
| 178 | + - name: Upload test results |
| 179 | + if: always() |
| 180 | + uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 |
| 181 | + with: |
| 182 | + name: ${{ matrix.tests.project }}-${{ matrix.tests.os }}-logs |
| 183 | + path: | |
| 184 | + ${{ github.workspace }}/artifacts/TestResults/*/*.trx |
| 185 | + ${{ github.workspace }}/artifacts/log/*/TestLogs/** |
| 186 | + retention-days: 3 |
| 187 | + |
| 188 | + - name: Upload logs |
| 189 | + if: failure() |
| 190 | + uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 |
| 191 | + with: |
| 192 | + name: ${{ matrix.tests.project }}-${{ matrix.tests.os }}-binlogs |
| 193 | + path: | |
| 194 | + ${{ github.workspace }}/artifacts/log/*/*.binlog |
| 195 | + retention-days: 3 |
0 commit comments