|
55 | 55 | version: net462 |
56 | 56 |
|
57 | 57 | runs-on: ${{ matrix.os }} |
| 58 | + timeout-minutes: 45 |
58 | 59 |
|
59 | 60 | steps: |
60 | 61 | - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
|
67 | 68 | - name: Resolve project |
68 | 69 | id: resolve-project |
69 | 70 | shell: pwsh |
| 71 | + env: |
| 72 | + PROJECT_NAME: ${{ inputs.project-name }} |
70 | 73 | run: | |
71 | 74 | Import-Module .\build\scripts\build.psm1 |
72 | 75 |
|
|
79 | 82 | $component = '' # Used to tell Component.proj what to build |
80 | 83 |
|
81 | 84 | ResolveProject ` |
82 | | - -projectNameOrComponentData '${{ inputs.project-name }}' ` |
| 85 | + -projectNameOrComponentData ${env:PROJECT_NAME} ` |
83 | 86 | -title ([ref]$title) ` |
84 | 87 | -project ([ref]$project) ` |
85 | 88 | -component ([ref]$component) |
@@ -111,43 +114,57 @@ jobs: |
111 | 114 | uses: actions/setup-dotnet@baa11fbfe1d6520db94683bd5c7a3818018e4309 # v5.1.0 |
112 | 115 |
|
113 | 116 | - name: dotnet restore ${{ steps.resolve-project.outputs.title }} |
114 | | - run: dotnet restore ${{ steps.resolve-project.outputs.project }} -p:EnablePackageValidation=true |
| 117 | + run: dotnet restore ${env:PROJECT_PATH} -p:EnablePackageValidation=true |
| 118 | + shell: pwsh |
| 119 | + env: |
| 120 | + PROJECT_PATH: ${{ steps.resolve-project.outputs.project }} |
115 | 121 |
|
116 | 122 | - name: dotnet build ${{ steps.resolve-project.outputs.title }} |
117 | | - run: dotnet build ${{ steps.resolve-project.outputs.project }} --configuration Release --no-restore |
| 123 | + run: dotnet build ${env:PROJECT_PATH} --configuration Release --no-restore |
| 124 | + shell: pwsh |
| 125 | + env: |
| 126 | + PROJECT_PATH: ${{ steps.resolve-project.outputs.project }} |
118 | 127 |
|
119 | 128 | - name: dotnet test ${{ steps.resolve-project.outputs.title }} |
120 | | - if: ${{ inputs.run-tests }} |
| 129 | + if: inputs.run-tests |
| 130 | + shell: pwsh |
| 131 | + env: |
| 132 | + PROJECT_PATH: ${{ steps.resolve-project.outputs.project }} |
| 133 | + TARGET_FRAMEWORK: ${{ matrix.version }} |
| 134 | + TEST_FILTER: ${{ inputs.test-case-filter }} |
121 | 135 | run: > |
122 | 136 | ${{ inputs.test-require-elevated && matrix.os != 'windows-latest' && 'sudo -E' || '' }} |
123 | | - dotnet test ${{ steps.resolve-project.outputs.project }} |
| 137 | + dotnet test ${env:PROJECT_PATH} |
124 | 138 | --collect:"Code Coverage" |
125 | 139 | --results-directory:TestResults |
126 | | - --framework ${{ matrix.version }} |
| 140 | + --framework ${env:TARGET_FRAMEWORK} |
127 | 141 | --configuration Release |
128 | 142 | --no-restore |
129 | 143 | --no-build |
130 | 144 | --logger:"console;verbosity=detailed" |
131 | 145 | --logger:"GitHubActions;report-warnings=false" |
132 | 146 | --logger:"junit;LogFilePath=TestResults/junit.xml" |
133 | | - --filter "${{ inputs.test-case-filter }}" |
| 147 | + --filter "${env:TEST_FILTER}" |
134 | 148 | -- RunConfiguration.DisableAppDomain=true |
135 | 149 | ${{ inputs.test-require-elevated && matrix.os != 'windows-latest' && '&& sudo chmod a+rw ./TestResults' || '' }} |
136 | 150 |
|
137 | 151 | - name: dotnet pack ${{ steps.resolve-project.outputs.title }} |
138 | | - if: ${{ matrix.os == 'windows-latest' && inputs.pack }} |
139 | | - run: dotnet pack ${{ steps.resolve-project.outputs.project }} --configuration Release --no-restore --no-build -p:EnablePackageValidation=true |
| 152 | + if: matrix.os == 'windows-latest' && inputs.pack |
| 153 | + run: dotnet pack ${env:PROJECT_PATH} --configuration Release --no-restore --no-build -p:EnablePackageValidation=true |
| 154 | + shell: pwsh |
| 155 | + env: |
| 156 | + PROJECT_PATH: ${{ steps.resolve-project.outputs.project }} |
140 | 157 |
|
141 | 158 | - name: Install coverage tool |
142 | | - if: ${{ inputs.run-tests }} |
| 159 | + if: inputs.run-tests |
143 | 160 | run: dotnet tool install -g dotnet-coverage |
144 | 161 |
|
145 | 162 | - name: Merging test results |
146 | | - if: ${{ inputs.run-tests && hashFiles('./TestResults/**/*.coverage') != '' }} |
| 163 | + if: inputs.run-tests && hashFiles('./TestResults/**/*.coverage') != '' |
147 | 164 | run: dotnet-coverage merge -f cobertura -o ./TestResults/Cobertura.xml ./TestResults/**/*.coverage |
148 | 165 |
|
149 | 166 | - name: Upload code coverage ${{ inputs.code-cov-prefix }}-${{ inputs.code-cov-name }} |
150 | | - if: ${{ inputs.run-tests && hashFiles('./TestResults/Cobertura.xml') != '' }} |
| 167 | + if: inputs.run-tests && hashFiles('./TestResults/Cobertura.xml') != '' |
151 | 168 | uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2 |
152 | 169 | continue-on-error: true # Note: Don't fail for upload failures |
153 | 170 | env: |
@@ -175,7 +192,7 @@ jobs: |
175 | 192 | - name: Publish ${{ steps.resolve-project.outputs.name }} NuGet packages to Artifacts |
176 | 193 | uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 |
177 | 194 | # Only publish packages from the first job, which should be net462 for Windows in most cases, which is preferred for .NET Framework support |
178 | | - if: ${{ matrix.os == 'windows-latest' && inputs.pack && strategy.job-index == 0 }} |
| 195 | + if: matrix.os == 'windows-latest' && inputs.pack && strategy.job-index == 0 |
179 | 196 | with: |
180 | 197 | name: ${{ steps.resolve-project.outputs.name }}-packages |
181 | 198 | path: ./artifacts/package/release |
|
0 commit comments