influxdb/.github/workflows/rust.yml

104 lines
2.5 KiB
YAML

# CI Overview
# -----------
#
# All pushes and PRs (including from forks) run:
#
# - cargo build with the default cargo profile ("dev")
# - cargo test
# - cargo fmt
# - clippy (with warnings denied)
#
# All workflow actions make use of our build container
# (`quay.io/influxdb/rust:ci`) to satisfy system dependencies, and is updated
# nightly.
#
# Cargo's build artefacts are cached to reduce the build time, see
# https://github.com/actions/cache for more info.
on: [pull_request]
name: ci
jobs:
build:
name: Build
runs-on: ubuntu-latest
container:
image: quay.io/influxdb/rust:ci
# Run as the "root" user in the build container to fix workspace & cache
# permission errors.
options: --user root
steps:
# Checkout the code
- uses: actions/checkout@v2
# Enable caching of build artefacts
- uses: actions/cache@v2
with:
path: target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
# Build!
- name: Run dev build
uses: actions-rs/cargo@v1
with:
command: build
args: --workspace
# Ensure benches still build
- name: Build Benches
uses: actions-rs/cargo@v1
with:
command: test
args: --workspace --benches --no-run
test:
name: Test
runs-on: ubuntu-latest
container:
image: quay.io/influxdb/rust:ci
options: --user root
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --workspace
lints:
name: Rust Lints
runs-on: ubuntu-latest
container:
image: quay.io/influxdb/rust:ci
options: --user root
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-targets --workspace -- -D warnings
protobuf:
name: Protobuf Lints
runs-on: ubuntu-latest
container:
image: bufbuild/buf
steps:
- uses: actions/checkout@v2
- name: Lint IOx protobuf
run: buf lint