Skip to content

ci: workflows for local runs and GH actions #6

ci: workflows for local runs and GH actions

ci: workflows for local runs and GH actions #6

Workflow file for this run

name: Code quality
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
container:
image: ubuntu:24.04
env:
OPENSSL_DIR: /usr/include/openssl
OPENSSL_LIB_DIR: /usr/lib/x86_64-linux-gnu
OPENSSL_INCLUDE_DIR: /usr/include/openssl
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install dependencies
run: |
apt-get update
apt-get install -y curl git build-essential libssl-dev
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Build project
run: cargo build --release
setup:
runs-on: ubuntu-latest
container:
image: ubuntu:24.04
env:
OPENSSL_DIR: /usr/include/openssl
OPENSSL_LIB_DIR: /usr/lib/x86_64-linux-gnu
OPENSSL_INCLUDE_DIR: /usr/include/openssl
outputs:
cargo-path: ${{ steps.export-cargo-path.outputs.path }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install dependencies
run: |
apt-get update
apt-get install -y curl git build-essential libssl-dev
- name: Install Rust
id: install-rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Export cargo path
id: export-cargo-path
run: echo "path=$HOME/.cargo/bin" >> $GITHUB_OUTPUT
lint:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Rust
run: echo "$GITHUB_PATH" >> $GITHUB_PATH
- name: Lint
run: cargo clippy -- -D warnings
format:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Rust
run: echo "$GITHUB_PATH" >> $GITHUB_PATH
- name: Format
run: |
cargo fmt -- ./lib/src/serviceinfo/models/*.rs # workaround to fix autogenerated code formatting
cargo fmt -- ./lib/src/tes/models/*.rs
cargo fmt -- --check
spell-check:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Rust
run: echo "$GITHUB_PATH" >> $GITHUB_PATH
- name: Check spellings
run: cargo spellcheck