Prepare 0.8.7 #398
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
# Run the unit tests on Windows, Linux, and MacOS | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
- windows-latest | |
- macos-latest | |
rust: | |
- stable | |
- beta | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Rust ${{ matrix.rust }} | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.rust }} | |
- name: Run Rust unit tests | |
run: cargo test | |
# Check formatting and run clippy lints | |
linting: | |
strategy: | |
fail-fast: false | |
matrix: | |
rust: | |
- stable | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Rust ${{ matrix.rust }} | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.rust }} | |
components: rustfmt, clippy | |
- name: Format | |
run: cargo fmt --all --check | |
- name: Clippy | |
run: cargo clippy -- -D warnings | |
# Build documentation | |
documentation: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Install doxygen 1.9.3 | |
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 | |
- name: Build FFI and JNI shared libraries | |
run: cargo build --release -p foo-ffi -p foo-ffi-java | |
- name: C bindings | |
run: cargo run --bin foo-bindings -- --doxygen --c --no-tests -a ./target/release | |
- name: .NET bindings | |
run: cargo run --bin foo-bindings -- --doxygen --dotnet --no-tests -a ./target/release | |
- name: Java bindings | |
run: cargo run --bin foo-bindings -- --java -a ./target/release | |
- name: Extract documentation | |
run: | | |
mkdir -p ~/doc | |
cp -a tests/bindings/c/generated/doc/c ~/doc/c | |
cp -a tests/bindings/c/generated/doc/cpp ~/doc/cpp | |
cp -a tests/bindings/dotnet/foo/doc ~/doc/dotnet | |
cp -a tests/bindings/java/foo/target/apidocs ~/doc/java | |
rm tests/bindings/c/generated/logo.png tests/bindings/c/generated/doxygen-awesome.css | |
- name: Upload documentation | |
uses: actions/upload-artifact@v2 | |
with: | |
name: doc | |
path: ~/doc | |
# Build bindings on Windows x64 [64-bit MSVC (Windows 7+) (x86_64-pc-windows-msvc)] and x86 [32-bit MSVC (Windows 7+) (i686-pc-windows-msvc)] | |
bindings-windows: | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- target: x86_64-pc-windows-msvc # 64-bit MSVC (Windows 7+) | |
test: true | |
- target: i686-pc-windows-msvc # 32-bit MSVC (Windows 7+) | |
test: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
target: ${{ matrix.target }} | |
- name: Build FFI and JNI | |
run: cargo build -p foo-ffi -p foo-ffi-java --release --target ${{ matrix.target }} | |
- name: Copy the FFI and JNI libs | |
shell: pwsh | |
run: | | |
New-Item .\ffi-modules\${{ matrix.target }} -ItemType Directory | |
Copy-Item -Path ./target/${{ matrix.target }}/release/foo_ffi.dll -Destination ffi-modules/${{ matrix.target }} | |
Copy-Item -Path ./target/${{ matrix.target }}/release/foo_ffi.dll.lib -Destination ffi-modules/${{ matrix.target }} | |
Copy-Item -Path ./target/${{ matrix.target }}/release/foo_ffi_java.dll -Destination ffi-modules/${{ matrix.target }} | |
- name: Upload compiled FFI modules | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ffi-modules | |
path: ffi-modules | |
- name: C Bindings Tests | |
if: ${{ matrix.test }} | |
run: cargo run --bin foo-bindings -- --c -r ${{ matrix.target }} -a ./target/${{ matrix.target }}/release | |
- name: .NET Bindings Tests | |
if: ${{ matrix.test }} | |
run: cargo run --bin foo-bindings -- --dotnet -r ${{ matrix.target }} -a ./target/${{ matrix.target }}/release | |
- name: Java Bindings Tests | |
if: ${{ matrix.test }} | |
run: cargo run --bin foo-bindings -- --java -r ${{ matrix.target }} -a ./target/${{ matrix.target }}/release | |
# Build bindings on MacOS | |
bindings-macos: | |
runs-on: ${{ matrix.runner }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- runner: macos-14-arm | |
target: aarch64_64-apple-darwin | |
- runner: macos-13 | |
target: x86_64-apple-darwin | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
target: ${{ matrix.target }} | |
- name: Build FFI and JNI | |
run: cargo build -p foo-ffi -p foo-ffi-java --release | |
- name: Copy the FFI and JNI libs | |
run: | | |
mkdir -p ./ffi-modules/${{ matrix.target }} | |
cp ./target/release/libfoo_ffi.dylib ./ffi-modules/${{ matrix.target }} | |
cp ./target/release/libfoo_ffi_java.dylib ./ffi-modules/${{ matrix.target }} | |
- name: Upload compiled FFI modules | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ffi-modules | |
path: ffi-modules | |
- name: .NET Bindings Tests | |
run: cargo run --bin foo-bindings -- --dotnet | |
- name: Java Bindings Tests | |
run: cargo run --bin foo-bindings -- --java | |
# Cross-compilation for ARM devices and produce C bindings | |
cross: | |
strategy: | |
fail-fast: false | |
matrix: | |
target: | |
- arm-unknown-linux-gnueabi # ARMv6 Linux (kernel 3.2, glibc 2.17) | |
- arm-unknown-linux-gnueabihf # ARMv6 Linux, hardfloat (kernel 3.2, glibc 2.17) | |
- armv7-unknown-linux-gnueabihf # ARMv7 Linux, hardfloat (kernel 3.2, glibc 2.17) | |
- aarch64-unknown-linux-gnu # ARM64 Linux (kernel 4.2, glibc 2.17+) | |
- x86_64-unknown-linux-gnu # 64-bit Linux (kernel 2.6.32+, glibc 2.11+) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
target: ${{ matrix.target }} | |
- name: Install Rust Cross | |
run: cargo install cross | |
- name: Build FFI and JNI shared libraries | |
run: cross build -p foo-ffi -p foo-ffi-java --release --target ${{ matrix.target }} | |
- name: Copy the FFI and JNI libs | |
run: | | |
mkdir -p ./ffi-modules/${{ matrix.target }} | |
cp ./target/${{ matrix.target }}/release/libfoo_ffi.so ./ffi-modules/${{ matrix.target }} | |
cp ./target/${{ matrix.target }}/release/libfoo_ffi_java.so ./ffi-modules/${{ matrix.target }} | |
- name: Upload compiled FFI modules | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ffi-modules | |
path: ffi-modules | |
# Package all the generated bindings | |
packaging: | |
needs: [documentation, bindings-windows, bindings-macos, cross] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Download compiled FFI | |
uses: actions/download-artifact@v2 | |
with: | |
name: ffi-modules | |
path: ffi-modules | |
- name: Package all bindings | |
run: cargo run --bin foo-bindings -- --package ./ffi-modules --options ./packaging.json | |
- name: Upload C/C++ bindings | |
uses: actions/upload-artifact@v2 | |
with: | |
name: c-bindings | |
path: tests/bindings/c/generated/* | |
- name: Upload .NET bindings | |
uses: actions/upload-artifact@v2 | |
with: | |
name: dotnet-bindings | |
path: tests/bindings/dotnet/nupkg/* | |
- name: Upload Java bindings | |
uses: actions/upload-artifact@v2 | |
with: | |
name: java-bindings | |
path: tests/bindings/java/foo/target/*.jar |