From 8d6bdc20c1f089853616b8bd215d6b7d2438884a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Th=C3=A9riault?= Date: Mon, 9 Mar 2020 15:12:23 -0400 Subject: [PATCH] Rework GH workflows --- .github/workflows/build.yml | 56 -------------------------- .github/workflows/check.yml | 28 ------------- .github/workflows/main.yml | 79 +++++++++++++++++++++++++++++++++++++ 3 files changed, 79 insertions(+), 84 deletions(-) delete mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/check.yml create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 10e9447..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -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 diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml deleted file mode 100644 index f5d47ce..0000000 --- a/.github/workflows/check.yml +++ /dev/null @@ -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 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..9c09e17 --- /dev/null +++ b/.github/workflows/main.yml @@ -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