Skip to content

refactor: rebrand to lumen-math (luminescent project) #46

refactor: rebrand to lumen-math (luminescent project)

refactor: rebrand to lumen-math (luminescent project) #46

Workflow file for this run

name: Continuous Integration
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
cargo-check:
name: Cargo check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }}
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libudev-dev
- name: Set PKG_CONFIG_PATH
run: echo "PKG_CONFIG_PATH=/usr/lib/pkgconfig" >> $GITHUB_ENV
- name: Run cargo check
run: cargo check --workspace
fmt-check:
name: Rust fmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- name: Run cargo fmt
run: cargo fmt --all -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: clippy
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libudev-dev
- name: Set PKG_CONFIG_PATH
run: echo "PKG_CONFIG_PATH=/usr/lib/pkgconfig" >> $GITHUB_ENV
- name: Run clippy
run: cargo clippy --workspace --all-features -- -D warnings
test-and-coverage:
name: Test and Coverage
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: dtolnay/rust-toolchain@nightly
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libudev-dev
cargo install cargo-tarpaulin
- name: Set PKG_CONFIG_PATH
run: echo "PKG_CONFIG_PATH=/usr/lib/pkgconfig" >> $GITHUB_ENV
- name: Run tests with coverage
run: cargo tarpaulin --all-features --workspace --verbose --tests --skip-clean --out xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: ./cobertura.xml
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
auto-tag:
name: Auto Tag Version
needs: [cargo-check, fmt-check, clippy, test-and-coverage]
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history to check existing tags
- name: Extract version from Cargo.toml
id: get_version
run: |
VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "TAG=v$VERSION" >> $GITHUB_OUTPUT
- name: Check if tag exists
id: check_tag
run: |
if git rev-parse "v${{ steps.get_version.outputs.VERSION }}" >/dev/null 2>&1; then
echo "exists=true" >> $GITHUB_OUTPUT
echo "ℹ️ Tag v${{ steps.get_version.outputs.VERSION }} already exists"
else
echo "exists=false" >> $GITHUB_OUTPUT
echo "✅ Tag v${{ steps.get_version.outputs.VERSION }} does not exist"
fi
- name: Create and push tag
if: steps.check_tag.outputs.exists == 'false'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "v${{ steps.get_version.outputs.VERSION }}" -m "Release v${{ steps.get_version.outputs.VERSION }}"
git push origin "v${{ steps.get_version.outputs.VERSION }}"
echo "🚀 Created and pushed tag v${{ steps.get_version.outputs.VERSION }}"