@@ -20,23 +20,17 @@ jobs:
2020 runs-on : ${{ matrix.os }}
2121 steps :
2222 - name : Checkout
23- uses : actions/checkout@v2
23+ uses : actions/checkout@v3
2424 - name : Install Rust ${{ matrix.rust }}
2525 uses : actions-rs/toolchain@v1
2626 with :
2727 profile : minimal
2828 toolchain : ${{ matrix.rust }}
2929 override : true
30- - name : Copy Windows config
31- if : ${{ runner.os == 'Windows' }}
32- shell : pwsh
33- run : Copy-Item -Path .cargo/config-windows.toml -Destination .cargo/config.toml
3430 - name : Caching
35- uses : Swatinem/rust-cache@v1
31+ uses : Swatinem/rust-cache@v2
3632 - name : Run Rust unit tests
37- uses : actions-rs/cargo@v1
38- with :
39- command : test
33+ run : cargo test
4034 # Check formatting and run clippy lints
4135 linting :
4236 strategy :
4842 runs-on : ubuntu-latest
4943 steps :
5044 - name : Checkout
51- uses : actions/checkout@v2
45+ uses : actions/checkout@v3
5246 - name : Install Rust ${{ matrix.rust }}
5347 uses : actions-rs/toolchain@v1
5448 with :
@@ -57,21 +51,15 @@ jobs:
5751 override : true
5852 components : rustfmt, clippy
5953 - name : Format
60- uses : actions-rs/cargo@v1
61- with :
62- command : fmt
63- args : --all -- --check
54+ run : cargo fmt --all --check
6455 - name : Clippy
65- uses : actions-rs/cargo@v1
66- with :
67- command : clippy
68- args : -- -D warnings
56+ run : cargo clippy -- -D warnings
6957 # Build documentation
7058 documentation :
7159 runs-on : ubuntu-latest
7260 steps :
7361 - name : Checkout
74- uses : actions/checkout@v2
62+ uses : actions/checkout@v3
7563 - name : Install Rust
7664 uses : actions-rs/toolchain@v1
7765 with :
@@ -81,15 +69,15 @@ jobs:
8169 - name : Install doxygen 1.9.3
8270 run : wget -q https://www.doxygen.nl/files/doxygen-1.9.5.linux.bin.tar.gz -O- | sudo tar --strip-components=1 -C /usr -xz doxygen-1.9.5
8371 - name : Caching
84- uses : Swatinem/rust-cache@v1
72+ uses : Swatinem/rust-cache@v2
8573 - name : Build FFI and JNI shared libraries
8674 run : cargo build --release -p foo-ffi -p foo-ffi-java
8775 - name : C bindings
88- run : cargo run --release -- bin foo-bindings -- --doxygen --c --no-tests -a ./target/release
76+ run : cargo run --bin foo-bindings -- --doxygen --c --no-tests -a ./target/release
8977 - name : .NET bindings
90- run : cargo run --release -- bin foo-bindings -- --doxygen --dotnet --no-tests -a ./target/release
78+ run : cargo run --bin foo-bindings -- --doxygen --dotnet --no-tests -a ./target/release
9179 - name : Java bindings
92- run : cargo run --release -- bin foo-bindings -- --java -a ./target/release
80+ run : cargo run --bin foo-bindings -- --java -a ./target/release
9381 - name : Extract documentation
9482 run : |
9583 mkdir -p ~/doc
@@ -111,84 +99,79 @@ jobs:
11199 matrix :
112100 include :
113101 - target : x86_64-pc-windows-msvc # 64-bit MSVC (Windows 7+)
114- extra-param : # nothing
102+ test : true
115103 - target : i686-pc-windows-msvc # 32-bit MSVC (Windows 7+)
116- extra-params : --no-tests
104+ test : false
117105 steps :
118106 - name : Checkout
119- uses : actions/checkout@v2
107+ uses : actions/checkout@v3
120108 - name : Install Rust
121109 uses : actions-rs/toolchain@v1
122110 with :
123111 profile : minimal
124112 toolchain : stable
125113 override : true
126114 target : ${{ matrix.target }}
127- - name : Copy Windows config
128- shell : pwsh
129- run : Copy-Item -Path .cargo/config-windows.toml -Destination .cargo/config.toml
130115 - name : Caching
131- uses : Swatinem/rust-cache@v1
116+ uses : Swatinem/rust-cache@v2
132117 - name : Build FFI and JNI
133118 run : cargo build -p foo-ffi -p foo-ffi-java --release --target ${{ matrix.target }}
134- - name : C bindings
135- run : cargo run --release --bin foo-bindings -- --c ${{ matrix.extra-params }} -r ${{ matrix.target }} -a ./target/${{ matrix.target }}/release
136- - name : .NET bindings
137- run : cargo run --release --bin foo-bindings -- --dotnet ${{ matrix.extra-params }} -r ${{ matrix.target }} -a ./target/${{ matrix.target }}/release
138- - name : Java bindings
139- run : cargo run --release --bin foo-bindings -- --java ${{ matrix.extra-params }} -r ${{ matrix.target }} -a ./target/${{ matrix.target }}/release
119+ - name : Copy the FFI and JNI libs
120+ shell : pwsh
121+ run : |
122+ New-Item .\ffi-modules\${{ matrix.target }} -ItemType Directory
123+ Copy-Item -Path ./target/${{ matrix.target }}/release/foo_ffi.dll -Destination ffi-modules/${{ matrix.target }}
124+ Copy-Item -Path ./target/${{ matrix.target }}/release/foo_ffi.dll.lib -Destination ffi-modules/${{ matrix.target }}
125+ Copy-Item -Path ./target/${{ matrix.target }}/release/foo_ffi_java.dll -Destination ffi-modules/${{ matrix.target }}
140126 - name : Upload compiled FFI modules
141127 uses : actions/upload-artifact@v2
142128 with :
143129 name : ffi-modules
144- path : tests/bindings/c/generated/${{ matrix.target }}/lib
145- - name : Upload C bindings
146- uses : actions/upload-artifact@v2
147- with :
148- name : c-bindings
149- path : tests/bindings/c/generated
150- - name : Upload compiled Java bindings
151- uses : actions/upload-artifact@v2
152- with :
153- name : ffi-modules
154- path : tests/bindings/java/foo/src/main/resources
130+ path : ffi-modules
131+ - name : C Bindings Tests
132+ if : ${{ matrix.test }}
133+ run : cargo run --bin foo-bindings -- --c -r ${{ matrix.target }} -a ./target/${{ matrix.target }}/release
134+ - name : .NET Bindings Tests
135+ if : ${{ matrix.test }}
136+ run : cargo run --bin foo-bindings -- --dotnet -r ${{ matrix.target }} -a ./target/${{ matrix.target }}/release
137+ - name : Java Bindings Tests
138+ if : ${{ matrix.test }}
139+ run : cargo run --bin foo-bindings -- --java -r ${{ matrix.target }} -a ./target/${{ matrix.target }}/release
155140 # Build bindings on MacOS [64-bit macOS (10.7+, Lion+) (x86_64-apple-darwin)]
156141 bindings-macos :
157142 runs-on : macos-latest
143+ strategy :
144+ fail-fast : false
145+ matrix :
146+ target :
147+ - x86_64-apple-darwin # 64-bit macOS (10.7+, Lion+)
158148 steps :
159149 - name : Checkout
160- uses : actions/checkout@v2
150+ uses : actions/checkout@v3
161151 - name : Install Rust
162152 uses : actions-rs/toolchain@v1
163153 with :
164154 profile : minimal
165155 toolchain : stable
166156 override : true
167157 - name : Caching
168- uses : Swatinem/rust-cache@v1
158+ uses : Swatinem/rust-cache@v2
169159 - name : Build FFI and JNI
170160 run : cargo build -p foo-ffi -p foo-ffi-java --release
171- - name : C bindings
172- run : cargo run --release --bin foo-bindings -- --c
173- - name : .NET bindings
174- run : cargo run --release --bin foo-bindings -- --dotnet
175- - name : Java bindings
176- run : cargo run --release --bin foo-bindings -- --java
161+ - name : Copy the FFI and JNI libs
162+ run : |
163+ mkdir -p ./ffi-modules/${{ matrix.target }}
164+ cp ./target/release/libfoo_ffi.dylib ./ffi-modules/${{ matrix.target }}
165+ cp ./target/release/libfoo_ffi_java.dylib ./ffi-modules/${{ matrix.target }}
177166 - name : Upload compiled FFI modules
178167 uses : actions/upload-artifact@v2
179168 with :
180169 name : ffi-modules
181- path : tests/bindings/c/generated/x86_64-apple-darwin/lib
182- - name : Upload C bindings
183- uses : actions/upload-artifact@v2
184- with :
185- name : c-bindings
186- path : tests/bindings/c/generated
187- - name : Upload compiled Java bindings
188- uses : actions/upload-artifact@v2
189- with :
190- name : ffi-modules
191- path : tests/bindings/java/foo/src/main/resources
170+ path : ffi-modules
171+ - name : .NET Bindings Tests
172+ run : cargo run --bin foo-bindings -- --dotnet
173+ - name : Java Bindings Tests
174+ run : cargo run --bin foo-bindings -- --java
192175 # Cross-compilation for ARM devices and produce C bindings
193176 cross :
194177 strategy :
@@ -203,7 +186,7 @@ jobs:
203186 runs-on : ubuntu-latest
204187 steps :
205188 - name : Checkout
206- uses : actions/checkout@v2
189+ uses : actions/checkout@v3
207190 - name : Install Rust
208191 uses : actions-rs/toolchain@v1
209192 with :
@@ -215,47 +198,43 @@ jobs:
215198 run : cargo install cross
216199 - name : Build FFI and JNI shared libraries
217200 run : cross build -p foo-ffi -p foo-ffi-java --release --target ${{ matrix.target }}
218- - name : Generate C bindings
219- run : cargo run --release --bin foo-bindings -- --c --no-tests -r ${{ matrix.target }} -a ./target/${{ matrix.target }}/release
220- - name : Generate Java bindings
221- run : cargo run --release --bin foo-bindings -- --java --no-tests -r ${{ matrix.target }} -a ./target/${{ matrix.target }}/release
201+ - name : Copy the FFI and JNI libs
202+ run : |
203+ mkdir -p ./ffi-modules/${{ matrix.target }}
204+ cp ./target/${{ matrix.target }}/release/libfoo_ffi.so ./ffi-modules/${{ matrix.target }}
205+ cp ./target/${{ matrix.target }}/release/libfoo_ffi_java.so ./ffi-modules/${{ matrix.target }}
222206 - name : Upload compiled FFI modules
223207 uses : actions/upload-artifact@v2
224208 with :
225209 name : ffi-modules
226- path : tests/bindings/c/generated/${{ matrix.target }}/lib
227- - name : Upload compiled Java bindings
228- uses : actions/upload-artifact@v2
229- with :
230- name : ffi-modules
231- path : tests/bindings/java/foo/src/main/resources
232- - name : Upload C bindings
233- uses : actions/upload-artifact@v2
234- with :
235- name : c-bindings
236- path : tests/bindings/c/generated
210+ path : ffi-modules
237211 # Package all the generated bindings
238212 packaging :
239213 needs : [documentation, bindings-windows, bindings-macos, cross]
240214 runs-on : ubuntu-latest
241215 steps :
242216 - name : Checkout
243- uses : actions/checkout@v2
217+ uses : actions/checkout@v3
244218 - name : Install Rust
245219 uses : actions-rs/toolchain@v1
246220 with :
247221 profile : minimal
248222 toolchain : stable
249223 override : true
250224 - name : Caching
251- uses : Swatinem/rust-cache@v1
225+ uses : Swatinem/rust-cache@v2
252226 - name : Download compiled FFI
253227 uses : actions/download-artifact@v2
254228 with :
255229 name : ffi-modules
256230 path : ffi-modules
257231 - name : Package all bindings
258232 run : cargo run --bin foo-bindings -- --package ./ffi-modules
233+ - name : Upload C/C++ bindings
234+ uses : actions/upload-artifact@v2
235+ with :
236+ name : c-bindings
237+ path : tests/bindings/c/generated/*
259238 - name : Upload .NET bindings
260239 uses : actions/upload-artifact@v2
261240 with :
0 commit comments