blflash/.github/workflows/rust.yml

90 lines
2.5 KiB
YAML
Raw Permalink Normal View History

2020-12-04 16:16:02 +00:00
on: [push, pull_request]
name: Build
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
include:
- os: ubuntu-latest
artifact_name: blflash
release_name: blflash-linux-amd64
- os: windows-latest
artifact_name: blflash.exe
release_name: blflash-windows-amd64.exe
- os: macos-latest
artifact_name: blflash
release_name: blflash-macos-amd64
steps:
- uses: actions/checkout@v2
2020-12-05 15:47:23 +00:00
- name: Cache Cargo
2020-12-04 16:16:02 +00:00
uses: actions/cache@v1
with:
2020-12-05 15:47:23 +00:00
path: ~/.cargo
key: ${{ matrix.os }}-stable-cargo-v1
2020-12-04 16:16:02 +00:00
restore-keys: |
2020-12-05 15:47:23 +00:00
${{ matrix.os }}-stable-cargo-v1
2020-12-05 10:43:19 +00:00
- name: Setup toolchain
uses: actions-rs/toolchain@v1
2020-12-04 16:16:02 +00:00
with:
toolchain: stable
target: ${{ matrix.target }}
override: true
2020-12-05 10:43:19 +00:00
- name: Build release
uses: actions-rs/cargo@v1
2020-12-04 16:16:02 +00:00
with:
command: build
args: --release
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v1-release
if: startsWith(github.ref, 'refs/tags/')
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/release/${{ matrix.artifact_name }}
asset_name: ${{ matrix.release_name }}
tag: ${{ github.ref }}
cross_compile:
name: Cross compile
runs-on: ubuntu-latest
strategy:
matrix:
target:
- armv7-unknown-linux-gnueabihf
steps:
- uses: actions/checkout@v2
2020-12-05 15:47:23 +00:00
- name: Cache Cargo
2020-12-04 16:16:02 +00:00
uses: actions/cache@v1
with:
2020-12-05 15:47:23 +00:00
path: ~/.cargo
key: ${{ matrix.target }}-stable-cargo-v1
2020-12-04 16:16:02 +00:00
restore-keys: |
2020-12-05 15:47:23 +00:00
${{ matrix.target }}-stable-cargo-v1
2020-12-05 10:43:19 +00:00
- name: Setup toolchain
uses: actions-rs/toolchain@v1
2020-12-04 16:16:02 +00:00
with:
toolchain: stable
target: ${{ matrix.target }}
override: true
2020-12-05 10:43:19 +00:00
- name: Build release
uses: actions-rs/cargo@v1
2020-12-04 16:16:02 +00:00
with:
use-cross: true
command: build
args: --release --target=${{ matrix.target }}
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v1-release
if: startsWith(github.ref, 'refs/tags/')
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/${{ matrix.target }}/release/blflash
asset_name: blflash-${{ matrix.target }}
tag: ${{ github.ref }}