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