Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add matrix CI using Github Actions #353

Merged
merged 17 commits into from
Dec 6, 2019
111 changes: 111 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: build

on: [push]

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
rust: [stable]
steps:
- uses: hecrj/setup-rust-action@v1
with:
rust-version: ${{ matrix.rust }}
- uses: actions/checkout@master
- 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: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose

build-nightly:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
rust: [nightly]
steps:
- uses: hecrj/setup-rust-action@v1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does hecrj/setup-rust-action provide compared to action-rs/toolchain?
also, it would be nice to use cache, see https://github.com/iqlusioninc/crates/blob/develop/.github/workflows/rust.yml

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly simplifies the install of the rustc version & components with

with:
  rust-version: stable
  components: clippy

with:
rust-version: ${{ matrix.rust }}
- uses: actions/checkout@master
- 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: Build
run: cargo build --verbose
continue-on-error: true
- name: Run tests
run: cargo test --verbose
continue-on-error: true

check:
name: check (ubuntu-latest, stable)
runs-on: ubuntu-latest
steps:
- uses: hecrj/setup-rust-action@v1
with:
rust-version: stable
- name: Checkout sources
uses: actions/checkout@v1
- name: Cargo Check
run: cargo check

clippy:
name: clippy (ubuntu-latest, stable)
runs-on: ubuntu-latest
steps:
- uses: hecrj/setup-rust-action@v1
with:
rust-version: stable
components: clippy
- name: Checkout sources
uses: actions/checkout@v1
- 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: Cargo Clippy
run: cargo clippy -- -D warnings -A deprecated

fmt:
name: fmt (ubuntu-latest, stable)
runs-on: ubuntu-latest
steps:
- uses: hecrj/setup-rust-action@v1
with:
rust-version: stable
components: rustfmt
- name: Checkout sources
uses: actions/checkout@v1
- name: Check Formatting
run: cargo fmt --all -- --check
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Currently available subcommands:
- [`cargo rm`](#cargo-rm)
- [`cargo upgrade`](#cargo-upgrade)

[![Build Status](https://github.com/killercup/cargo-edit/workflows/build/badge.svg)](https://github.com/killercup/cargo-edit/actions)
[![Build Status](https://travis-ci.org/killercup/cargo-edit.svg?branch=master)](https://travis-ci.org/killercup/cargo-edit)
[![Build status](https://ci.appveyor.com/api/projects/status/m23rnkaxhipb23i9/branch/master?svg=true)](https://ci.appveyor.com/project/killercup/cargo-edit/branch/master)
[![Coverage Status](https://coveralls.io/repos/killercup/cargo-edit/badge.svg?branch=master&service=github)](https://coveralls.io/github/killercup/cargo-edit?branch=master)
Expand Down
5 changes: 4 additions & 1 deletion bors.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
status = [
"build (ubuntu-latest, stable)",
"build (ubuntu-latest, nightly)",
"build (windows-latest, stable)",
"build (macOS-latest, stable)",
"continuous-integration/travis-ci/push",
"continuous-integration/appveyor/branch",
]
use_squash_merge = true