tower/.github/workflows/CI.yml

168 lines
4.3 KiB
YAML
Raw Normal View History

name: CI
on:
push:
branches:
- master
pull_request: {}
jobs:
test-workspace:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-18.04, windows-2019, macOS-10.14]
rust: [stable, nightly]
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
- name: Build
uses: actions-rs/cargo@v1
with:
command: check
args: --verbose
- name: Run tests
uses: actions-rs/cargo@v1
env:
CI: 'True'
RUSTFLAGS: '-D warnings'
with:
command: test
args: --verbose
test:
runs-on: ubuntu-latest
strategy:
matrix:
crate:
- tower
- tower-layer
- tower-service
- tower-test
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Patch
run: |
set -e
# Remove any existing patch statements
mv Cargo.toml Cargo.toml.bck
sed -n '/\[patch.crates-io\]/q;p' Cargo.toml.bck > Cargo.toml
# Patch all crates
cat .github/workflows/patch.toml >> Cargo.toml
# Print `Cargo.toml` for debugging
echo "~~~~ Cargo.toml ~~~~"
cat Cargo.toml
echo "~~~~~~~~~~~~~~~~~~~~"
- name: Build
uses: actions-rs/cargo@v1
with:
command: check
args: -p ${{ matrix.crate }} --verbose
- name: Run tests
uses: actions-rs/cargo@v1
env:
CI: 'True'
2020-03-31 12:26:59 -07:00
# RUSTFLAGS: '-D warnings'
with:
command: test
2020-03-31 12:26:59 -07:00
args: -p ${{ matrix.crate }} --verbose --all-features
features:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
- name: Patch
run: |
set -e
# Remove any existing patch statements
mv Cargo.toml Cargo.toml.bck
sed -n '/\[patch.crates-io\]/q;p' Cargo.toml.bck > Cargo.toml
# Patch all crates
cat .github/workflows/patch.toml >> Cargo.toml
# Print `Cargo.toml` for debugging
echo "~~~~ Cargo.toml ~~~~"
cat Cargo.toml
echo "~~~~~~~~~~~~~~~~~~~~"
- name: Install cargo-hack
uses: actions-rs/cargo@v1
with:
command: install
args: cargo-hack
- name: Run feature checks
uses: actions-rs/cargo@v1
env:
CI: 'True'
with:
command: hack
# Check each feature works properly
# * --each-feature
# run for each feature which includes --no-default-features and default features of package
# * -Z avoid-dev-deps
# build without dev-dependencies to avoid https://github.com/rust-lang/cargo/issues/4866
# tracking-issue: https://github.com/rust-lang/cargo/issues/5133
args: check -p tower --each-feature -Z avoid-dev-deps
rustfmt:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Ensure that rustfmt is installed
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt
- name: Run rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
# This is failing, because it finds errors...
# clippy_check:
#
# runs-on: ubuntu-latest
#
# steps:
# - name: Checkout code
# uses: actions/checkout@v1
# - name: Ensure that clippy is installed
# uses: actions-rs/toolchain@v1
# with:
# toolchain: nightly
# override: true
# components: clippy
# - name: Run clippy
# uses: actions-rs/clippy-check@v1
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
# args: --all-targets --all-features