]> git.lizzy.rs Git - rust.git/blob - .azure-pipelines/steps/run.yml
Rollup merge of #63055 - Mark-Simulacrum:save-analysis-clean-2, r=Xanewok
[rust.git] / .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: printenv | sort
52   displayName: Show environment variables
53
54 - bash: |
55     set -e
56     df -h
57     du . | sort -nr | head -n100
58   displayName: Show disk usage
59   # FIXME: this hasn't been tested, but maybe it works on Windows? Should test!
60   condition: and(succeeded(), ne(variables['Agent.OS'], 'Windows_NT'))
61
62 - template: install-sccache.yml
63 - template: install-clang.yml
64
65 # Install some dependencies needed to build LLDB/Clang, currently only needed
66 # during the `dist` target
67 - bash: |
68     set -e
69     brew update
70     brew install xz
71     brew install swig@3
72     brew link --force swig@3
73   displayName: Install build dependencies (OSX)
74   condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'), eq(variables['SCRIPT'],'./x.py dist'))
75
76 # Switch to XCode 9.3 on OSX since it seems to be the last version that supports
77 # i686-apple-darwin. We'll eventually want to upgrade this and it will probably
78 # force us to drop i686-apple-darwin, but let's keep the wheels turning for now.
79 - bash: |
80     set -e
81     sudo xcode-select --switch /Applications/Xcode_9.3.app
82   displayName: Switch to Xcode 9.3 (OSX)
83   condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'))
84
85 - template: install-windows-build-deps.yml
86
87 # Looks like docker containers have IPv6 disabled by default, so let's turn it
88 # on since libstd tests require it
89 - bash: |
90     set -e
91     sudo mkdir -p /etc/docker
92     echo '{"ipv6":true,"fixed-cidr-v6":"fd9a:8454:6789:13f7::/64"}' | sudo tee /etc/docker/daemon.json
93     sudo service docker restart
94   displayName: Enable IPv6
95   condition: and(succeeded(), not(variables.SKIP_JOB), eq(variables['Agent.OS'], 'Linux'))
96
97 # Disable automatic line ending conversion (again). On Windows, when we're
98 # installing dependencies, something switches the git configuration directory or
99 # re-enables autocrlf. We've not tracked down the exact cause -- and there may
100 # be multiple -- but this should ensure submodules are checked out with the
101 # appropriate line endings.
102 - bash: git config --replace-all --global core.autocrlf false
103   displayName: "Disable git automatic line ending conversion"
104
105 # Check out all our submodules, but more quickly than using git by using one of
106 # our custom scripts
107 - bash: |
108     set -e
109     mkdir -p $HOME/rustsrc
110     $BUILD_SOURCESDIRECTORY/src/ci/init_repo.sh . $HOME/rustsrc
111   condition: and(succeeded(), not(variables.SKIP_JOB), ne(variables['Agent.OS'], 'Windows_NT'))
112   displayName: Check out submodules (Unix)
113 - script: |
114     if not exist C:\cache\rustsrc\NUL mkdir C:\cache\rustsrc
115     sh src/ci/init_repo.sh . /c/cache/rustsrc
116   condition: and(succeeded(), not(variables.SKIP_JOB), eq(variables['Agent.OS'], 'Windows_NT'))
117   displayName: Check out submodules (Windows)
118
119 # See also the disable for autocrlf above, this just checks that it worked
120 #
121 # We check both in rust-lang/rust and in a submodule to make sure both are
122 # accurate. Submodules are checked out significantly later than the main
123 # repository in this script, so settings can (and do!) change between then.
124 #
125 # Linux (and maybe macOS) builders don't currently have dos2unix so just only
126 # run this step on Windows.
127 - bash: |
128     set -x
129     # print out the git configuration so we can better investigate failures in
130     # the following
131     git config --list --show-origin
132     dos2unix -ih Cargo.lock src/tools/rust-installer/install-template.sh
133     endings=$(dos2unix -ic Cargo.lock src/tools/rust-installer/install-template.sh)
134     # if endings has non-zero length, error out
135     if [ -n "$endings" ]; then exit 1 ; fi
136   condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
137   displayName: Verify line endings are LF
138
139 # Ensure the `aws` CLI is installed so we can deploy later on, cache docker
140 # images, etc.
141 - bash: src/ci/install-awscli.sh
142   env:
143     AGENT_OS: $(Agent.OS)
144   condition: and(succeeded(), not(variables.SKIP_JOB))
145   displayName: Install awscli
146
147 # Configure our CI_JOB_NAME variable which log analyzers can use for the main
148 # step to see what's going on.
149 - bash: |
150     builder=$(echo $AGENT_JOBNAME | cut -d ' ' -f 2)
151     echo "##vso[task.setvariable variable=CI_JOB_NAME]$builder"
152   displayName: Configure Job Name
153
154 # As a quick smoke check on the otherwise very fast mingw-check linux builder
155 # check our own internal scripts.
156 - bash: |
157     set -e
158     git clone --depth=1 https://github.com/rust-lang-nursery/rust-toolstate.git
159     cd rust-toolstate
160     python2.7 "$BUILD_SOURCESDIRECTORY/src/tools/publish_toolstate.py" "$(git rev-parse HEAD)" "$(git log --format=%s -n1 HEAD)" "" ""
161     cd ..
162     rm -rf rust-toolstate
163   condition: and(succeeded(), not(variables.SKIP_JOB), eq(variables['IMAGE'], 'mingw-check'))
164   displayName: Verify the publish_toolstate script works
165
166 - bash: |
167     set -e
168     # Remove any preexisting rustup installation since it can interfere
169     # with the cargotest step and its auto-detection of things like Clippy in
170     # the environment
171     rustup self uninstall -y || true
172     if [ "$IMAGE" = "" ]; then
173       src/ci/run.sh
174     else
175       src/ci/docker/run.sh $IMAGE
176     fi
177   #timeoutInMinutes: 180
178   timeoutInMinutes: 600
179   env:
180     CI: true
181     SRC: .
182     AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY)
183     TOOLSTATE_REPO_ACCESS_TOKEN: $(TOOLSTATE_REPO_ACCESS_TOKEN)
184   condition: and(succeeded(), not(variables.SKIP_JOB))
185   displayName: Run build
186
187 # If we're a deploy builder, use the `aws` command to publish everything to our
188 # bucket.
189 - bash: |
190     set -e
191     source src/ci/shared.sh
192     if [ "$AGENT_OS" = "Linux" ]; then
193         rm -rf obj/build/dist/doc
194         upload_dir=obj/build/dist
195     else
196         rm -rf build/dist/doc
197         upload_dir=build/dist
198     fi
199     ls -la $upload_dir
200     deploy_dir=rustc-builds
201     if [ "$DEPLOY_ALT" == "1" ]; then
202         deploy_dir=rustc-builds-alt
203     fi
204     retry aws s3 cp --no-progress --recursive --acl public-read ./$upload_dir s3://$DEPLOY_BUCKET/$deploy_dir/$BUILD_SOURCEVERSION
205   env:
206     AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY)
207   condition: and(succeeded(), not(variables.SKIP_JOB), or(eq(variables.DEPLOY, '1'), eq(variables.DEPLOY_ALT, '1')))
208   displayName: Upload artifacts
209
210 # Upload CPU usage statistics that we've been gathering this whole time. Always
211 # execute this step in case we want to inspect failed builds, but don't let
212 # errors here ever fail the build since this is just informational.
213 - bash: aws s3 cp --acl public-read cpu-usage.csv s3://$DEPLOY_BUCKET/rustc-builds/$BUILD_SOURCEVERSION/cpu-$SYSTEM_JOBNAME.csv
214   env:
215     AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY)
216   condition: variables['AWS_SECRET_ACCESS_KEY']
217   continueOnError: true
218   displayName: Upload CPU usage statistics