]> git.lizzy.rs Git - rust.git/blob - .github/workflows/ci.yaml
Remove usless pre-cache task
[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
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
34     # We need to disable the existing toolchain to avoid updating rust-docs
35     # which takes a long time. The fastest way to do this is to rename the
36     # existing folder, as deleting it takes about as much time as not doing
37     # anything and just updating rust-docs.
38     - name: Rename existing rust toolchain (Windows)
39       if: matrix.os == 'windows-latest'
40       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
41
42     - name: Install Rust toolchain
43       uses: actions-rs/toolchain@v1
44       with:
45         toolchain: stable
46         profile: minimal
47         override: true
48         components: rustfmt, rust-src
49
50     - name: Cache cargo directories
51       uses: actions/cache@v2
52       with:
53         path: |
54           ~/.cargo/registry
55           ~/.cargo/git
56         key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
57
58     - name: Cache cargo target dir
59       uses: actions/cache@v2
60       with:
61         path: target
62         key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
63
64     - name: Compile
65       run: cargo test --no-run --locked
66
67     - name: Test
68       run: cargo test
69
70     - name: Prepare cache
71       run: cargo xtask pre-cache
72
73   # Weird targets to catch non-portable code
74   rust-cross:
75     name: Rust Cross
76     runs-on: ubuntu-latest
77
78     env:
79       targets: "powerpc-unknown-linux-gnu x86_64-unknown-linux-musl"
80
81     steps:
82     - name: Checkout repository
83       uses: actions/checkout@v2
84
85     - name: Install Rust toolchain
86       uses: actions-rs/toolchain@v1
87       with:
88         toolchain: stable
89         profile: minimal
90         override: true
91
92     - name: Install Rust targets
93       run: rustup target add ${{ env.targets }}
94
95     - name: Cache cargo directories
96       uses: actions/cache@v2
97       with:
98         path: |
99           ~/.cargo/registry
100           ~/.cargo/git
101         key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
102
103     - name: Check
104       run: |
105         for target in ${{ env.targets }}; do
106           cargo check --target=$target --all-targets
107         done
108
109   typescript:
110     name: TypeScript
111     strategy:
112       fail-fast: false
113       matrix:
114         os: [ubuntu-latest, windows-latest]
115
116     runs-on: ${{ matrix.os }}
117
118     steps:
119     - name: Checkout repository
120       uses: actions/checkout@v2
121
122     - name: Install Nodejs
123       uses: actions/setup-node@v1
124       with:
125         node-version: 12.x
126
127     - run: npm ci
128       working-directory: ./editors/code
129
130 #    - run: npm audit || { sleep 10 && npm audit; } || { sleep 30 && npm audit; }
131 #      if: runner.os == 'Linux'
132 #      working-directory: ./editors/code
133
134     - run: npm run lint
135       working-directory: ./editors/code
136
137     - name: Run vscode tests
138       uses: GabrielBB/xvfb-action@v1.2
139       env:
140         VSCODE_CLI: 1
141       with:
142         run: npm --prefix ./editors/code test
143         # working-directory: ./editors/code  # does not work: https://github.com/GabrielBB/xvfb-action/issues/8
144
145     - run: npm run package --scripts-prepend-node-path
146       working-directory: ./editors/code