fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #66089 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4560ea788cb

1.39.0
8.8 KiB217 linesraw
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
9parameters:
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
14steps:
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    # Only check maintainers if this build is supposed to publish toolstate.
151    # Builds that are not supposed to publish don't have the access token.
152    if [ -n "${TOOLSTATE_PUBLISH+is_set}" ]; then
153      TOOLSTATE_VALIDATE_MAINTAINERS_REPO=rust-lang/rust python2.7 "${BUILD_SOURCESDIRECTORY}/src/tools/publish_toolstate.py"
154    fi
155    cd ..
156    rm -rf rust-toolstate
157  env:
158    TOOLSTATE_REPO_ACCESS_TOKEN: $(TOOLSTATE_REPO_ACCESS_TOKEN)
159  condition: and(succeeded(), not(variables.SKIP_JOB), eq(variables['IMAGE'], 'mingw-check'))
160  displayName: Verify the publish_toolstate script works
161
162- bash: |
163    set -e
164    # Remove any preexisting rustup installation since it can interfere
165    # with the cargotest step and its auto-detection of things like Clippy in
166    # the environment
167    rustup self uninstall -y || true
168    if [ "$IMAGE" = "" ]; then
169      src/ci/run.sh
170    else
171      src/ci/docker/run.sh $IMAGE
172    fi
173  #timeoutInMinutes: 180
174  timeoutInMinutes: 600
175  env:
176    CI: true
177    SRC: .
178    AWS_ACCESS_KEY_ID: $(SCCACHE_AWS_ACCESS_KEY_ID)
179    AWS_SECRET_ACCESS_KEY: $(SCCACHE_AWS_SECRET_ACCESS_KEY)
180    TOOLSTATE_REPO_ACCESS_TOKEN: $(TOOLSTATE_REPO_ACCESS_TOKEN)
181  condition: and(succeeded(), not(variables.SKIP_JOB))
182  displayName: Run build
183
184# If we're a deploy builder, use the `aws` command to publish everything to our
185# bucket.
186- bash: |
187    set -e
188    source src/ci/shared.sh
189    if [ "$AGENT_OS" = "Linux" ]; then
190        rm -rf obj/build/dist/doc
191        upload_dir=obj/build/dist
192    else
193        rm -rf build/dist/doc
194        upload_dir=build/dist
195    fi
196    ls -la $upload_dir
197    deploy_dir=rustc-builds
198    if [ "$DEPLOY_ALT" == "1" ]; then
199        deploy_dir=rustc-builds-alt
200    fi
201    retry aws s3 cp --no-progress --recursive --acl public-read ./$upload_dir s3://$DEPLOY_BUCKET/$deploy_dir/$BUILD_SOURCEVERSION
202  env:
203    AWS_ACCESS_KEY_ID: $(UPLOAD_AWS_ACCESS_KEY_ID)
204    AWS_SECRET_ACCESS_KEY: $(UPLOAD_AWS_SECRET_ACCESS_KEY)
205  condition: and(succeeded(), not(variables.SKIP_JOB), or(eq(variables.DEPLOY, '1'), eq(variables.DEPLOY_ALT, '1')))
206  displayName: Upload artifacts
207
208# Upload CPU usage statistics that we've been gathering this whole time. Always
209# execute this step in case we want to inspect failed builds, but don't let
210# errors here ever fail the build since this is just informational.
211- bash: aws s3 cp --acl public-read cpu-usage.csv s3://$DEPLOY_BUCKET/rustc-builds/$BUILD_SOURCEVERSION/cpu-$CI_JOB_NAME.csv
212  env:
213    AWS_ACCESS_KEY_ID: $(UPLOAD_AWS_ACCESS_KEY_ID)
214    AWS_SECRET_ACCESS_KEY: $(UPLOAD_AWS_SECRET_ACCESS_KEY)
215  condition: variables['UPLOAD_AWS_SECRET_ACCESS_KEY']
216  continueOnError: true
217  displayName: Upload CPU usage statistics