]> git.lizzy.rs Git - rust.git/blob - .github/workflows/ci.yaml
Bump xvfb-action to fix Code tests
[rust.git] / .github / workflows / ci.yaml
1 name: CI
2 on:
3   pull_request:
4   push:
5     branches:
6     - master
7     - staging
8     - trying
9
10 env:
11   CARGO_INCREMENTAL: 0
12   CARGO_NET_RETRY: 10
13   CI: 1
14   RUST_BACKTRACE: short
15   RUSTFLAGS: "-D warnings -W unreachable-pub -W rust-2021-compatibility"
16   RUSTUP_MAX_RETRIES: 10
17
18 jobs:
19   rust:
20     name: Rust
21     runs-on: ${{ matrix.os }}
22     env:
23       CC: deny_c
24
25     strategy:
26       fail-fast: false
27       matrix:
28         os: [ubuntu-latest, windows-latest, macos-latest]
29
30     steps:
31     - name: Checkout repository
32       uses: actions/checkout@v2
33       with:
34         ref: ${{ github.event.pull_request.head.sha }}
35         fetch-depth: 20
36
37     # We need to disable the existing toolchain to avoid updating rust-docs
38     # which takes a long time. The fastest way to do this is to rename the
39     # existing folder, as deleting it takes about as much time as not doing
40     # anything and just updating rust-docs.
41     - name: Rename existing rust toolchain (Windows)
42       if: matrix.os == 'windows-latest'
43       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
44
45     - name: Install Rust toolchain
46       uses: actions-rs/toolchain@v1
47       with:
48         toolchain: stable
49         profile: minimal
50         override: true
51         components: rustfmt, rust-src
52
53     - name: Cache Dependencies
54       uses: Swatinem/rust-cache@ce325b60658c1b38465c06cc965b79baf32c1e72
55
56     - name: Compile
57       run: cargo test --no-run --locked
58
59     - name: Test
60       run: cargo test -- --nocapture --quiet
61
62   # Weird targets to catch non-portable code
63   rust-cross:
64     name: Rust Cross
65     runs-on: ubuntu-latest
66
67     env:
68       targets: "powerpc-unknown-linux-gnu x86_64-unknown-linux-musl"
69       # The rust-analyzer binary is not expected to compile on WASM, but the IDE
70       # crate should
71       targets_ide: "wasm32-unknown-unknown"
72
73     steps:
74     - name: Checkout repository
75       uses: actions/checkout@v2
76
77     - name: Install Rust toolchain
78       uses: actions-rs/toolchain@v1
79       with:
80         toolchain: stable
81         profile: minimal
82         override: true
83
84     - name: Install Rust targets
85       run: rustup target add ${{ env.targets }} ${{ env.targets_ide }}
86
87     - name: Cache Dependencies
88       uses: Swatinem/rust-cache@ce325b60658c1b38465c06cc965b79baf32c1e72
89
90     - name: Check
91       run: |
92         for target in ${{ env.targets }}; do
93           cargo check --target=$target --all-targets
94         done
95         for target in ${{ env.targets_ide }}; do
96           cargo check -p ide --target=$target --all-targets
97         done
98
99   typescript:
100     name: TypeScript
101     strategy:
102       fail-fast: false
103       matrix:
104         os: [ubuntu-latest, windows-latest]
105
106     runs-on: ${{ matrix.os }}
107
108     steps:
109     - name: Checkout repository
110       uses: actions/checkout@v2
111
112     - name: Install Nodejs
113       uses: actions/setup-node@v1
114       with:
115         node-version: 12.x
116
117     - run: npm ci
118       working-directory: ./editors/code
119
120 #    - run: npm audit || { sleep 10 && npm audit; } || { sleep 30 && npm audit; }
121 #      if: runner.os == 'Linux'
122 #      working-directory: ./editors/code
123
124     - run: npm run lint
125       working-directory: ./editors/code
126
127     - name: Run vscode tests
128       uses: GabrielBB/xvfb-action@v1.6
129       env:
130         VSCODE_CLI: 1
131       with:
132         run: npm test
133         working-directory: ./editors/code
134
135     - run: npm run pretest
136       working-directory: ./editors/code
137
138     - run: npm run package --scripts-prepend-node-path
139       working-directory: ./editors/code