on d9d59cd help sign in
135 lines 3.6 kB history raw
1# Based on https://github.com/actions-rs/meta/blob/master/recipes/quickstart.md
2#
3# While our "example" application has the platform-specific code,
4# for simplicity we are compiling and testing everything on the Ubuntu environment only.
5# For multi-OS testing see the `cross.yml` workflow.
7on: [push, pull_request]
9name: Build
11jobs:
12 check:
13 name: Check
14 runs-on: ubuntu-latest
15 steps:
16 - name: Checkout sources
17 uses: actions/checkout@v2
18 with:
19 submodules: true
21 - name: Install stable toolchain
22 uses: actions-rs/toolchain@v1
23 with:
24 profile: minimal
25 toolchain: stable
26 override: true
28 - name: Cache cargo registry
29 uses: actions/cache@v1
30 with:
31 path: ~/.cargo/registry
32 key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
34 - name: Cache cargo index
35 uses: actions/cache@v1
36 with:
37 path: ~/.cargo/git
38 key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
40 - name: Cache cargo target dir
41 uses: actions/cache@v1
42 with:
43 path: target
44 key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
46 - name: Run cargo check
47 uses: actions-rs/cargo@v1
48 with:
49 command: check
51 test:
52 name: Test Suite
53 runs-on: ubuntu-latest
54 steps:
55 - name: Checkout sources
56 uses: actions/checkout@v2
57 with:
58 submodules: true
60 - name: Install stable toolchain
61 uses: actions-rs/toolchain@v1
62 with:
63 profile: minimal
64 toolchain: stable
65 override: true
67 - name: Cache cargo registry
68 uses: actions/cache@v1
69 with:
70 path: ~/.cargo/registry
71 key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
73 - name: Cache cargo index
74 uses: actions/cache@v1
75 with:
76 path: ~/.cargo/git
77 key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
79 - name: Cache cargo target dir
80 uses: actions/cache@v1
81 with:
82 path: target
83 key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
85 - name: Run cargo test
86 uses: actions-rs/cargo@v1
87 with:
88 command: test
90 lints:
91 name: Lints
92 runs-on: ubuntu-latest
93 steps:
94 - name: Checkout sources
95 uses: actions/checkout@v2
96 with:
97 submodules: true
99 - name: Install stable toolchain
100 uses: actions-rs/toolchain@v1
101 with:
102 profile: minimal
103 toolchain: stable
104 override: true
105 components: rustfmt, clippy
107 - name: Cache cargo registry
108 uses: actions/cache@v1
109 with:
110 path: ~/.cargo/registry
111 key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
113 - name: Cache cargo index
114 uses: actions/cache@v1
115 with:
116 path: ~/.cargo/git
117 key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
119 - name: Cache cargo target dir
120 uses: actions/cache@v1
121 with:
122 path: target
123 key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
125 - name: Run cargo fmt
126 uses: actions-rs/cargo@v1
127 with:
128 command: fmt
129 args: --all -- --check
131 - name: Run cargo clippy
132 uses: actions-rs/cargo@v1
133 with:
134 command: clippy
135 args: -- -D warnings