Rework GH workflows

This commit is contained in:
Raphaël Thériault 2020-03-09 15:12:23 -04:00
parent ed5085ef75
commit 8d6bdc20c1
3 changed files with 79 additions and 84 deletions

View File

@ -1,56 +0,0 @@
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

View File

@ -1,28 +0,0 @@
name: Checks
on: [pull_request]
jobs:
checks:
name: Checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- run: rustup component add rustfmt
- run: rustup component add clippy
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
- name: Check for clippy warnings
uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
- name: Check formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check

79
.github/workflows/main.yml vendored Normal file
View File

@ -0,0 +1,79 @@
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
path: target/release/bm2.exe
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'
run: strip target/release/bm2
- name: Upload binary
uses: actions/upload-artifact@v1
with:
name: ${{ runner.os }}
path: ${{ matrix.path || 'target/release/bm2' }}
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