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