Add GitHub Actions workflow for CI

This commit is contained in:
Constantin Nickel 2020-10-28 13:16:52 +01:00 committed by Geoffroy Couprie
parent 0a6f4d59af
commit 90100d9317

185
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,185 @@
name: CI
on: [push, pull_request]
env:
RUST_MINVERSION: 1.37.0
jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
- beta
- nightly
- 1.44.0
features:
- '--features "regexp"'
include:
- rust: stable
features: ''
- rust: stable
features: '--features "std lexical regexp"'
- rust: stable
features: '--no-default-features'
- rust: stable
features: '--no-default-features --features "alloc"'
- rust: nightly
features: ''
- rust: nightly
features: '--no-default-features'
- rust: nightly
features: '--no-default-features --features "alloc"'
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install rust (${{ matrix.rust }})
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --verbose ${{ matrix.features }}
- name: Test
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose ${{ matrix.features }}
minrust:
name: Test MSRV
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install rust (${{ env.RUST_MINVERSION }})
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_MINVERSION }}
profile: minimal
override: true
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --verbose --no-default-features --features "regexp lexical"
- name: Test
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose --no-default-features --features "regexp lexical"
bench:
name: Bench
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
profile: minimal
override: true
- name: Compile bench
uses: actions-rs/cargo@v1
with:
command: bench
args: --verbose --no-run --features "regexp"
- name: Run bench
uses: actions-rs/cargo@v1
with:
command: bench
args: --verbose --features "regexp"
doc:
name: Build documentation
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
profile: minimal
override: true
- name: Build
uses: actions-rs/cargo@v1
with:
command: doc
args: --verbose --features "std lexical regexp"
fmt:
name: Check formatting
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt
profile: minimal
override: true
- name: cargo fmt -- --check
continue-on-error: true
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
coverage:
name: Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Install cargo-tarpaulin
uses: actions-rs/cargo@v1
with:
command: install
args: cargo-tarpaulin
- name: Run cargo tarpaulin
uses: actions-rs/cargo@v1
with:
command: tarpaulin