Lua building #157
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: Build Lua | |
run-name: Lua building | |
on: [push, pull_request] | |
permissions: | |
contents: write | |
pull-requests: read | |
jobs: | |
builds_linux: | |
strategy: | |
fail-fast: false | |
matrix: | |
archit: [x86_64, aarch64] | |
include: | |
- archit: x86_64 | |
target: x86_64-unknown-linux-gnu | |
- archit: aarch64 | |
target: aarch64-unknown-linux-gnu | |
runs-on: ubuntu-latest | |
container: registry.cn-shanghai.aliyuncs.com/lebai/util:14.04 | |
steps: | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v1 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: ${{ matrix.target }} | |
- uses: Swatinem/rust-cache@v2 | |
- name: Install Cross Compiler | |
if: ${{ matrix.archit == 'aarch64' }} | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y --no-install-recommends gcc-aarch64-linux-gnu libc6-dev-arm64-cross | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Build | |
run: cargo build --release --features ffi_lua,mdns --target ${{matrix.target}} | |
- name: Upload | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Lebai_Lua_SDK_Linux_${{matrix.archit}} | |
path: | | |
./target/${{matrix.target}}/release/liblebai_sdk.so | |
builds_macos: | |
strategy: | |
fail-fast: false | |
matrix: | |
archit: [x86_64, aarch64] | |
include: | |
- archit: x86_64 | |
target: x86_64-apple-darwin | |
- archit: aarch64 | |
target: aarch64-apple-darwin | |
runs-on: macos-latest | |
steps: | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v1 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: ${{ matrix.target }} | |
- uses: Swatinem/rust-cache@v2 | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Build | |
run: cargo build --release --features ffi_lua,mdns --target ${{matrix.target}} | |
- name: Upload | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Lebai_Lua_SDK_MacOS_${{matrix.archit}} | |
path: | | |
./target/${{matrix.target}}/release/liblebai_sdk.dylib | |
builds_windows: | |
strategy: | |
fail-fast: false | |
matrix: | |
archit: [x86_64] | |
include: | |
- archit: x86_64 | |
target: x86_64-pc-windows-gnu | |
runs-on: windows-latest | |
steps: | |
- name: Install MSYS2 | |
uses: msys2/setup-msys2@v2 | |
with: | |
install: >- | |
mingw-w64-x86_64-rust | |
mingw-w64-x86_64-protobuf | |
mingw-w64-x86_64-lua | |
mingw-w64-x86_64-pkg-config | |
- uses: Swatinem/rust-cache@v2 | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Build | |
run: cargo build --release --features ffi_lua,mdns --target ${{matrix.target}} | |
shell: msys2 {0} | |
- name: Upload | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Lebai_Lua_SDK_Windows_${{matrix.archit}} | |
path: | | |
./target/${{matrix.target}}/release/lebai_sdk.dll | |
release: | |
if: ${{ contains(github.ref, 'tags/v') }} | |
needs: [builds_linux, builds_macos, builds_windows] | |
strategy: | |
fail-fast: false | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v3 | |
- name: Zip Artifact | |
run: for dir in `ls`; do zip -r ${dir}.zip ${dir}; done | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
draft: false | |
prerelease: false | |
files: | | |
* |