111 lines
2.9 KiB
YAML
111 lines
2.9 KiB
YAML
name: Rust
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
release:
|
|
workflow_dispatch:
|
|
pull_request:
|
|
|
|
jobs:
|
|
lint:
|
|
name: Lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Setup | Checkout
|
|
uses: actions/checkout@v2
|
|
- name: Install Protoc
|
|
uses: arduino/setup-protoc@v1
|
|
with:
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Setup | Rust
|
|
uses: ATiltedTree/setup-rust@v1
|
|
with:
|
|
rust-version: stable
|
|
components: clippy
|
|
- name: Build | Lint
|
|
run: cargo clippy
|
|
- uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
~/.cargo/bin/
|
|
~/.cargo/registry/index/
|
|
~/.cargo/registry/cache/
|
|
~/.cargo/git/db/
|
|
target/
|
|
key: lint
|
|
|
|
build_macos:
|
|
name: 'Build for MacOS'
|
|
runs-on: macos-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
~/.cargo/bin/
|
|
~/.cargo/registry/index/
|
|
~/.cargo/registry/cache/
|
|
~/.cargo/git/db/
|
|
target/
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
- uses: arduino/setup-protoc@v1
|
|
with:
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
- uses: ATiltedTree/setup-rust@v1
|
|
with:
|
|
rust-version: stable
|
|
- name: Build all
|
|
run: |
|
|
export CGO_LDFLAGS="-framework Security -framework CoreFoundation"
|
|
make all
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: macos
|
|
path: build/*
|
|
|
|
build_linux:
|
|
name: 'Build for Linux'
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
arch:
|
|
- aarch64-unknown-linux-gnu
|
|
- aarch64-unknown-linux-musl
|
|
- armv7-unknown-linux-gnueabi
|
|
- armv7-unknown-linux-gnueabihf
|
|
- armv7-unknown-linux-musleabi
|
|
- armv7-unknown-linux-musleabihf
|
|
- x86_64-unknown-linux-gnu
|
|
- x86_64-unknown-linux-musl
|
|
- x86_64-pc-windows-gnu
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: ATiltedTree/setup-rust@v1
|
|
with:
|
|
rust-version: stable
|
|
- uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
~/.cargo/bin/
|
|
~/.cargo/registry/index/
|
|
~/.cargo/registry/cache/
|
|
~/.cargo/git/db/
|
|
target/
|
|
key: ${{ runner.os }}-cargo-${{ matrix.arch }}
|
|
- name: Build all
|
|
run: |
|
|
cargo install cross --force
|
|
export CROSS_CONTAINER_ENGINE_NO_BUILDKIT=1
|
|
cross build --release --target ${{ matrix.arch }}
|
|
mkdir -p ./build
|
|
cp target/${{ matrix.arch }}/release/* ./build/ || true
|
|
rm ./build/*.{d,rlib}
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: release-${{ matrix.arch }}
|
|
path: build/*
|