1 # FIXME(linux): need to configure core dumps, enable them, and then dump
2 # backtraces on failure from all core dumps:
4 # - bash: sudo apt install gdb
5 # - bash: sudo sh -c 'echo "/checkout/obj/cores/core.%p.%E" > /proc/sys/kernel/core_pattern'
7 # Check travis config for `gdb --batch` command to print all crash logs
10 # When this parameter is set to anything other than an empty string the tests
11 # will only be executed when the commit updates submodules
12 only_on_updated_submodules: ''
16 # Disable automatic line ending conversion, which is enabled by default on
17 # Azure's Windows image. Having the conversion enabled caused regressions both
18 # in our test suite (it broke miri tests) and in the ecosystem, since we
19 # started shipping install scripts with CRLF endings instead of the old LF.
21 # Note that we do this a couple times during the build as the PATH and current
22 # user/directory change, e.g. when mingw is enabled.
23 - bash: git config --global core.autocrlf false
24 displayName: "Disable git automatic line ending conversion"
29 # Set the SKIP_JOB environment variable if this job is supposed to only run
30 # when submodules are updated and they were not. The following time consuming
31 # tasks will be skipped when the environment variable is present.
32 - ${{ if parameters.only_on_updated_submodules }}:
35 # Submodules pseudo-files inside git have the 160000 permissions, so when
36 # those files are present in the diff a submodule was updated.
37 if git diff HEAD^ | grep "^index .* 160000" >/dev/null 2>&1; then
38 echo "Executing the job since submodules are updated"
40 echo "Not executing this job since no submodules were updated"
41 echo "##vso[task.setvariable variable=SKIP_JOB;]1"
43 displayName: Decide whether to run this job
45 # Spawn a background process to collect CPU usage statistics which we'll upload
46 # at the end of the build. See the comments in the script here for more
48 - bash: python src/ci/cpu-usage-over-time.py &> cpu-usage.csv &
49 displayName: "Collect CPU-usage statistics in the background"
51 - bash: src/ci/scripts/dump-environment.sh
52 displayName: Show the current environment
54 - bash: src/ci/scripts/install-sccache.sh
57 displayName: Install sccache
58 condition: and(succeeded(), not(variables.SKIP_JOB))
60 - bash: src/ci/scripts/install-clang.sh
63 displayName: Install clang
64 condition: and(succeeded(), not(variables.SKIP_JOB))
66 - bash: src/ci/scripts/switch-xcode.sh
69 displayName: Switch to Xcode 9.3
70 condition: and(succeeded(), not(variables.SKIP_JOB))
72 - bash: src/ci/scripts/install-wix.sh
75 displayName: Install wix
76 condition: and(succeeded(), not(variables.SKIP_JOB))
78 - bash: src/ci/scripts/install-innosetup.sh
81 displayName: Install InnoSetup
82 condition: and(succeeded(), not(variables.SKIP_JOB))
84 - bash: src/ci/scripts/windows-symlink-build-dir.sh
87 displayName: Ensure the build happens on C:\ instead of D:\
88 condition: and(succeeded(), not(variables.SKIP_JOB))
90 - bash: src/ci/scripts/disable-git-crlf-conversion.sh
91 displayName: "Disable git automatic line ending conversion (on C:/)"
92 condition: and(succeeded(), not(variables.SKIP_JOB))
94 - bash: src/ci/scripts/install-msys2.sh
97 SYSTEM_WORKFOLDER: $(System.Workfolder)
98 displayName: Install msys2
99 condition: and(succeeded(), not(variables.SKIP_JOB))
101 - bash: src/ci/scripts/install-msys2-packages.sh
103 AGENT_OS: $(Agent.OS)
104 SYSTEM_WORKFOLDER: $(System.Workfolder)
105 displayName: Install msys2 packages
106 condition: and(succeeded(), not(variables.SKIP_JOB))
108 - bash: src/ci/scripts/install-mingw.sh
110 AGENT_OS: $(Agent.OS)
111 SYSTEM_WORKFOLDER: $(System.Workfolder)
112 displayName: Install MinGW
113 condition: and(succeeded(), not(variables.SKIP_JOB))
115 - bash: src/ci/scripts/install-ninja.sh
117 AGENT_OS: $(Agent.OS)
118 displayName: Install ninja
119 condition: and(succeeded(), not(variables.SKIP_JOB))
121 - bash: src/ci/scripts/enable-docker-ipv6.sh
123 AGENT_OS: $(Agent.OS)
124 displayName: Enable IPv6 on Docker
125 condition: and(succeeded(), not(variables.SKIP_JOB))
127 # Disable automatic line ending conversion (again). On Windows, when we're
128 # installing dependencies, something switches the git configuration directory or
129 # re-enables autocrlf. We've not tracked down the exact cause -- and there may
130 # be multiple -- but this should ensure submodules are checked out with the
131 # appropriate line endings.
132 - bash: src/ci/scripts/disable-git-crlf-conversion.sh
133 displayName: Disable git automatic line ending conversion
134 condition: and(succeeded(), not(variables.SKIP_JOB))
136 - bash: src/ci/scripts/checkout-submodules.sh
138 AGENT_OS: $(Agent.OS)
139 displayName: Checkout submodules
140 condition: and(succeeded(), not(variables.SKIP_JOB))
142 - bash: src/ci/scripts/verify-line-endings.sh
144 AGENT_OS: $(Agent.OS)
145 displayName: Verify line endings
146 condition: and(succeeded(), not(variables.SKIP_JOB))
148 # Ensure the `aws` CLI is installed so we can deploy later on, cache docker
150 - bash: src/ci/scripts/install-awscli.sh
152 AGENT_OS: $(Agent.OS)
153 condition: and(succeeded(), not(variables.SKIP_JOB))
154 displayName: Install awscli
156 # Configure our CI_JOB_NAME variable which log analyzers can use for the main
157 # step to see what's going on.
159 builder=$(echo $AGENT_JOBNAME | cut -d ' ' -f 2)
160 echo "##vso[task.setvariable variable=CI_JOB_NAME]$builder"
161 displayName: Configure Job Name
163 # As a quick smoke check on the otherwise very fast mingw-check linux builder
164 # check our own internal scripts.
167 git clone --depth=1 https://github.com/rust-lang-nursery/rust-toolstate.git
169 python2.7 "$BUILD_SOURCESDIRECTORY/src/tools/publish_toolstate.py" "$(git rev-parse HEAD)" "$(git log --format=%s -n1 HEAD)" "" ""
170 # Only check maintainers if this build is supposed to publish toolstate.
171 # Builds that are not supposed to publish don't have the access token.
172 if [ -n "${TOOLSTATE_PUBLISH+is_set}" ]; then
173 TOOLSTATE_VALIDATE_MAINTAINERS_REPO=rust-lang/rust python2.7 "${BUILD_SOURCESDIRECTORY}/src/tools/publish_toolstate.py"
176 rm -rf rust-toolstate
178 TOOLSTATE_REPO_ACCESS_TOKEN: $(TOOLSTATE_REPO_ACCESS_TOKEN)
179 condition: and(succeeded(), not(variables.SKIP_JOB), eq(variables['IMAGE'], 'mingw-check'))
180 displayName: Verify the publish_toolstate script works
184 # Remove any preexisting rustup installation since it can interfere
185 # with the cargotest step and its auto-detection of things like Clippy in
187 rustup self uninstall -y || true
188 if [ "$IMAGE" = "" ]; then
191 src/ci/docker/run.sh $IMAGE
193 #timeoutInMinutes: 180
194 timeoutInMinutes: 600
198 AWS_ACCESS_KEY_ID: $(SCCACHE_AWS_ACCESS_KEY_ID)
199 AWS_SECRET_ACCESS_KEY: $(SCCACHE_AWS_SECRET_ACCESS_KEY)
200 TOOLSTATE_REPO_ACCESS_TOKEN: $(TOOLSTATE_REPO_ACCESS_TOKEN)
201 condition: and(succeeded(), not(variables.SKIP_JOB))
202 displayName: Run build
204 # If we're a deploy builder, use the `aws` command to publish everything to our
208 source src/ci/shared.sh
209 if [ "$AGENT_OS" = "Linux" ]; then
210 rm -rf obj/build/dist/doc
211 upload_dir=obj/build/dist
213 rm -rf build/dist/doc
214 upload_dir=build/dist
217 deploy_dir=rustc-builds
218 if [ "$DEPLOY_ALT" == "1" ]; then
219 deploy_dir=rustc-builds-alt
221 retry aws s3 cp --no-progress --recursive --acl public-read ./$upload_dir s3://$DEPLOY_BUCKET/$deploy_dir/$BUILD_SOURCEVERSION
223 AWS_ACCESS_KEY_ID: $(UPLOAD_AWS_ACCESS_KEY_ID)
224 AWS_SECRET_ACCESS_KEY: $(UPLOAD_AWS_SECRET_ACCESS_KEY)
225 condition: and(succeeded(), not(variables.SKIP_JOB), or(eq(variables.DEPLOY, '1'), eq(variables.DEPLOY_ALT, '1')))
226 displayName: Upload artifacts
228 # Upload CPU usage statistics that we've been gathering this whole time. Always
229 # execute this step in case we want to inspect failed builds, but don't let
230 # errors here ever fail the build since this is just informational.
231 - bash: aws s3 cp --acl public-read cpu-usage.csv s3://$DEPLOY_BUCKET/rustc-builds/$BUILD_SOURCEVERSION/cpu-$CI_JOB_NAME.csv
233 AWS_ACCESS_KEY_ID: $(UPLOAD_AWS_ACCESS_KEY_ID)
234 AWS_SECRET_ACCESS_KEY: $(UPLOAD_AWS_SECRET_ACCESS_KEY)
235 condition: variables['UPLOAD_AWS_SECRET_ACCESS_KEY']
236 continueOnError: true
237 displayName: Upload CPU usage statistics