Refactor github actions (#436)
Signed-off-by: Lucio Franco <luciofranco14@gmail.com>
This commit is contained in:
parent
8a73440c1a
commit
cd7dd12315
|
@ -7,161 +7,125 @@ on:
|
||||||
pull_request: {}
|
pull_request: {}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-workspace:
|
check:
|
||||||
|
# Run `cargo check` first to ensure that the pushed code at least compiles.
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-18.04, windows-2019, macOS-10.14]
|
rust: [stable, 1.39.0]
|
||||||
rust: [stable, nightly]
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- uses: actions/checkout@master
|
||||||
uses: actions/checkout@v1
|
- uses: actions-rs/toolchain@v1
|
||||||
- name: Install rust toolchain
|
|
||||||
uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
with:
|
||||||
toolchain: ${{ matrix.rust }}
|
toolchain: ${{ matrix.rust }}
|
||||||
override: true
|
profile: minimal
|
||||||
- name: Build
|
- name: Check
|
||||||
uses: actions-rs/cargo@v1
|
uses: actions-rs/cargo@v1
|
||||||
with:
|
with:
|
||||||
command: check
|
command: check
|
||||||
args: --verbose
|
args: --all --all-targets --all-features
|
||||||
- name: Run tests
|
|
||||||
uses: actions-rs/cargo@v1
|
|
||||||
env:
|
|
||||||
CI: 'True'
|
|
||||||
RUSTFLAGS: '-D warnings'
|
|
||||||
with:
|
|
||||||
command: test
|
|
||||||
args: --verbose
|
|
||||||
|
|
||||||
test:
|
|
||||||
|
|
||||||
|
cache-cargo-hack:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
crate:
|
|
||||||
- tower
|
|
||||||
- tower-layer
|
|
||||||
- tower-service
|
|
||||||
- tower-test
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Fetch latest release version of cargo-hack
|
||||||
uses: actions/checkout@v1
|
|
||||||
- name: Install rust toolchain
|
|
||||||
uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: stable
|
|
||||||
override: true
|
|
||||||
- name: Patch
|
|
||||||
run: |
|
run: |
|
||||||
set -e
|
mkdir -p .github/caching
|
||||||
# Remove any existing patch statements
|
curl -sL https://api.github.com/repos/taiki-e/cargo-hack/releases/latest | jq -r '.name' > .github/caching/cargo-hack.lock
|
||||||
mv Cargo.toml Cargo.toml.bck
|
- name: Cache cargo-hack/bin
|
||||||
sed -n '/\[patch.crates-io\]/q;p' Cargo.toml.bck > Cargo.toml
|
id: cache-cargo-hack
|
||||||
# Patch all crates
|
uses: actions/cache@v1
|
||||||
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:
|
with:
|
||||||
command: check
|
path: ${{ runner.tool_cache }}/cargo-hack/bin
|
||||||
args: -p ${{ matrix.crate }} --verbose
|
key: cargo-hack-bin-${{ hashFiles('.github/caching/cargo-hack.lock') }}
|
||||||
- name: Run tests
|
|
||||||
uses: actions-rs/cargo@v1
|
|
||||||
env:
|
|
||||||
CI: 'True'
|
|
||||||
# RUSTFLAGS: '-D warnings'
|
|
||||||
with:
|
|
||||||
command: test
|
|
||||||
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
|
- name: Install cargo-hack
|
||||||
|
if: "steps.cache-cargo-hack.outputs.cache-hit != 'true'"
|
||||||
uses: actions-rs/cargo@v1
|
uses: actions-rs/cargo@v1
|
||||||
with:
|
with:
|
||||||
command: install
|
command: install
|
||||||
args: cargo-hack
|
args: --root ${{ runner.tool_cache }}/cargo-hack --force 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:
|
|
||||||
|
|
||||||
|
cargo-hack:
|
||||||
|
needs: cache-cargo-hack
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- uses: actions/checkout@master
|
||||||
uses: actions/checkout@v1
|
- uses: actions-rs/toolchain@v1
|
||||||
- name: Ensure that rustfmt is installed
|
with:
|
||||||
uses: actions-rs/toolchain@v1
|
toolchain: stable
|
||||||
|
profile: minimal
|
||||||
|
- name: Fetch latest release version of cargo-hack
|
||||||
|
run: |
|
||||||
|
mkdir -p .github/caching
|
||||||
|
curl -sL https://api.github.com/repos/taiki-e/cargo-hack/releases/latest | jq -r '.name' > .github/caching/cargo-hack.lock
|
||||||
|
- name: Restore cargo-hack/bin
|
||||||
|
uses: actions/cache@v1
|
||||||
|
with:
|
||||||
|
path: ${{ runner.tool_cache }}/cargo-hack/bin
|
||||||
|
key: cargo-hack-bin-${{ hashFiles('.github/caching/cargo-hack.lock') }}
|
||||||
|
- run: echo "::add-path::${{ runner.tool_cache }}/cargo-hack/bin"
|
||||||
|
# if `cargo-hack` somehow doesn't exist after loading it from the cache,
|
||||||
|
# make *sure* it's there.
|
||||||
|
- run: cargo hack --help || { cargo install --force cargo-hack; }
|
||||||
|
- name: cargo hack check
|
||||||
|
working-directory: ${{ matrix.subcrate }}
|
||||||
|
run: cargo hack check --each-feature --no-dev-deps --all
|
||||||
|
|
||||||
|
test-versions:
|
||||||
|
# Test against the stable, beta, and nightly Rust toolchains on ubuntu-latest.
|
||||||
|
needs: check
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
rust: [stable, beta, nightly, 1.39.0]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@master
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: ${{ matrix.rust }}
|
||||||
|
profile: minimal
|
||||||
|
- name: Run tests
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: test
|
||||||
|
args: --all --all-features
|
||||||
|
|
||||||
|
style:
|
||||||
|
# Check style.
|
||||||
|
needs: check
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@master
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
toolchain: stable
|
toolchain: stable
|
||||||
override: true
|
|
||||||
components: rustfmt
|
components: rustfmt
|
||||||
- name: Run rustfmt
|
profile: minimal
|
||||||
|
- name: rustfmt
|
||||||
uses: actions-rs/cargo@v1
|
uses: actions-rs/cargo@v1
|
||||||
with:
|
with:
|
||||||
command: fmt
|
command: fmt
|
||||||
args: --all -- --check
|
args: --all -- --check
|
||||||
|
|
||||||
# This is failing, because it finds errors...
|
# warnings:
|
||||||
# clippy_check:
|
# # Check for any warnings. This is informational and thus is allowed to fail.
|
||||||
#
|
# runs-on: ubuntu-latest
|
||||||
# runs-on: ubuntu-latest
|
# steps:
|
||||||
#
|
# - uses: actions/checkout@master
|
||||||
# steps:
|
# - uses: actions-rs/toolchain@v1
|
||||||
# - name: Checkout code
|
# with:
|
||||||
# uses: actions/checkout@v1
|
# toolchain: stable
|
||||||
# - name: Ensure that clippy is installed
|
# components: clippy
|
||||||
# uses: actions-rs/toolchain@v1
|
# profile: minimal
|
||||||
# with:
|
# - name: Clippy
|
||||||
# toolchain: nightly
|
# uses: actions-rs/clippy-check@v1
|
||||||
# override: true
|
# with:
|
||||||
# components: clippy
|
# token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
# - name: Run clippy
|
# args: --all --all-targets --all-features -- -D warnings
|
||||||
# uses: actions-rs/clippy-check@v1
|
|
||||||
# with:
|
deny-check:
|
||||||
# token: ${{ secrets.GITHUB_TOKEN }}
|
name: cargo-deny check
|
||||||
# args: --all-targets --all-features
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- uses: EmbarkStudios/cargo-deny-action@v0
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
[advisories]
|
||||||
|
vulnerability = "deny"
|
||||||
|
unmaintained = "warn"
|
||||||
|
notice = "warn"
|
||||||
|
ignore = []
|
||||||
|
|
||||||
|
[licenses]
|
||||||
|
unlicensed = "deny"
|
||||||
|
allow = []
|
||||||
|
deny = []
|
||||||
|
copyleft = "warn"
|
||||||
|
allow-osi-fsf-free = "either"
|
||||||
|
confidence-threshold = 0.8
|
||||||
|
|
||||||
|
[bans]
|
||||||
|
multiple-versions = "deny"
|
||||||
|
highlight = "all"
|
||||||
|
|
||||||
|
[sources]
|
||||||
|
unknown-registry = "warn"
|
||||||
|
unknown-git = "warn"
|
||||||
|
allow-git = []
|
|
@ -24,4 +24,4 @@ edition = "2018"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
http = "0.1"
|
http = "0.2"
|
||||||
|
|
|
@ -60,7 +60,7 @@ tokio = { version = "0.2", optional = true }
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
futures-util = { version = "0.3", default-features = false, features = ["alloc", "async-await"] }
|
futures-util = { version = "0.3", default-features = false, features = ["alloc", "async-await"] }
|
||||||
hdrhistogram = "6.0"
|
hdrhistogram = "6.0"
|
||||||
quickcheck = { version = "0.6", default-features = false }
|
quickcheck = { version = "0.9", default-features = false }
|
||||||
tokio = { version = "0.2", features = ["macros", "stream", "sync", "test-util" ] }
|
tokio = { version = "0.2", features = ["macros", "stream", "sync", "test-util" ] }
|
||||||
tokio-test = "0.2"
|
tokio-test = "0.2"
|
||||||
tower-test = { version = "0.3", path = "../tower-test" }
|
tower-test = { version = "0.3", path = "../tower-test" }
|
||||||
|
|
Loading…
Reference in New Issue