99 ci :
1010 name : CI
1111 runs-on : ubuntu-latest
12- needs : [ci-linux]
13- steps :
12+ needs : [check, ci-linux, ci-clippy, ci-serde ]
13+ steps :
1414 - name : Done
1515 run : exit 0
16+
17+ check :
18+ name : Cargo check
19+ runs-on : ubuntu-latest
20+ strategy :
21+ matrix :
22+ TARGET : [x86_64-unknown-linux-gnu, x86_64-apple-darwin, x86_64-pc-windows-msvc]
23+
24+ steps :
25+ - uses : actions/checkout@v3
26+
27+ - uses : actions-rs/toolchain@v1
28+ with :
29+ profile : minimal
30+ toolchain : stable
31+ override : true
32+ target : ${{ matrix.TARGET }}
33+
34+ - name : Cache Dependencies
35+ uses : Swatinem/rust-cache@v1
36+ with :
37+ key : ${{ matrix.TARGET }}
38+
39+ - uses : actions-rs/cargo@v1
40+ with :
41+ command : check
42+ args : --target ${{ matrix.TARGET }}
43+
44+ prebuild :
45+ name : Prebuild
46+ runs-on : ubuntu-latest
47+ strategy :
48+ matrix :
49+ rust : [stable, nightly, 1.46.0]
50+
51+ steps :
52+ - uses : actions/checkout@v3
53+
54+ - uses : actions-rs/toolchain@v1
55+ with :
56+ profile : minimal
57+ toolchain : ${{ matrix.rust }}
58+ override : true
59+
60+ - name : Cache
61+ uses : Swatinem/rust-cache@v1
62+ with :
63+ sharedKey : prebuilded-${{ matrix.rust }}
64+
65+ - name : Self install
66+ run : |
67+ cargo install svd2rust --path .
68+
1669 ci-linux :
1770 runs-on : ubuntu-latest
71+ needs : [check, prebuild]
1872 strategy :
19- fail-fast : false
2073 matrix :
2174 # All generated code should be running on stable now
2275 rust : [stable]
2376
2477 # All vendor files we want to test on stable
25- vendor : [rustfmt, Atmel, Freescale, Fujitsu, Holtek, Microchip, Nordic, Nuvoton, NXP, RISC-V, SiliconLabs, Spansion, STMicro, Toshiba]
26-
27- # The default target we're compiling on and for
28- TARGET : [x86_64-unknown-linux-gnu]
29-
30- # Temporary hack as long as we use the current CI script
31- TRAVIS_OS_NAME : [linux]
32-
33- FEATURES : [""]
78+ vendor : [Atmel, Freescale, Fujitsu, Holtek, Microchip, Nordic, Nuvoton, NXP, RISC-V, SiliconLabs, Spansion, STMicro, Toshiba]
3479
3580 # Options are all, none, strict and const
3681 options : [all, none]
@@ -51,68 +96,103 @@ jobs:
5196 # Test MSRV
5297 - rust : 1.46.0
5398 vendor : Nordic
54- TARGET : x86_64-unknown-linux-gnu
55- TRAVIS_OS_NAME : linux
5699
57100 # Use nightly for architectures which don't support stable
58101 - rust : nightly
59- experimental : true
60102 vendor : OTHER
61- TARGET : x86_64-unknown-linux-gnu
62- TRAVIS_OS_NAME : linux
63103
64- # Use nightly for architectures which don't support stable
104+ # Use nightly for architectures which don't support stable
65105 - rust : nightly
66- experimental : true
67106 vendor : Espressif
68- TARGET : x86_64-unknown-linux-gnu
69- TRAVIS_OS_NAME : linux
70-
71- # OSX
72- - rust : stable
73- TARGET : x86_64-apple-darwin
74- TRAVIS_OS_NAME : osx
75-
76- # Windows
77- - rust : stable
78- TARGET : x86_64-pc-windows-msvc
79- TRAVIS_OS_NAME : windows
80107
81108 steps :
82- - uses : actions/checkout@v2
109+ - uses : actions/checkout@v3
110+
83111 - uses : actions-rs/toolchain@v1
84112 with :
85113 profile : minimal
86114 toolchain : ${{ matrix.rust }}
87- target : ${{ matrix.TARGET }}
88115 override : true
89- components : rustfmt
116+
117+ - name : Cache
118+ uses : Swatinem/rust-cache@v1
119+ with :
120+ sharedKey : prebuilded-${{ matrix.rust }}
121+
90122 - name : Run CI script for `${{ matrix.vendor }}` under rust `${{ matrix.rust }}` with options=`${{ matrix.options }}`
91123 env :
92- TARGET : ${{ matrix.TARGET }}
93124 VENDOR : ${{ matrix.vendor }}
94- FEATURES : ${{ matrix.FEATURES }}
95- OPTIONS : ${{ matrix.options }}
96- TRAVIS_OS_NAME : ${{ matrix.TRAVIS_OS_NAME }}
125+ OPTIONS : ${{ matrix.options }}
126+ COMMAND : check
97127 run : bash ci/script.sh
128+
129+ ci-clippy :
130+ runs-on : ubuntu-latest
131+ needs : [check, prebuild]
132+ steps :
133+ - uses : actions/checkout@v3
134+
135+ - uses : actions-rs/toolchain@v1
136+ with :
137+ profile : minimal
138+ toolchain : stable
139+ override : true
140+
141+ - name : Cache
142+ uses : Swatinem/rust-cache@v1
143+ with :
144+ sharedKey : prebuilded-stable
145+
146+ - name : Run CI script
147+ env :
148+ VENDOR : RISC-V
149+ OPTIONS : all
150+ COMMAND : clippy
151+ run : bash ci/script.sh
152+
98153 ci-serde :
99154 runs-on : ubuntu-latest
100155 steps :
101- - uses : actions/checkout@v2
156+ - uses : actions/checkout@v3
157+
102158 - uses : actions-rs/toolchain@v1
103159 with :
104160 profile : minimal
105161 toolchain : stable
106162 override : true
107- components : rustfmt
108- - name : Install svdtools
109- uses : actions-rs/install@v0.1
163+
164+ - name : Cache
165+ uses : Swatinem/rust-cache@v1
110166 with :
111- crate : svdtools
112- version : 0.2.0
113- use-tool-cache : true
167+ key : svdtools-0.2.1
168+
169+ - name : Install svdtools
170+ run : |
171+ cargo install svdtools --version 0.2.1 --target-dir target
172+
114173 - name : Run CI script
115174 run : |
116175 wget https://stm32-rs.github.io/stm32-rs/stm32f411.svd.patched
117176 svdtools convert --input-format xml stm32f411.svd.patched stm32f411.yaml
118177 cargo run --release -- -i stm32f411.yaml
178+
179+ fmt :
180+ name : Rustfmt
181+ runs-on : ubuntu-latest
182+ steps :
183+ - uses : actions/checkout@v3
184+
185+ - uses : actions-rs/toolchain@v1
186+ with :
187+ profile : minimal
188+ toolchain : stable
189+ override : true
190+ components : rustfmt
191+
192+ - name : Cache Dependencies
193+ uses : Swatinem/rust-cache@v1
194+
195+ - uses : actions-rs/cargo@v1
196+ with :
197+ command : fmt
198+ args : --all -- --check
0 commit comments