Skip to content

feat: add github workflows for building and checking fmt.. #1

feat: add github workflows for building and checking fmt..

feat: add github workflows for building and checking fmt.. #1

Workflow file for this run

name: Build yellowstone-vixen crates
# This workflow uses github runners.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# This may be adjusted to whatever suits best your runners config.
# Current config will build on manual trigger or pull-request (each push)
on:
# pull_request can be removed, to save minutes on github runners
pull_request:
workflow_dispatch:
push:
branches:
- 'main'
env:
CARGO_TERM_COLOR: always
jobs:
build:
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-22.04]
# This can be also be runned on self-hosted github runners
runs-on: ['${{ matrix.os }}']
steps:
- name: checkout repo
uses: actions/checkout@v4
# This step can be omited, to save storage space on the organization account
# Build process will take longer
- name: Cache Build Dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
yellowstone-vixen/target/
key: ${{ matrix.os }}_yellowstone_vixen_${{ hashFiles('yellowstone-vixen/Cargo.lock') }}
restore-keys: |
${{ matrix.os }}_yellowstone_vixen
# Use cache or Install protoc
- name: Cache protoc
id: cache-protoc
uses: actions/cache@v4
with:
path: /usr/local/bin/protoc
key: protoc-${{ runner.os }}-latest
- name: Install protoc if not cached
if: steps.cache-protoc.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler
protoc --version # Verify installation
# Build yellowstone-vixen
- name: build yellowstone-vixen
run: cargo build --verbose --release
# Use cache or Install Rust Nightly
- name: Cache Rust Nightly
id: cache-rust-nightly
uses: actions/cache@v4
with:
path: ~/.rustup
key: rust-nightly-${{ runner.os }}-${{ hashFiles('rust-toolchain') }}
- name: Install Rust Nightly if Not Cached
if: steps.cache-rust-nightly.outputs.cache-hit != 'true'
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
components: rustfmt, clippy
# Cargo.lock
- name: Check lock file
run: |
cargo tree
git checkout Cargo.lock
cargo tree --frozen
# fmt
- name: Check fmt
run: cargo +nightly fmt --all -- --check
# clippy
- name: Check clippy
run: cargo +nightly clippy --all-targets --tests -- -Dwarnings