Skip to content

Commit f61fbca

Browse files
committed
ci: extract checking out submodules into a script
1 parent c86adaf commit f61fbca

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

src/ci/azure-pipelines/steps/run.yml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -128,17 +128,11 @@ steps:
128128

129129
# Check out all our submodules, but more quickly than using git by using one of
130130
# our custom scripts
131-
- bash: |
132-
set -e
133-
mkdir -p $HOME/rustsrc
134-
$BUILD_SOURCESDIRECTORY/src/ci/init_repo.sh . $HOME/rustsrc
135-
condition: and(succeeded(), not(variables.SKIP_JOB), ne(variables['Agent.OS'], 'Windows_NT'))
136-
displayName: Check out submodules (Unix)
137-
- script: |
138-
if not exist C:\cache\rustsrc\NUL mkdir C:\cache\rustsrc
139-
sh src/ci/init_repo.sh . /c/cache/rustsrc
140-
condition: and(succeeded(), not(variables.SKIP_JOB), eq(variables['Agent.OS'], 'Windows_NT'))
141-
displayName: Check out submodules (Windows)
131+
- bash: src/ci/scripts/checkout-submodules.sh
132+
env:
133+
AGENT_OS: $(Agent.OS)
134+
displayName: Checkout submodules
135+
condition: and(succeeded(), not(variables.SKIP_JOB))
142136

143137
# See also the disable for autocrlf above, this just checks that it worked
144138
#

src/ci/scripts/checkout-submodules.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
# Check out all our submodules, but more quickly than using git by using one of
3+
# our custom scripts
4+
5+
set -euo pipefail
6+
IFS=$'\n\t'
7+
8+
source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"
9+
10+
if isWindows; then
11+
path="/c/cache/rustsrc"
12+
else
13+
path="${HOME}/rustsrc"
14+
fi
15+
16+
mkdir -p "${path}"
17+
"$(cd "$(dirname "$0")" && pwd)/../init_repo.sh" . "${path}"

0 commit comments

Comments
 (0)