mirror of
https://github.com/extism/extism.git
synced 2026-01-10 14:27:57 -05:00
119 lines
3.3 KiB
YAML
119 lines
3.3 KiB
YAML
on:
|
|
pull_request:
|
|
paths:
|
|
- .github/actions/extism/**
|
|
- .github/workflows/ci-rust.yml
|
|
- convert/**
|
|
- manifest/**
|
|
- runtime/**
|
|
- rust/**
|
|
- libextism/**
|
|
workflow_dispatch:
|
|
|
|
name: Rust CI
|
|
|
|
env:
|
|
RUNTIME_CRATE: extism
|
|
LIBEXTISM_CRATE: libextism
|
|
|
|
jobs:
|
|
lib:
|
|
name: Extism runtime lib
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, macos-latest]
|
|
rust:
|
|
- stable
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v3
|
|
- name: Install Rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
override: true
|
|
- name: Cache Rust environment
|
|
uses: Swatinem/rust-cache@v1
|
|
- name: Cache libextism
|
|
id: cache-libextism
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: target/release/libextism.*
|
|
key: ${{ runner.os }}-libextism-${{ hashFiles('runtime/**') }}-${{ hashFiles('manifest/**') }}-${{ hashFiles('convert/**') }}
|
|
- name: Cache target
|
|
id: cache-target
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: target/**
|
|
key: ${{ runner.os }}-target-${{ github.sha }}
|
|
- name: Build
|
|
if: steps.cache-libextism.outputs.cache-hit != 'true'
|
|
shell: bash
|
|
run: cargo build --release -p ${{ env.LIBEXTISM_CRATE }}
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: libextism-${{ matrix.os }}
|
|
path: |
|
|
target/release/libextism.*
|
|
lint_and_test:
|
|
name: Extism runtime lint and test
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, macos-latest]
|
|
rust:
|
|
- stable
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v3
|
|
- name: Install Rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
override: true
|
|
- name: Cache Rust environment
|
|
uses: Swatinem/rust-cache@v1
|
|
- name: Cache target
|
|
id: cache-target
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: target/**
|
|
key: ${{ runner.os }}-target-${{ github.sha }}
|
|
- name: Format
|
|
run: cargo fmt --check
|
|
- name: Lint
|
|
run: cargo clippy --release --all-features --no-deps -p ${{ env.RUNTIME_CRATE }}
|
|
- name: Test
|
|
run: cargo test --release -p ${{ env.RUNTIME_CRATE }}
|
|
- name: Test all features
|
|
run: cargo test --all-features --release -p ${{ env.RUNTIME_CRATE }}
|
|
- name: Test no features
|
|
run: cargo test --no-default-features --release -p ${{ env.RUNTIME_CRATE }}
|
|
bench:
|
|
name: Benchmarking
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest]
|
|
rust:
|
|
- stable
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v3
|
|
- name: Install Rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
override: true
|
|
- name: Cache Rust environment
|
|
uses: Swatinem/rust-cache@v1
|
|
- name: Cache target
|
|
id: cache-target
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: target/**
|
|
key: ${{ runner.os }}-target-${{ github.sha }}
|
|
- run: cargo install cargo-criterion
|
|
- run: cargo criterion |