name: Rust CI test / build / deploy
on:
push: []
pull_request:
branches: [ master ]
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
components: rustfmt, clippy
- name: Configure cargo cache
uses: actions/cache@v1
with:
key: cargo-check
path: ${{ env.HOME }}/.cargo"
- name: Configure target cache
uses: actions/cache@v1
with:
key: target-check
path: ./target
- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
- name: Configure cargo cache
uses: actions/cache@v1
with:
key: cargo-test
path: ${{ env.HOME }}/.cargo"
- name: Configure target cache
uses: actions/cache@v1
with:
key: target-test
path: ./target
- uses: actions-rs/cargo@v1
with:
command: test
build:
name: Build
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
output: dsfc
use_cross: false
experimental: false
- target: armv7-unknown-linux-gnueabihf
os: ubuntu-latest
output: dsfc
use_cross: true
experimental: false
- target: x86_64-apple-darwin
os: macos-latest
output: dsfc
use_cross: false
experimental: true
steps:
- uses: actions/checkout@v2
- run: |
echo ::set-env name=GIT_TAG::$(git describe --dirty=+)
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
target: ${{ matrix.target }}
override: true
- name: Configure cargo cache
uses: actions/cache@v1
with:
key: cargo-${{ matrix.os }}-${{ matrix.target }}
path: ${{ env.HOME }}/.cargo"
- name: Configure target cache
uses: actions/cache@v1
with:
key: target-${{ matrix.os }}-${{ matrix.target }}
path: ./target
- name: Install cargo-deb
if: startsWith(matrix.os,'ubuntu')
uses: actions-rs/install@v0.1
with:
crate: cargo-deb
version: latest
- name: Build release
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.use_cross }}
command: build
args: --release --target ${{ matrix.target }}
- name: Package deb archive
if: startsWith(matrix.os,'ubuntu')
run: cargo deb --no-build --no-strip --target ${{ matrix.target }}
- name: Create tgz archive
run: tar -cvf target/dsfc-${{ matrix.target }}-${{ env.GIT_TAG }}.tgz -C target/${{ matrix.target }}/release/ ${{ matrix.output }}
- name: Upload tgz artifacts
uses: actions/upload-artifact@v2
with:
name: dsfc-${{ matrix.target }}-${{ env.GIT_TAG }}.tgz
path: target/dsfc-${{ matrix.target }}-${{ env.GIT_TAG }}.tgz
- name: Upload deb artifacts
if: startsWith(matrix.os,'ubuntu')
uses: actions/upload-artifact@v2
with:
name: dsfc-${{ matrix.target }}-${{ env.GIT_TAG }}.deb
path: target/${{ matrix.target }}/debian/*.deb