]> git.lizzy.rs Git - rust.git/blob - src/ci/azure-pipelines/steps/run.yml
ci: extract validate-toolstate into a script
[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 steps:
10
11 # Configure our CI_JOB_NAME variable which log analyzers can use for the main
12 # step to see what's going on.
13 - bash: |
14     builder=$(echo $AGENT_JOBNAME | cut -d ' ' -f 2)
15     echo "##vso[task.setvariable variable=CI_JOB_NAME]$builder"
16   displayName: Configure Job Name
17
18 # Disable automatic line ending conversion, which is enabled by default on
19 # Azure's Windows image. Having the conversion enabled caused regressions both
20 # in our test suite (it broke miri tests) and in the ecosystem, since we
21 # started shipping install scripts with CRLF endings instead of the old LF.
22 #
23 # Note that we do this a couple times during the build as the PATH and current
24 # user/directory change, e.g. when mingw is enabled.
25 - bash: git config --global core.autocrlf false
26   displayName: "Disable git automatic line ending conversion"
27
28 - checkout: self
29   fetchDepth: 2
30
31 - bash: src/ci/scripts/should-skip-this.sh
32   displayName: Decide whether to run this job
33
34 # Spawn a background process to collect CPU usage statistics which we'll upload
35 # at the end of the build. See the comments in the script here for more
36 # information.
37 - bash: python src/ci/cpu-usage-over-time.py &> cpu-usage.csv &
38   displayName: "Collect CPU-usage statistics in the background"
39
40 - bash: src/ci/scripts/dump-environment.sh
41   displayName: Show the current environment
42
43 - bash: src/ci/scripts/install-sccache.sh
44   env:
45     AGENT_OS: $(Agent.OS)
46   displayName: Install sccache
47   condition: and(succeeded(), not(variables.SKIP_JOB))
48
49 - bash: src/ci/scripts/install-clang.sh
50   env:
51     AGENT_OS: $(Agent.OS)
52   displayName: Install clang
53   condition: and(succeeded(), not(variables.SKIP_JOB))
54
55 - bash: src/ci/scripts/switch-xcode.sh
56   env:
57     AGENT_OS: $(Agent.OS)
58   displayName: Switch to Xcode 9.3
59   condition: and(succeeded(), not(variables.SKIP_JOB))
60
61 - bash: src/ci/scripts/install-wix.sh
62   env:
63     AGENT_OS: $(Agent.OS)
64   displayName: Install wix
65   condition: and(succeeded(), not(variables.SKIP_JOB))
66
67 - bash: src/ci/scripts/install-innosetup.sh
68   env:
69     AGENT_OS: $(Agent.OS)
70   displayName: Install InnoSetup
71   condition: and(succeeded(), not(variables.SKIP_JOB))
72
73 - bash: src/ci/scripts/windows-symlink-build-dir.sh
74   env:
75     AGENT_OS: $(Agent.OS)
76   displayName: Ensure the build happens on C:\ instead of D:\
77   condition: and(succeeded(), not(variables.SKIP_JOB))
78
79 - bash: src/ci/scripts/disable-git-crlf-conversion.sh
80   displayName: "Disable git automatic line ending conversion (on C:/)"
81   condition: and(succeeded(), not(variables.SKIP_JOB))
82
83 - bash: src/ci/scripts/install-msys2.sh
84   env:
85     AGENT_OS: $(Agent.OS)
86     SYSTEM_WORKFOLDER: $(System.Workfolder)
87   displayName: Install msys2
88   condition: and(succeeded(), not(variables.SKIP_JOB))
89
90 - bash: src/ci/scripts/install-msys2-packages.sh
91   env:
92     AGENT_OS: $(Agent.OS)
93     SYSTEM_WORKFOLDER: $(System.Workfolder)
94   displayName: Install msys2 packages
95   condition: and(succeeded(), not(variables.SKIP_JOB))
96
97 - bash: src/ci/scripts/install-mingw.sh
98   env:
99     AGENT_OS: $(Agent.OS)
100     SYSTEM_WORKFOLDER: $(System.Workfolder)
101   displayName: Install MinGW
102   condition: and(succeeded(), not(variables.SKIP_JOB))
103
104 - bash: src/ci/scripts/install-ninja.sh
105   env:
106     AGENT_OS: $(Agent.OS)
107   displayName: Install ninja
108   condition: and(succeeded(), not(variables.SKIP_JOB))
109
110 - bash: src/ci/scripts/enable-docker-ipv6.sh
111   env:
112     AGENT_OS: $(Agent.OS)
113   displayName: Enable IPv6 on Docker
114   condition: and(succeeded(), not(variables.SKIP_JOB))
115
116 # Disable automatic line ending conversion (again). On Windows, when we're
117 # installing dependencies, something switches the git configuration directory or
118 # re-enables autocrlf. We've not tracked down the exact cause -- and there may
119 # be multiple -- but this should ensure submodules are checked out with the
120 # appropriate line endings.
121 - bash: src/ci/scripts/disable-git-crlf-conversion.sh
122   displayName: Disable git automatic line ending conversion
123   condition: and(succeeded(), not(variables.SKIP_JOB))
124
125 - bash: src/ci/scripts/checkout-submodules.sh
126   env:
127     AGENT_OS: $(Agent.OS)
128   displayName: Checkout submodules
129   condition: and(succeeded(), not(variables.SKIP_JOB))
130
131 - bash: src/ci/scripts/verify-line-endings.sh
132   env:
133     AGENT_OS: $(Agent.OS)
134   displayName: Verify line endings
135   condition: and(succeeded(), not(variables.SKIP_JOB))
136
137 # Ensure the `aws` CLI is installed so we can deploy later on, cache docker
138 # images, etc.
139 - bash: src/ci/scripts/install-awscli.sh
140   env:
141     AGENT_OS: $(Agent.OS)
142   condition: and(succeeded(), not(variables.SKIP_JOB))
143   displayName: Install awscli
144
145 # As a quick smoke check on the otherwise very fast mingw-check linux builder
146 # check our own internal scripts.
147 - bash: src/ci/scripts/validate-toolstate.sh
148   env:
149     TOOLSTATE_REPO_ACCESS_TOKEN: $(TOOLSTATE_REPO_ACCESS_TOKEN)
150   condition: and(succeeded(), not(variables.SKIP_JOB), eq(variables['IMAGE'], 'mingw-check'))
151   displayName: Verify the publish_toolstate script works
152
153 - bash: |
154     set -e
155     # Remove any preexisting rustup installation since it can interfere
156     # with the cargotest step and its auto-detection of things like Clippy in
157     # the environment
158     rustup self uninstall -y || true
159     if [ "$IMAGE" = "" ]; then
160       src/ci/run.sh
161     else
162       src/ci/docker/run.sh $IMAGE
163     fi
164   #timeoutInMinutes: 180
165   timeoutInMinutes: 600
166   env:
167     CI: true
168     SRC: .
169     AWS_ACCESS_KEY_ID: $(SCCACHE_AWS_ACCESS_KEY_ID)
170     AWS_SECRET_ACCESS_KEY: $(SCCACHE_AWS_SECRET_ACCESS_KEY)
171     TOOLSTATE_REPO_ACCESS_TOKEN: $(TOOLSTATE_REPO_ACCESS_TOKEN)
172   condition: and(succeeded(), not(variables.SKIP_JOB))
173   displayName: Run build
174
175 - bash: src/ci/scripts/upload-artifacts.sh
176   env:
177     AWS_ACCESS_KEY_ID: $(UPLOAD_AWS_ACCESS_KEY_ID)
178     AWS_SECRET_ACCESS_KEY: $(UPLOAD_AWS_SECRET_ACCESS_KEY)
179   displayName: Upload artifacts
180   # Adding a condition on DEPLOY=1 or DEPLOY_ALT=1 is not needed as all deploy
181   # builders *should* have the AWS credentials available. Still, explicitly
182   # adding the condition is helpful as this way CI will not silently skip
183   # deploying artifacts from a dist builder if the variables are misconfigured,
184   # erroring about invalid credentials instead.
185   condition: |
186     and(
187       succeeded(), not(variables.SKIP_JOB),
188       or(
189         variables.UPLOAD_AWS_SECRET_ACCESS_KEY,
190         eq(variables.DEPLOY, '1'), eq(variables.DEPLOY_ALT, '1')
191       )
192     )