88 fail-fast : false
99 matrix :
1010 toolchain :
11- - rust : stable
11+ - rust : stable
1212 # - rust: nightly
1313 platform :
14- - target : x86_64-unknown-linux-gnu
15- host : ubuntu-latest
16- cross : false
17-
18- - target : x86_64-apple-darwin
19- host : macos-latest
20- cross : false
21-
22- - target : x86_64-pc-windows-msvc
23- host : windows-latest
24- cross : false
25-
26- - target : armv7-linux-androideabi
27- host : ubuntu-latest
28- cross : true
29- - target : aarch64-linux-android
30- host : ubuntu-latest
31- cross : true
32-
33- - target : aarch64-apple-ios
34- host : macos-latest
35- cross : true
36-
37- # - target: wasm32-unknown-unknown
38- # host: ubuntu-latest
39- # cross: true
14+ - target : x86_64-unknown-linux-gnu
15+ host : ubuntu-latest
16+ cross : false
17+
18+ - target : x86_64-apple-darwin
19+ host : macos-latest
20+ cross : false
21+
22+ - target : x86_64-pc-windows-msvc
23+ host : windows-latest
24+ cross : false
25+
26+ - target : armv7-linux-androideabi
27+ host : ubuntu-latest
28+ cross : true
29+ - target : aarch64-linux-android
30+ host : ubuntu-latest
31+ cross : true
32+
33+ - target : aarch64-apple-ios
34+ host : macos-latest
35+ cross : true
36+
37+ # - target: wasm32-unknown-unknown
38+ # host: ubuntu-latest
39+ # cross: true
4040 env :
4141 RUST_BACKTRACE : 1
4242 CARGO_INCREMENTAL : 0
@@ -45,73 +45,115 @@ jobs:
4545
4646 runs-on : ${{ matrix.platform.host }}
4747 steps :
48- - name : Install Protoc
49- uses : arduino/setup-protoc@v1
50- - name : Checkout sources
51- uses : actions/checkout@v2
52-
53- - name : Cache cargo folder
54- uses : actions/cache@v1
55- with :
56- path : ~/.cargo
57- key : ${{ matrix.platform.target }}-cargo-${{ matrix.toolchain.rust }}
58-
59- - name : Install dependencies ubuntu
60- if : matrix.platform.host == 'ubuntu-latest'
61- run : sudo apt-get install llvm-dev
62-
63- - name : Install dependencies macos
64- if : matrix.platform.host == 'macos-latest'
65- run : brew install llvm
66-
67- - name : Install dependencies windows
68- if : matrix.platform.host == 'windows-latest'
69- run : choco install llvm
70-
71- - name : Install rust toolchain
72- uses : hecrj/setup-rust-action@v1
73- with :
74- rust-version : ${{ matrix.toolchain.rust }}
75- targets : ${{ matrix.platform.target }}
76-
77- - name : Install cargo-apk
78- if : contains(matrix.platform.target, 'android')
79- run : cargo install cargo-apk
80-
81- - name : Build
82- if : contains(matrix.platform.target, 'android') == false
83- run : cargo build --all --target ${{ matrix.platform.target }}
84-
85- - name : Build android
86- if : contains(matrix.platform.target, 'android')
87- run : cargo apk --target ${{ matrix.platform.target }} build --all
88-
89- - name : Rust tests
90- if : matrix.platform.cross == false
91- run : cargo test --all
48+ - name : Checkout sources
49+ uses : actions/checkout@v3
50+
51+ - name : Cache cargo folder
52+ uses : actions/cache@v3
53+ with :
54+ path : |
55+ ~/.cargo/bin/
56+ ~/.cargo/registry/index/
57+ ~/.cargo/registry/cache/
58+ ~/.cargo/git/db/
59+ target/
60+ key : ${{ matrix.platform.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
61+
62+ - name : Install Protoc
63+ uses : arduino/setup-protoc@v1
64+ with :
65+ repo-token : ${{ secrets.GITHUB_TOKEN }}
66+
67+ - name : Install dependencies ubuntu
68+ if : matrix.platform.host == 'ubuntu-latest'
69+ run : sudo apt-get install llvm-dev
70+
71+ - name : Install dependencies macos
72+ if : matrix.platform.host == 'macos-latest'
73+ run : brew install llvm
74+
75+ - name : Install dependencies windows
76+ if : matrix.platform.host == 'windows-latest'
77+ run : choco install llvm
78+
79+ - name : Install rust toolchain
80+ uses : actions-rs/toolchain@v1
81+ with :
82+ profile : minimal
83+ toolchain : ${{ matrix.toolchain.rust }}
84+ target : ${{ matrix.platform.target }}
85+
86+ - name : Install cargo-apk
87+ if : contains(matrix.platform.target, 'android')
88+ uses : baptiste0928/cargo-install@bf6758885262d0e6f61089a9d8c8790d3ac3368f # v1.3.0
89+ with :
90+ crate : cargo-apk
91+
92+ - name : Build
93+ if : contains(matrix.platform.target, 'android') == false
94+ uses : actions-rs/cargo@v1
95+ with :
96+ command : build
97+ args : --all --target ${{ matrix.platform.target }}
98+
99+ - name : Build android
100+ if : contains(matrix.platform.target, 'android')
101+ uses : actions-rs/cargo@v1
102+ with :
103+ command : apk
104+ args : -- build --target ${{ matrix.platform.target }}
105+
106+ - name : Rust tests
107+ if : matrix.platform.cross == false
108+ uses : actions-rs/cargo@v1
109+ with :
110+ command : test
111+ args : --all
112+
113+ - name : Rust tests (compat feature)
114+ if : matrix.platform.cross == false
115+ uses : actions-rs/cargo@v1
116+ with :
117+ command : test
118+ args : --all --all-features
92119
93120 lint-rust :
94121 runs-on : ubuntu-latest
95122 steps :
96- - name : Install Protoc
97- uses : arduino/setup-protoc@v1
98- - name : Checkout sources
99- uses : actions/checkout@v2
100-
101- - name : Cache cargo folder
102- uses : actions/cache@v1
103- with :
104- path : ~/.cargo
105- key : lint-cargo
106-
107- - name : Install rust toolchain
108- uses : hecrj/setup-rust-action@v1
109- with :
110- rust-version : stable
111- components : clippy, rustfmt
112-
113- - name : cargo fmt
114- run : cargo fmt --all -- --check
115-
116- - name : cargo clippy
117- run : cargo clippy --workspace --examples --tests -- -D warnings
123+ - name : Checkout sources
124+ uses : actions/checkout@v3
125+
126+ - name : Cache cargo folder
127+ uses : actions/cache@v3
128+ with :
129+ path : |
130+ ~/.cargo/bin/
131+ ~/.cargo/registry/index/
132+ ~/.cargo/registry/cache/
133+ ~/.cargo/git/db/
134+ target/
135+ key : cargo-${{ hashFiles('**/Cargo.lock') }}
136+
137+ - name : Install rust toolchain
138+ uses : actions-rs/toolchain@v1
139+ with :
140+ toolchain : stable
141+ profile : minimal
142+ components : clippy, rustfmt
143+
144+ - name : Install Protoc
145+ uses : arduino/setup-protoc@v1
146+ with :
147+ repo-token : ${{ secrets.GITHUB_TOKEN }}
148+
149+ - name : cargo fmt
150+ uses : actions-rs/cargo@v1
151+ with :
152+ command : fmt
153+ args : --all -- --check
154+
155+ - name : cargo clippy
156+ uses : actions-rs/cargo@v1
157+ with :
158+ command : clippy
159+ args : --workspace --examples --tests -- -D warnings
0 commit comments