filite/.github/workflows/main.yml

80 lines
2.3 KiB
YAML
Raw Normal View History

2020-03-09 19:12:23 +00:00
name: Build
on: [push, pull_request]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
include:
- os: windows-latest
2020-03-09 19:35:50 +00:00
path: target/release/filite.exe
2020-03-09 19:12:23 +00:00
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/cache@v1
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- 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
if: runner.os != 'Windows'
2020-03-09 19:35:50 +00:00
run: strip target/release/filite
2020-03-09 19:12:23 +00:00
- name: Upload binary
uses: actions/upload-artifact@v1
with:
name: ${{ runner.os }}
2020-03-09 19:35:50 +00:00
path: ${{ matrix.path || 'target/release/filite' }}
2020-03-09 19:12:23 +00:00
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: checks-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/cache@v1
with:
path: ~/.cargo/git
key: checks-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/cache@v1
with:
path: target
key: checks-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- run: rustup component add rustfmt
- run: rustup component add clippy
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all
- name: Check for clippy warnings
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all -- -D warnings
- name: Check formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check