feat: Improve output processing and syntax highlighting for Cargo com… #20
This file contains hidden or 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 CI | |
on: | |
workflow_dispatch: | |
push: | |
branches: [main] | |
paths: | |
- "**.rs" | |
- "Cargo.toml" | |
- "Cargo.lock" | |
- ".github/workflows/ci.yml" | |
pull_request: | |
branches: [main] | |
paths: | |
- "**.rs" | |
- "Cargo.toml" | |
- "Cargo.lock" | |
- ".github/workflows/ci.yml" | |
env: | |
CARGO_TERM_COLOR: always | |
RUSTFLAGS: "-D warnings" | |
RUST_BACKTRACE: 1 | |
jobs: | |
check: | |
name: Check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt, clippy | |
- name: Install LuaJIT | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libluajit-5.1-dev | |
- name: Cache Dependencies | |
uses: Swatinem/rust-cache@v2 | |
- name: Check format | |
run: cargo fmt --check | |
- name: Check clippy | |
run: cargo clippy -- -D warnings | |
test: | |
name: Test | |
needs: check | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
lua: [luajit] | |
include: | |
- os: ubuntu-latest | |
lua: luajit | |
pkg: libluajit-5.1-dev | |
- os: macos-latest | |
lua: luajit | |
brew: luajit | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Install Lua (Ubuntu) | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y ${{ matrix.pkg }} | |
- name: Install Lua (macOS) | |
if: runner.os == 'macOS' | |
run: | | |
brew install ${{ matrix.brew }} | |
echo "LIBRARY_PATH=$(brew --prefix luajit)/lib:$LIBRARY_PATH" >> $GITHUB_ENV | |
echo "CPATH=$(brew --prefix luajit)/include:$CPATH" >> $GITHUB_ENV | |
echo "PKG_CONFIG_PATH=$(brew --prefix luajit)/lib/pkgconfig:$PKG_CONFIG_PATH" >> $GITHUB_ENV | |
- name: Run tests | |
run: | | |
if [ "${{ runner.os }}" = "macOS" ]; then | |
export LDFLAGS="-L$(brew --prefix luajit)/lib" | |
export CPPFLAGS="-I$(brew --prefix luajit)/include" | |
fi | |
cargo test --no-default-features --features ${{ matrix.lua }} |