chore: add CI based on github actions

This commit is contained in:
Florian Dehau 2019-11-05 08:24:14 +01:00
parent 816bc9b5c8
commit 2233cdc9cc
4 changed files with 74 additions and 47 deletions

70
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,70 @@
on: [push, pull_request]
name: CI
jobs:
linux:
name: Linux
runs-on: ubuntu-latest
steps:
- name: "Install dependencies"
run: sudo apt-get install libncurses5-dev
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
profile: default
toolchain: stable
override: true
- name: "Format"
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: "Check"
uses: actions-rs/cargo@v1
with:
command: check
args: --examples
- name: "Check (crossterm)"
uses: actions-rs/cargo@v1
with:
command: check
args: --no-default-features --features=crossterm --example crossterm_demo
- name: "Check (rustbox)"
uses: actions-rs/cargo@v1
with:
command: test
args: --no-default-features --features=rustbox --example rustbox_demo
- name: "Check (curses)"
uses: actions-rs/cargo@v1
with:
command: check
args: --no-default-features --features=curses --example curses_demo
- name: "Test"
uses: actions-rs/cargo@v1
with:
command: test
- name: "Clippy"
uses: actions-rs/cargo@v1
with:
command: clippy
windows:
name: Windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
profile: default
toolchain: stable
override: true
- name: "Check (crossterm)"
uses: actions-rs/cargo@v1
with:
command: check
args: --no-default-features --features=crossterm --example crossterm_demo
- name: "Test (crossterm)"
uses: actions-rs/cargo@v1
with:
command: test
args: --no-default-features --features=crossterm --tests --examples

View file

@ -1,6 +1,6 @@
# tui-rs
[![Build Status](https://dev.azure.com/fdehau/fdehau/_apis/build/status/fdehau.tui-rs?branchName=master)](https://dev.azure.com/fdehau/fdehau/_build/latest?definitionId=2&branchName=master)
[![Build Status](https://github.com/fdehau/tui-rs/workflows/CI/badge.svg)](https://github.com/fdehau/tui-rs/actions?query=workflow%3ACI+)
[![Crate Status](https://img.shields.io/crates/v/tui.svg)](https://crates.io/crates/tui)
[![Docs Status](https://docs.rs/tui/badge.svg)](https://docs.rs/crate/tui/)

View file

@ -1,41 +0,0 @@
stages:
- stage: lint
jobs:
- template: azure/style.yml@templates
- stage: build
displayName: Build and Test
dependsOn: lint
jobs:
- job: linux
displayName: Linux
pool:
vmImage: ubuntu-16.04
steps:
- template: azure/install-rust.yml@templates
- script: cargo check --examples
displayName: Build with termion
- script: cargo check --no-default-features --features=crossterm --example crossterm_demo
displayName: Build with crossterm
- script: cargo check --no-default-features --features=curses --example curses_demo
displayName: Build with curses
- script: cargo check --no-default-features --features=rustbox --example rustbox_demo
displayName: Build with rustbox
- script: cargo test
displayName: Test with termion
- job: windows
displayName: Windows
pool:
vmImage: windows-2019
steps:
- template: azure/install-rust.yml@templates
- script: cargo check --no-default-features --features=crossterm --example crossterm_demo
displayName: Build with crossterm
- script: cargo test --no-default-features --features=crossterm --tests --examples
displayName: Test with crossterm
resources:
repositories:
- repository: templates
type: github
name: crate-ci/azure-pipelines
endpoint: fdehau

View file

@ -130,11 +130,9 @@ where
}
pub fn widths(mut self, widths: &'a [Constraint]) -> Table<'a, T, H, I, D, R> {
let between_0_and_100 = |&w| {
match w {
let between_0_and_100 = |&w| match w {
Constraint::Percentage(p) => p <= 100,
_ => true,
}
};
assert!(
widths.iter().all(between_0_and_100),