]> git.lizzy.rs Git - rust.git/blob - .github/workflows/ci.yaml
Merge #8711
[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"
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
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
70     steps:
71     - name: Checkout repository
72       uses: actions/checkout@v2
73
74     - name: Install Rust toolchain
75       uses: actions-rs/toolchain@v1
76       with:
77         toolchain: stable
78         profile: minimal
79         override: true
80
81     - name: Install Rust targets
82       run: rustup target add ${{ env.targets }}
83
84     - name: Cache Dependencies
85       uses: Swatinem/rust-cache@ce325b60658c1b38465c06cc965b79baf32c1e72
86
87     - name: Check
88       run: |
89         for target in ${{ env.targets }}; do
90           cargo check --target=$target --all-targets
91         done
92
93   typescript:
94     name: TypeScript
95     strategy:
96       fail-fast: false
97       matrix:
98         os: [ubuntu-latest, windows-latest]
99
100     runs-on: ${{ matrix.os }}
101
102     steps:
103     - name: Checkout repository
104       uses: actions/checkout@v2
105
106     - name: Install Nodejs
107       uses: actions/setup-node@v1
108       with:
109         node-version: 12.x
110
111     - run: npm ci
112       working-directory: ./editors/code
113
114 #    - run: npm audit || { sleep 10 && npm audit; } || { sleep 30 && npm audit; }
115 #      if: runner.os == 'Linux'
116 #      working-directory: ./editors/code
117
118     - run: npm run lint
119       working-directory: ./editors/code
120
121     - name: Run vscode tests
122       uses: GabrielBB/xvfb-action@v1.2
123       env:
124         VSCODE_CLI: 1
125       with:
126         run: npm --prefix ./editors/code test
127         # working-directory: ./editors/code  # does not work: https://github.com/GabrielBB/xvfb-action/issues/8
128
129     - run: npm run package --scripts-prepend-node-path
130       working-directory: ./editors/code