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: Pre-Requisites Setup
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:
setup:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Cache Rust Nightly Toolchain
- 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
# Cache Protoc
- name: Cache protoc
id: cache-protoc
uses: actions/cache@v4
with:
path: ~/.local/bin/protoc
key: protoc-${{ runner.os }}-26.1
- name: Install Latest Protoc if Not Cached
if: steps.cache-protoc.outputs.cache-hit != 'true'
run: |
PROTOC_VERSION=26.1
ARCH=x86_64
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-${ARCH}.zip
sudo apt-get install -y unzip
unzip protoc-${PROTOC_VERSION}-linux-${ARCH}.zip -d $HOME/.local
echo "$HOME/.local/bin" >> $GITHUB_PATH
protoc --version
- name: Upload protoc Artifact
uses: actions/upload-artifact@v4
with:
name: protoc
path: ~/.local/bin/protoc