This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: [push, pull_request] | |
name: Continuous integration | |
jobs: | |
check: | |
name: Check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v1 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
# Install prometheus_client python library. | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- run: pip3 install prometheus_client | |
# Caching | |
- name: Cache cargo registry | |
uses: actions/cache@v1 | |
with: | |
path: ~/.cargo/registry | |
key: cargo-registry-${{ hashFiles('Cargo.toml') }} | |
- name: Cache cargo index | |
uses: actions/cache@v1 | |
with: | |
path: ~/.cargo/git | |
key: cargo-index-${{ hashFiles('Cargo.toml') }} | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: check | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --benches --all-features | |
test: | |
name: Test Suite | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v1 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
# Install prometheus_client python library. | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- run: pip3 install prometheus_client | |
# Caching | |
- name: Cache cargo registry | |
uses: actions/cache@v1 | |
with: | |
path: ~/.cargo/registry | |
key: cargo-registry-${{ hashFiles('Cargo.toml') }} | |
- name: Cache cargo index | |
uses: actions/cache@v1 | |
with: | |
path: ~/.cargo/git | |
key: cargo-index-${{ hashFiles('Cargo.toml') }} | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --all --all-features | |
fmt: | |
name: Rustfmt | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v1 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- run: rustup component add rustfmt | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --all -- --check | |
clippy: | |
name: Clippy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v1 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- run: rustup component add clippy | |
# Caching | |
- name: Cache cargo registry | |
uses: actions/cache@v1 | |
with: | |
path: ~/.cargo/registry | |
key: cargo-registry-${{ hashFiles('Cargo.toml') }} | |
- name: Cache cargo index | |
uses: actions/cache@v1 | |
with: | |
path: ~/.cargo/git | |
key: cargo-index-${{ hashFiles('Cargo.toml') }} | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
args: --workspace --all-targets -- -D warnings | |
check-rustdoc-links: | |
name: Check rustdoc intra-doc links | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v1 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- uses: actions-rs/cargo@v1 | |
env: | |
RUSTDOCFLAGS: "--deny broken_intra_doc_links" | |
with: | |
command: doc | |
args: --verbose --workspace --no-deps --document-private-items --all-features | |
cross-compile: | |
name: Cross compile | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
target: | |
- armv7-unknown-linux-gnueabihf | |
- powerpc-unknown-linux-gnu | |
- powerpc64-unknown-linux-gnu | |
- wasm32-unknown-unknown | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
target: ${{ matrix.target }} | |
# Note that this does not test the `protobuf` feature (for now). See reasoning in https://github.com/prometheus/client_rust/pull/98/. | |
- run: cargo check --target=${{ matrix.target }} |