]> git.lizzy.rs Git - rust.git/blob - .github/workflows/ci.yaml
6330159568a87000a41c9a0e6d6cbcd1fbde16bb
[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 jobs:
11   rust-audit:
12     name: Audit Rust vulnerabilities
13     runs-on: ubuntu-latest
14     steps:
15     - name: Checkout repository
16       uses: actions/checkout@v1
17
18     - run: cargo install cargo-audit
19     - run: cargo audit
20
21   rust:
22     name: Rust
23     runs-on: ${{ matrix.os }}
24
25     strategy:
26       fail-fast: false
27       matrix:
28         os: [ubuntu-latest, windows-latest, macos-latest]
29
30     env:
31       RUSTFLAGS: -D warnings
32       CC: deny_c
33       CARGO_INCREMENTAL: 0
34       RUN_SLOW_TESTS: 1
35       RUSTUP_MAX_RETRIES: 10
36       CARGO_NET_RETRY: 10
37
38     steps:
39     - name: Checkout repository
40       uses: actions/checkout@v1
41
42     # We need to disable the existing toolchain to avoid updating rust-docs
43     # which takes a long time. The fastest way to do this is to rename the
44     # existing folder, as deleting it takes about as much time as not doing
45     # anything and just updating rust-docs.
46     - name: Rename existing rust toolchain (Windows)
47       if: matrix.os == 'windows-latest'
48       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
49
50     - name: Install Rust toolchain
51       uses: actions-rs/toolchain@v1
52       with:
53         toolchain: stable
54         profile: minimal
55         override: true
56         components: rustfmt, rust-src
57
58     - name: Cache cargo registry
59       uses: actions/cache@v1
60       with:
61         path: ~/.cargo/registry
62         key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
63
64     - name: Cache cargo index
65       uses: actions/cache@v1
66       with:
67         path: ~/.cargo/git
68         key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
69
70     - name: Cache cargo target dir
71       uses: actions/cache@v1
72       with:
73         path: target
74         key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
75
76     - name: Compile
77       run: cargo test --no-run
78
79     - name: Test
80       run: cargo test
81
82     - name: Prepare cache
83       run: cargo xtask pre-cache
84
85     - name: Prepare cache 2
86       if: matrix.os == 'windows-latest'
87       run: Remove-Item ./target/debug/xtask.exe, ./target/debug/deps/xtask.exe
88
89   typescript:
90     name: TypeScript
91     runs-on: ubuntu-latest
92     env:
93       CXX: g++-4.9
94       CC: gcc-4.9
95     steps:
96     - name: Checkout repository
97       uses: actions/checkout@v1
98
99     - name: Install Nodejs
100       uses: actions/setup-node@v1
101       with:
102         node-version: 12.x
103
104     - run: npm ci
105       working-directory: ./editors/code
106
107     - run: npm audit
108       working-directory: ./editors/code
109
110     - run: npm run lint
111       working-directory: ./editors/code
112
113     - run: npm run package --scripts-prepend-node-path
114       working-directory: ./editors/code