@@ -112,6 +112,32 @@ jobs:
112112        uses : jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be 
113113        if : matrix.free_disk 
114114
115+       #  Use dev drive on Windows CI in the hopes that this makes spurious
116+       #  files-held-by-another-process failures less likely.
117+       #  cf. <https://github.com/samypr100/setup-dev-drive>
118+       - if : contains(matrix.os, 'windows') 
119+         uses : samypr100/setup-dev-drive@1d65529cfd809844a9e91e400a560294b6820a68 
120+         with :
121+           #  Use as much space as is sensible, upper github limits are 14gb and
122+           #  300gb.
123+           drive-size : ${{ matrix.os == 'windows-2022' && '12gb' || '100gb' }} 
124+           #  Pre-allocate the space to avoid out of disk errors and improve
125+           #  long-running performance.
126+           drive-type : Fixed 
127+           #  Copy the git clone into the dev drive.
128+           workspace-copy : true 
129+           #  NOTE: rustc build was failing on stage2 mysteriously when #131880
130+           #  tried to use ReFS. Trying NTFS here instead.
131+           drive-format : NTFS 
132+ 
133+       - if : contains(matrix.os, 'windows') 
134+         name : Delete non-dev drive checkout, to make sure we aren't using it still 
135+         run : rm -rf ${{ github.workspace }} 
136+ 
137+       - if : ${{ !contains(matrix.os, 'windows') }} 
138+         name : Make sure DEV_DRIVE_WORKSPACE is populated with the workspace 
139+         run : echo "DEV_DRIVE_WORKSPACE=${{ github.workspace }}" >> $GITHUB_ENV 
140+ 
115141      #  Rust Log Analyzer can't currently detect the PR number of a GitHub
116142      #  Actions build on its own, so a hint in the log message is needed to
117143      #  point it in the right direction.
@@ -123,6 +149,7 @@ jobs:
123149
124150      - name : add extra environment variables 
125151        run : src/ci/scripts/setup-environment.sh 
152+         working-directory : ${{ env.DEV_DRIVE_WORKSPACE }} 
126153        env :
127154          #  Since it's not possible to merge `${{ matrix.env }}` with the other
128155          #  variables in `job.<name>.env`, the variables defined in the matrix
@@ -132,48 +159,63 @@ jobs:
132159
133160      - name : setup upstream remote 
134161        run : src/ci/scripts/setup-upstream-remote.sh 
162+         working-directory : ${{ env.DEV_DRIVE_WORKSPACE }} 
135163
136164      - name : ensure the channel matches the target branch 
137165        run : src/ci/scripts/verify-channel.sh 
166+         working-directory : ${{ env.DEV_DRIVE_WORKSPACE }} 
138167
139168      - name : collect CPU statistics 
140169        run : src/ci/scripts/collect-cpu-stats.sh 
170+         working-directory : ${{ env.DEV_DRIVE_WORKSPACE }} 
141171
142172      - name : show the current environment 
143173        run : src/ci/scripts/dump-environment.sh 
174+         working-directory : ${{ env.DEV_DRIVE_WORKSPACE }} 
144175
145176      - name : install awscli 
146177        run : src/ci/scripts/install-awscli.sh 
178+         working-directory : ${{ env.DEV_DRIVE_WORKSPACE }} 
147179
148180      - name : install sccache 
149181        run : src/ci/scripts/install-sccache.sh 
182+         working-directory : ${{ env.DEV_DRIVE_WORKSPACE }} 
150183
151184      - name : select Xcode 
152185        run : src/ci/scripts/select-xcode.sh 
186+         working-directory : ${{ env.DEV_DRIVE_WORKSPACE }} 
153187
154188      - name : install clang 
155189        run : src/ci/scripts/install-clang.sh 
190+         working-directory : ${{ env.DEV_DRIVE_WORKSPACE }} 
156191
157192      - name : install tidy 
158193        run : src/ci/scripts/install-tidy.sh 
194+         working-directory : ${{ env.DEV_DRIVE_WORKSPACE }} 
159195
160196      - name : install WIX 
161197        run : src/ci/scripts/install-wix.sh 
198+         working-directory : ${{ env.DEV_DRIVE_WORKSPACE }} 
162199
163200      - name : disable git crlf conversion 
164201        run : src/ci/scripts/disable-git-crlf-conversion.sh 
202+         working-directory : ${{ env.DEV_DRIVE_WORKSPACE }} 
165203
166204      - name : checkout submodules 
167205        run : src/ci/scripts/checkout-submodules.sh 
206+         working-directory : ${{ env.DEV_DRIVE_WORKSPACE }} 
168207
169208      - name : install MinGW 
170209        run : src/ci/scripts/install-mingw.sh 
210+         working-directory : ${{ env.DEV_DRIVE_WORKSPACE }} 
171211
172212      - name : install ninja 
173213        run : src/ci/scripts/install-ninja.sh 
214+         working-directory : ${{ env.DEV_DRIVE_WORKSPACE }} 
174215
175216      - name : enable ipv6 on Docker 
176217        run : src/ci/scripts/enable-docker-ipv6.sh 
218+         working-directory : ${{ env.DEV_DRIVE_WORKSPACE }} 
177219
178220      #  Disable automatic line ending conversion (again). On Windows, when we're
179221      #  installing dependencies, something switches the git configuration directory or
@@ -182,25 +224,31 @@ jobs:
182224      #  appropriate line endings.
183225      - name : disable git crlf conversion 
184226        run : src/ci/scripts/disable-git-crlf-conversion.sh 
227+         working-directory : ${{ env.DEV_DRIVE_WORKSPACE }} 
185228
186229      - name : ensure line endings are correct 
187230        run : src/ci/scripts/verify-line-endings.sh 
231+         working-directory : ${{ env.DEV_DRIVE_WORKSPACE }} 
188232
189233      - name : ensure backported commits are in upstream branches 
190234        run : src/ci/scripts/verify-backported-commits.sh 
235+         working-directory : ${{ env.DEV_DRIVE_WORKSPACE }} 
191236
192237      - name : ensure the stable version number is correct 
193238        run : src/ci/scripts/verify-stable-version-number.sh 
239+         working-directory : ${{ env.DEV_DRIVE_WORKSPACE }} 
194240
195241      - name : run the build 
196242        #  Redirect stderr to stdout to avoid reordering the two streams in the GHA logs.
197243        run : src/ci/scripts/run-build-from-ci.sh 2>&1 
244+         working-directory : ${{ env.DEV_DRIVE_WORKSPACE }} 
198245        env :
199246          AWS_ACCESS_KEY_ID : ${{ env.CACHES_AWS_ACCESS_KEY_ID }} 
200247          AWS_SECRET_ACCESS_KEY : ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.CACHES_AWS_ACCESS_KEY_ID)] }} 
201248
202249      - name : create github artifacts 
203250        run : src/ci/scripts/create-doc-artifacts.sh 
251+         working-directory : ${{ env.DEV_DRIVE_WORKSPACE }} 
204252
205253      - name : print disk usage 
206254        run : | 
@@ -212,12 +260,13 @@ jobs:
212260        with :
213261          #  name is set in previous step
214262          name : ${{ env.DOC_ARTIFACT_NAME }} 
215-           path : obj/artifacts/doc 
263+           path : ${{ env.DEV_DRIVE_WORKSPACE }} obj/artifacts/doc
216264          if-no-files-found : ignore 
217265          retention-days : 5 
218266
219267      - name : upload artifacts to S3 
220268        run : src/ci/scripts/upload-artifacts.sh 
269+         working-directory : ${{ env.DEV_DRIVE_WORKSPACE }} 
221270        env :
222271          AWS_ACCESS_KEY_ID : ${{ env.ARTIFACTS_AWS_ACCESS_KEY_ID }} 
223272          AWS_SECRET_ACCESS_KEY : ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.ARTIFACTS_AWS_ACCESS_KEY_ID)] }} 
@@ -230,6 +279,7 @@ jobs:
230279
231280      - name : upload job metrics to DataDog 
232281        if : needs.calculate_matrix.outputs.run_type != 'pr' 
282+         working-directory : ${{ env.DEV_DRIVE_WORKSPACE }} 
233283        env :
234284          DATADOG_SITE : datadoghq.com 
235285          DATADOG_API_KEY : ${{ secrets.DATADOG_API_KEY }} 
@@ -244,7 +294,7 @@ jobs:
244294  outcome :
245295    name : bors build finished 
246296    runs-on : ubuntu-latest 
247-     needs : [  calculate_matrix, job  ] 
297+     needs : [calculate_matrix, job] 
248298    #  !cancelled() executes the job regardless of whether the previous jobs passed or failed
249299    if : ${{ !cancelled() && contains(fromJSON('["auto", "try"]'), needs.calculate_matrix.outputs.run_type) }} 
250300    steps :
0 commit comments