fork/rust-analyzer

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

borsAuto merge of #12127 - dtolnay-contrib:checkoutv3, r=lnicola3eb8b28ce5

2022-06-20
4.5 KiB172 linesraw
1# Please make sure that the `needs` fields for both `end-success` and `end-failure`
2# are updated when adding new jobs!
3
4name: CI
5on:
6  pull_request:
7  push:
8    branches:
9    - auto
10    - try
11
12env:
13  CARGO_INCREMENTAL: 0
14  CARGO_NET_RETRY: 10
15  CI: 1
16  RUST_BACKTRACE: short
17  RUSTFLAGS: "-D warnings -W unreachable-pub -W rust-2021-compatibility"
18  RUSTUP_MAX_RETRIES: 10
19
20jobs:
21  rust:
22    if: github.repository == 'rust-lang/rust-analyzer'
23    name: Rust
24    runs-on: ${{ matrix.os }}
25    env:
26      CC: deny_c
27
28    strategy:
29      fail-fast: false
30      matrix:
31        os: [ubuntu-latest, windows-latest, macos-latest]
32
33    steps:
34    - name: Checkout repository
35      uses: actions/checkout@v3
36      with:
37        ref: ${{ github.event.pull_request.head.sha }}
38        fetch-depth: 20
39
40    # We need to disable the existing toolchain to avoid updating rust-docs
41    # which takes a long time. The fastest way to do this is to rename the
42    # existing folder, as deleting it takes about as much time as not doing
43    # anything and just updating rust-docs.
44    - name: Rename existing rust toolchain (Windows)
45      if: matrix.os == 'windows-latest'
46      run: Rename-Item C:\Users\runneradmin\.rustup\toolchains\stable-x86_64-pc-windows-msvc C:\Users\runneradmin\.rustup\toolchains\stable-x86_64-pc-windows-msvc.old
47
48    - name: Install Rust toolchain
49      uses: actions-rs/toolchain@v1
50      with:
51        toolchain: stable
52        profile: minimal
53        override: true
54        components: rustfmt, rust-src
55
56    - name: Cache Dependencies
57      uses: Swatinem/rust-cache@ce325b60658c1b38465c06cc965b79baf32c1e72
58
59    - name: Compile
60      run: cargo test --no-run --locked
61
62    - name: Test
63      run: cargo test -- --nocapture --quiet
64
65  # Weird targets to catch non-portable code
66  rust-cross:
67    if: github.repository == 'rust-lang/rust-analyzer'
68    name: Rust Cross
69    runs-on: ubuntu-latest
70
71    env:
72      targets: "powerpc-unknown-linux-gnu x86_64-unknown-linux-musl"
73      # The rust-analyzer binary is not expected to compile on WASM, but the IDE
74      # crate should
75      targets_ide: "wasm32-unknown-unknown"
76
77    steps:
78    - name: Checkout repository
79      uses: actions/checkout@v3
80
81    - name: Install Rust toolchain
82      uses: actions-rs/toolchain@v1
83      with:
84        toolchain: stable
85        profile: minimal
86        override: true
87
88    - name: Install Rust targets
89      run: rustup target add ${{ env.targets }} ${{ env.targets_ide }}
90
91    - name: Cache Dependencies
92      uses: Swatinem/rust-cache@ce325b60658c1b38465c06cc965b79baf32c1e72
93
94    - name: Check
95      run: |
96        for target in ${{ env.targets }}; do
97          cargo check --target=$target --all-targets
98        done
99        for target in ${{ env.targets_ide }}; do
100          cargo check -p ide --target=$target --all-targets
101        done
102
103  typescript:
104    if: github.repository == 'rust-lang/rust-analyzer'
105    name: TypeScript
106    strategy:
107      fail-fast: false
108      matrix:
109        os: [ubuntu-latest, windows-latest]
110
111    runs-on: ${{ matrix.os }}
112
113    steps:
114    - name: Checkout repository
115      uses: actions/checkout@v3
116
117    - name: Install Nodejs
118      uses: actions/setup-node@v1
119      with:
120        node-version: 14.x
121
122    - name: Install xvfb
123      if: matrix.os == 'ubuntu-latest'
124      run: sudo apt-get install -y xvfb
125
126    - run: npm ci
127      working-directory: ./editors/code
128
129#    - run: npm audit || { sleep 10 && npm audit; } || { sleep 30 && npm audit; }
130#      if: runner.os == 'Linux'
131#      working-directory: ./editors/code
132
133    - run: npm run lint
134      working-directory: ./editors/code
135
136    - name: Run VS Code tests (Linux)
137      if: matrix.os == 'ubuntu-latest'
138      env:
139        VSCODE_CLI: 1
140      run: xvfb-run npm test
141      working-directory: ./editors/code
142
143    - name: Run VS Code tests (Windows)
144      if: matrix.os == 'windows-latest'
145      env:
146        VSCODE_CLI: 1
147      run: npm test
148      working-directory: ./editors/code
149
150    - run: npm run pretest
151      working-directory: ./editors/code
152
153    - run: npm run package --scripts-prepend-node-path
154      working-directory: ./editors/code
155
156  end-success:
157    name: bors build finished
158    if: github.event.pusher.name == 'bors' && success()
159    runs-on: ubuntu-latest
160    needs: [rust, rust-cross, typescript]
161    steps:
162      - name: Mark the job as successful
163        run: exit 0
164
165  end-failure:
166    name: bors build finished
167    if: github.event.pusher.name == 'bors' && (failure() || cancelled())
168    runs-on: ubuntu-latest
169    needs: [rust, rust-cross, typescript]
170    steps:
171      - name: Mark the job as a failure
172        run: exit 1