Set a TTL in the CI benchmark #153
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
name: Rust | |
on: [push, pull_request] | |
# See https://rust-cli.github.io/book/tutorial/packaging.html#building-binary-releases-on-ci and | |
# https://github.com/sharkdp/bat/blob/master/.github/workflows/CICD.yml for a more intricate CI/CD | |
jobs: | |
CI: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- uses: actions-rs/clippy-check@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
args: --all-targets --all-features | |
- name: Check | |
run: cargo check --all-targets --verbose | |
- name: Check (features=debug) | |
run: cargo check --all-targets --verbose --features debug | |
- name: Check Documentation | |
env: | |
RUSTDOCFLAGS: -D warnings | |
run: cargo doc --no-deps --document-private-items | |
- name: Tests | |
run: cargo test --verbose | |
- name: Tests (features=debug) | |
run: cargo test --verbose --features debug | |
- name: Benchmark | |
run: | | |
cargo build --release | |
./benchmark.sh --bkt=target/release/bkt -- --ttl=1m -- sleep 1 | |
CD: | |
needs: CI | |
name: CD (${{ matrix.arch.target }} - ${{ matrix.arch.os }}) | |
runs-on: ${{ matrix.arch.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: | |
- { target: aarch64-unknown-linux-gnu , os: ubuntu-20.04 , use-cross: true } | |
- { target: arm-unknown-linux-gnueabihf , os: ubuntu-20.04 , use-cross: true } | |
- { target: i686-unknown-linux-gnu , os: ubuntu-20.04 , use-cross: true } | |
- { target: i686-unknown-linux-musl , os: ubuntu-20.04 , use-cross: true } | |
- { target: x86_64-apple-darwin , os: macos-12 } | |
- { target: x86_64-pc-windows-msvc , os: windows-2019 , suffix: .exe } | |
- { target: x86_64-unknown-linux-gnu , os: ubuntu-20.04 } | |
- { target: x86_64-unknown-linux-musl , os: ubuntu-20.04 , use-cross: true } | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Extract crate information | |
shell: bash | |
run: | | |
echo "PROJECT_NAME=$(sed -n 's/^name = "\(.*\)"/\1/p' Cargo.toml)" >> "$GITHUB_ENV" | |
echo "PROJECT_VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> "$GITHUB_ENV" | |
- name: Build | |
uses: actions-rs/cargo@v1 | |
with: | |
use-cross: ${{ matrix.arch.use-cross }} | |
command: build | |
args: --release --target=${{ matrix.arch.target }} | |
- name: Upload package artifact | |
uses: actions/upload-artifact@master | |
with: | |
name: '${{ env.PROJECT_NAME }}.v${{ env.PROJECT_VERSION }}.${{ matrix.arch.target }}' | |
path: 'target/${{ matrix.arch.target }}/release/${{ env.PROJECT_NAME }}${{ matrix.arch.suffix }}' |