filite/.github/workflows/build.yml

57 lines
1.6 KiB
YAML

name: Build
on: [push, pull_request]
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Cache Cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache Cargo index
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache Cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Build project
uses: actions-rs/cargo@v1
with:
command: build
args: --release
- name: Strip binary (*nix)
if: matrix.os != 'windows-latest'
run: strip target/release/filite
- name: Archive binary (Linux)
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v1
with:
name: Linux
path: target/release/filite
- name: Archive binary (Windows)
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v1
with:
name: Windows
path: target/release/filite.exe
- name: Archive binary (macOS)
if: matrix.os == 'macOS-latest'
uses: actions/upload-artifact@v1
with:
name: macOS
path: target/release/filite