183 lines
5.0 KiB
YAML
183 lines
5.0 KiB
YAML
name: ci
|
|
|
|
on: [push, pull_request]
|
|
|
|
jobs:
|
|
test:
|
|
strategy:
|
|
matrix:
|
|
os:
|
|
- macos-latest
|
|
- ubuntu-latest
|
|
- windows-latest
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@v2
|
|
with:
|
|
submodules: true
|
|
|
|
- name: install rust toolchain
|
|
uses: hecrj/setup-rust-action@v1
|
|
with:
|
|
rust-version: nightly
|
|
|
|
- name: test leaf
|
|
run: cargo test -p leaf
|
|
|
|
build-bin-cross:
|
|
needs: [test]
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
target:
|
|
- mips-unknown-linux-musl
|
|
#- mips-unknown-linux-gnu
|
|
#- mips64-unknown-linux-gnuabi64
|
|
- mipsel-unknown-linux-musl
|
|
#- mipsel-unknown-linux-gnu
|
|
#- mipsel64-unknown-linux-gnuabi64
|
|
- x86_64-unknown-linux-musl
|
|
#- x86_64-unknown-linux-gnu
|
|
- i686-unknown-linux-musl
|
|
#- i686-unknown-linux-gnu
|
|
- aarch64-unknown-linux-musl
|
|
#- aarch64-unknown-linux-gnu
|
|
- arm-unknown-linux-musleabi
|
|
#- arm-unknown-linux-gnueabi
|
|
- armv7-unknown-linux-musleabihf
|
|
#- armv7-unknown-linux-gnueabihf
|
|
#- i686-pc-windows-gnu
|
|
- x86_64-pc-windows-gnu
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@v2
|
|
with:
|
|
submodules: true
|
|
|
|
- name: install rust toolchain
|
|
uses: hecrj/setup-rust-action@v1
|
|
with:
|
|
rust-version: nightly
|
|
|
|
- name: install deps
|
|
run: |
|
|
sudo apt update && sudo apt install llvm-dev libclang-dev clang libssl-dev pkg-config protobuf-compiler make -y
|
|
|
|
- name: install cross
|
|
run: |
|
|
cargo install cross
|
|
|
|
- name: build
|
|
run: |
|
|
export CFG_COMMIT_HASH=`git log --pretty=format:'%h' -n 1`
|
|
export CFG_COMMIT_DATE=`git log --format="%ci" -n 1`
|
|
./misc/build_cross.sh ${{ matrix.target }}
|
|
|
|
- name: rename and compress artifacts
|
|
if: ${{ matrix.target == 'x86_64-pc-windows-gnu' }}
|
|
run: |
|
|
mv target/${{ matrix.target }}/release/leaf.exe leaf-${{ matrix.target }}.exe
|
|
|
|
- name: rename and compress artifacts
|
|
if: ${{ matrix.target != 'x86_64-pc-windows-gnu' }}
|
|
run: |
|
|
mv target/${{ matrix.target }}/release/leaf leaf-${{ matrix.target }}
|
|
|
|
- name: upload assets
|
|
if: ${{ matrix.target == 'x86_64-pc-windows-gnu' }}
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: leaf-${{ matrix.target }}.exe
|
|
path: leaf-${{ matrix.target }}.exe
|
|
|
|
- name: upload assets
|
|
if: ${{ matrix.target != 'x86_64-pc-windows-gnu' }}
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: leaf-${{ matrix.target }}
|
|
path: leaf-${{ matrix.target }}
|
|
|
|
build-bin-local:
|
|
needs: [test]
|
|
strategy:
|
|
matrix:
|
|
os: [macos-latest]
|
|
include:
|
|
- os: macos-latest
|
|
target: x86_64-apple-darwin
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@v2
|
|
with:
|
|
submodules: true
|
|
|
|
- name: show last commit
|
|
run: |
|
|
git show --summary
|
|
|
|
- name: install rust toolchain
|
|
uses: hecrj/setup-rust-action@v1
|
|
with:
|
|
rust-version: nightly
|
|
|
|
- name: install llvm
|
|
if: ${{ matrix.os == 'macos-latest' }}
|
|
run: |
|
|
brew update && brew install llvm protobuf
|
|
|
|
- name: build
|
|
run: |
|
|
export CFG_COMMIT_HASH=`git log --pretty=format:'%h' -n 1`
|
|
export CFG_COMMIT_DATE=`git log --format="%ci" -n 1`
|
|
cargo build --release --target ${{ matrix.target }} -p leaf-bin
|
|
|
|
- name: rename and compress artifacts
|
|
run: |
|
|
mv target/${{ matrix.target }}/release/leaf leaf-${{ matrix.target }}
|
|
|
|
- name: upload assets
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: leaf-${{ matrix.target }}
|
|
path: leaf-${{ matrix.target }}
|
|
|
|
build-lib-ios:
|
|
needs: [test]
|
|
runs-on: macos-latest
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@v2
|
|
with:
|
|
submodules: true
|
|
|
|
- name: install rust
|
|
uses: hecrj/setup-rust-action@v1
|
|
with:
|
|
rust-version: nightly
|
|
|
|
- name: install toolchain
|
|
run: |
|
|
rustup target add aarch64-apple-ios
|
|
cargo install cargo-lipo
|
|
cargo install cbindgen
|
|
brew update && brew install llvm unzip protobuf
|
|
|
|
- name: build
|
|
run: |
|
|
# OPENSSL_DIR=/tmp/openssl-ios64 cargo lipo --release -p leaf-mobile --targets aarch64-apple-ios
|
|
make ios
|
|
|
|
- name: zip artifacts
|
|
run: |
|
|
mv target/universal/release/libleaf.a .
|
|
mv target/universal/release/leaf.h .
|
|
zip libleaf-ios.zip leaf.h libleaf.a
|
|
|
|
- name: upload assets
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: libleaf-ios.zip
|
|
path: libleaf-ios.zip
|