name: miniRobot CI
on:
push:
branches:
- master
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
rust: [stable]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
- name: Build project
run: cargo build --release --all-targets
- name: Run tests
run: cargo test --all-targets -- --nocapture
- name: Publish binary
if: success()
run: |
# 归档产物到目录miniRobot
targets=(
minirobot minirobot_info minirobot_manage
libminirobot.rlib
)
(
mkdir -p bin/
cd target/release
mkdir -p miniRobot/ && mv ${targets[@]} miniRobot/
tar -czvf ../../bin/minirobot_binaries_${{ matrix.os }}.tar.gz miniRobot/
)
- name: Upload release binary
if: success()
uses: actions/upload-artifact@v2
with:
name: binaries-${{ matrix.os }}
path: ./bin/