]> git.lizzy.rs Git - rust.git/blob - .github/workflows/ci.yaml
Auto merge of #12539 - soruh:instanciate_empty_structs, r=Veykril
[rust.git] / .github / workflows / ci.yaml
1 # Please make sure that the `needs` fields for both `end-success` and `end-failure`
2 # are updated when adding new jobs!
3
4 name: CI
5 on:
6   pull_request:
7   push:
8     branches:
9     - auto
10     - try
11
12 env:
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
20 jobs:
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     - name: Install Rust toolchain
41       run: |
42         rustup update --no-self-update stable
43         rustup component add rustfmt rust-src
44
45     - name: Cache Dependencies
46       uses: Swatinem/rust-cache@ce325b60658c1b38465c06cc965b79baf32c1e72
47
48     - name: Compile
49       run: cargo test --no-run --locked
50
51     - name: Test
52       run: cargo test -- --nocapture --quiet
53
54   # Weird targets to catch non-portable code
55   rust-cross:
56     if: github.repository == 'rust-lang/rust-analyzer'
57     name: Rust Cross
58     runs-on: ubuntu-latest
59
60     env:
61       targets: "powerpc-unknown-linux-gnu x86_64-unknown-linux-musl"
62       # The rust-analyzer binary is not expected to compile on WASM, but the IDE
63       # crate should
64       targets_ide: "wasm32-unknown-unknown"
65
66     steps:
67     - name: Checkout repository
68       uses: actions/checkout@v3
69
70     - name: Install Rust toolchain
71       run: |
72         rustup update --no-self-update stable
73         rustup target add ${{ env.targets }} ${{ env.targets_ide }}
74
75     - name: Cache Dependencies
76       uses: Swatinem/rust-cache@ce325b60658c1b38465c06cc965b79baf32c1e72
77
78     - name: Check
79       run: |
80         for target in ${{ env.targets }}; do
81           cargo check --target=$target --all-targets
82         done
83         for target in ${{ env.targets_ide }}; do
84           cargo check -p ide --target=$target --all-targets
85         done
86
87   typescript:
88     if: github.repository == 'rust-lang/rust-analyzer'
89     name: TypeScript
90     strategy:
91       fail-fast: false
92       matrix:
93         os: [ubuntu-latest, windows-latest]
94
95     runs-on: ${{ matrix.os }}
96
97     steps:
98     - name: Checkout repository
99       uses: actions/checkout@v3
100
101     - name: Install Nodejs
102       uses: actions/setup-node@v1
103       with:
104         node-version: 14.x
105
106     - name: Install xvfb
107       if: matrix.os == 'ubuntu-latest'
108       run: sudo apt-get install -y xvfb
109
110     - run: npm ci
111       working-directory: ./editors/code
112
113 #    - run: npm audit || { sleep 10 && npm audit; } || { sleep 30 && npm audit; }
114 #      if: runner.os == 'Linux'
115 #      working-directory: ./editors/code
116
117     - run: npm run lint
118       working-directory: ./editors/code
119
120     - name: Run VS Code tests (Linux)
121       if: matrix.os == 'ubuntu-latest'
122       env:
123         VSCODE_CLI: 1
124       run: xvfb-run npm test
125       working-directory: ./editors/code
126
127     - name: Run VS Code tests (Windows)
128       if: matrix.os == 'windows-latest'
129       env:
130         VSCODE_CLI: 1
131       run: npm test
132       working-directory: ./editors/code
133
134     - run: npm run pretest
135       working-directory: ./editors/code
136
137     - run: npm run package --scripts-prepend-node-path
138       working-directory: ./editors/code
139
140   end-success:
141     name: bors build finished
142     if: github.event.pusher.name == 'bors' && success()
143     runs-on: ubuntu-latest
144     needs: [rust, rust-cross, typescript]
145     steps:
146       - name: Mark the job as successful
147         run: exit 0
148
149   end-failure:
150     name: bors build finished
151     if: github.event.pusher.name == 'bors' && (failure() || cancelled())
152     runs-on: ubuntu-latest
153     needs: [rust, rust-cross, typescript]
154     steps:
155       - name: Mark the job as a failure
156         run: exit 1