]> git.lizzy.rs Git - rust.git/blob - src/ci/azure-pipelines/steps/run.yml
Auto merge of #65435 - michaelwoerister:fix-issue-64153, r=alexcrichton
[rust.git] / src / ci / azure-pipelines / steps / run.yml
1 # FIXME(linux): need to configure core dumps, enable them, and then dump
2 # backtraces on failure from all core dumps:
3 #
4 # - bash: sudo apt install gdb
5 # - bash: sudo sh -c 'echo "/checkout/obj/cores/core.%p.%E" > /proc/sys/kernel/core_pattern'
6 #
7 # Check travis config for `gdb --batch` command to print all crash logs
8
9 parameters:
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: ''
13
14 steps:
15
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.
20 #
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"
25
26 - checkout: self
27   fetchDepth: 2
28
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 }}:
33   - bash: |
34       set -e
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"
39       else
40           echo "Not executing this job since no submodules were updated"
41           echo "##vso[task.setvariable variable=SKIP_JOB;]1"
42       fi
43     displayName: Decide whether to run this job
44
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
47 # information.
48 - bash: python src/ci/cpu-usage-over-time.py &> cpu-usage.csv &
49   displayName: "Collect CPU-usage statistics in the background"
50
51 - bash: src/ci/scripts/dump-environment.sh
52   displayName: Show the current environment
53
54 - bash: src/ci/scripts/install-sccache.sh
55   env:
56     AGENT_OS: $(Agent.OS)
57   displayName: Install sccache
58   condition: and(succeeded(), not(variables.SKIP_JOB))
59
60 - bash: src/ci/scripts/install-clang.sh
61   env:
62     AGENT_OS: $(Agent.OS)
63   displayName: Install clang
64   condition: and(succeeded(), not(variables.SKIP_JOB))
65
66 - bash: src/ci/scripts/switch-xcode.sh
67   env:
68     AGENT_OS: $(Agent.OS)
69   displayName: Switch to Xcode 9.3
70   condition: and(succeeded(), not(variables.SKIP_JOB))
71
72 - bash: src/ci/scripts/install-wix.sh
73   env:
74     AGENT_OS: $(Agent.OS)
75   displayName: Install wix
76   condition: and(succeeded(), not(variables.SKIP_JOB))
77
78 - bash: src/ci/scripts/install-innosetup.sh
79   env:
80     AGENT_OS: $(Agent.OS)
81   displayName: Install InnoSetup
82   condition: and(succeeded(), not(variables.SKIP_JOB))
83
84 - bash: src/ci/scripts/windows-symlink-build-dir.sh
85   env:
86     AGENT_OS: $(Agent.OS)
87   displayName: Ensure the build happens on C:\ instead of D:\
88   condition: and(succeeded(), not(variables.SKIP_JOB))
89
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))
93
94 - bash: src/ci/scripts/install-msys2.sh
95   env:
96     AGENT_OS: $(Agent.OS)
97     SYSTEM_WORKFOLDER: $(System.Workfolder)
98   displayName: Install msys2
99   condition: and(succeeded(), not(variables.SKIP_JOB))
100
101 - bash: src/ci/scripts/install-msys2-packages.sh
102   env:
103     AGENT_OS: $(Agent.OS)
104     SYSTEM_WORKFOLDER: $(System.Workfolder)
105   displayName: Install msys2 packages
106   condition: and(succeeded(), not(variables.SKIP_JOB))
107
108 - bash: src/ci/scripts/install-mingw.sh
109   env:
110     AGENT_OS: $(Agent.OS)
111     SYSTEM_WORKFOLDER: $(System.Workfolder)
112   displayName: Install MinGW
113   condition: and(succeeded(), not(variables.SKIP_JOB))
114
115 - bash: src/ci/scripts/install-ninja.sh
116   env:
117     AGENT_OS: $(Agent.OS)
118   displayName: Install ninja
119   condition: and(succeeded(), not(variables.SKIP_JOB))
120
121 - bash: src/ci/scripts/enable-docker-ipv6.sh
122   env:
123     AGENT_OS: $(Agent.OS)
124   displayName: Enable IPv6 on Docker
125   condition: and(succeeded(), not(variables.SKIP_JOB))
126
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))
135
136 - bash: src/ci/scripts/checkout-submodules.sh
137   env:
138     AGENT_OS: $(Agent.OS)
139   displayName: Checkout submodules
140   condition: and(succeeded(), not(variables.SKIP_JOB))
141
142 - bash: src/ci/scripts/verify-line-endings.sh
143   env:
144     AGENT_OS: $(Agent.OS)
145   displayName: Verify line endings
146   condition: and(succeeded(), not(variables.SKIP_JOB))
147
148 # Ensure the `aws` CLI is installed so we can deploy later on, cache docker
149 # images, etc.
150 - bash: src/ci/scripts/install-awscli.sh
151   env:
152     AGENT_OS: $(Agent.OS)
153   condition: and(succeeded(), not(variables.SKIP_JOB))
154   displayName: Install awscli
155
156 # Configure our CI_JOB_NAME variable which log analyzers can use for the main
157 # step to see what's going on.
158 - bash: |
159     builder=$(echo $AGENT_JOBNAME | cut -d ' ' -f 2)
160     echo "##vso[task.setvariable variable=CI_JOB_NAME]$builder"
161   displayName: Configure Job Name
162
163 # As a quick smoke check on the otherwise very fast mingw-check linux builder
164 # check our own internal scripts.
165 - bash: |
166     set -e
167     git clone --depth=1 https://github.com/rust-lang-nursery/rust-toolstate.git
168     cd rust-toolstate
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"
174     fi
175     cd ..
176     rm -rf rust-toolstate
177   env:
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
181
182 - bash: |
183     set -e
184     # Remove any preexisting rustup installation since it can interfere
185     # with the cargotest step and its auto-detection of things like Clippy in
186     # the environment
187     rustup self uninstall -y || true
188     if [ "$IMAGE" = "" ]; then
189       src/ci/run.sh
190     else
191       src/ci/docker/run.sh $IMAGE
192     fi
193   #timeoutInMinutes: 180
194   timeoutInMinutes: 600
195   env:
196     CI: true
197     SRC: .
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
203
204 # If we're a deploy builder, use the `aws` command to publish everything to our
205 # bucket.
206 - bash: |
207     set -e
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
212     else
213         rm -rf build/dist/doc
214         upload_dir=build/dist
215     fi
216     ls -la $upload_dir
217     deploy_dir=rustc-builds
218     if [ "$DEPLOY_ALT" == "1" ]; then
219         deploy_dir=rustc-builds-alt
220     fi
221     retry aws s3 cp --no-progress --recursive --acl public-read ./$upload_dir s3://$DEPLOY_BUCKET/$deploy_dir/$BUILD_SOURCEVERSION
222   env:
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
227
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
232   env:
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