summaryrefslogtreecommitdiffstats
path: root/.azure-pipelines.yml
blob: d78709d088f4188ca901df43d0cf6592c44d41b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
resources:
  repositories:
    - repository: rustinfra
      type: github
      name: rust-lang/simpleinfra
      endpoint: rust-lang

variables:
  - group: secrets

pool:
  vmImage: ubuntu-16.04

trigger:
  - master
pr:
  - master

steps:

  - checkout: self
    fetchDepth: 1
    # Store the GitHub authentication token in the git config. This allows the
    # next steps to retrieve it.
    persistCredentials: true

  - bash: |
      set -e
      rustc -vV
      rustup update stable
      rustup default stable
      rustc -vV
    displayName: Install Rust stable

  - bash: |
      set -euo pipefail
      # Extract the GitHub authentication token from the git config. The token
      # will be used to authenticate with the GitHub API.
      export GITHUB_TOKEN=$(git config -l | grep "\.extraheader=AUTHORIZATION" | awk '{print($3)}' | base64 -d | awk '{split($0,a,":"); print(a[2])}')
      cargo run -- check --strict
    displayName: Validate the repository contents

  - bash: cargo fmt -- --check
    displayName: Run rustfmt

  - bash: cargo clippy -- -Dwarnings
    displayName: Run clippy

  - bash: |
      set -e
      cargo run -- static-api build
      echo "team-api.infra.rust-lang.org" > build/CNAME
    displayName: Build the contents of the static API
    condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))

  - template: azure-configs/static-websites.yml@rustinfra
    parameters:
      deploy_dir: build