Skip to content

Updates for latest cargo-component version #134

Updates for latest cargo-component version

Updates for latest cargo-component version #134

Workflow file for this run

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: CI
on:
push:
branches: ["main", "v*"]
# Also run on tag pushes, as the release.yml doesn't currently run tests
tags: ["v*"]
paths-ignore:
- ".plugin-manifests/**"
- "*.md"
- "LICENSE"
pull_request:
branches: ["main", "v*"]
paths-ignore:
- ".plugin-manifests/**"
- "*.md"
- "LICENSE"
env:
CARGO_TERM_COLOR: always
CARGO_COMPONENT_VERSION: 0.14.0
RUST_VERSION: 1.79
WASI_SDK_VERSION: "22.0"
WASI_SDK_RELEASE: wasi-sdk-22
jobs:
lint-rust:
name: Lint Rust
runs-on: "ubuntu-latest"
steps:
# install dependencies
- name: Install Rust toolchain
run: |
rustup toolchain install ${{ env.RUST_VERSION }} --component clippy --component rustfmt
rustup default ${{ env.RUST_VERSION }}
- name: Install Wasm Rust target
run: rustup target add wasm32-wasip1 && rustup target add wasm32-wasi && rustup target add wasm32-unknown-unknown
- name: Install cargo-component
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-component
version: ${{ env.CARGO_COMPONENT_VERSION }}
- uses: Swatinem/rust-cache@v2
with:
shared-key: "${{ runner.os }}-full-${{ hashFiles('./Cargo.lock') }}"
- name: Install WASI-SDK
shell: bash
run: |
cd /tmp
curl -LO https://github.com/WebAssembly/wasi-sdk/releases/download/${WASI_SDK_RELEASE}/wasi-sdk-${WASI_SDK_VERSION}-linux.tar.gz
tar xf wasi-sdk-${WASI_SDK_VERSION}-linux.tar.gz
echo "WASI_SDK_PATH=`pwd`/wasi-sdk-${WASI_SDK_VERSION}" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: Cargo Format
run: cargo fmt --all -- --check
- name: Cargo Clippy
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
build-rust:
name: Build Plugin
runs-on: ${{ matrix.config.os }}
strategy:
matrix:
config:
- { os: ubuntu-latest, platform: "linux" }
- { os: macos-latest, platform: "macos" }
steps:
# install dependencies
- name: Install latest Rust stable toolchain
run: |
rustup toolchain install ${{ env.RUST_VERSION }} --component clippy --component rustfmt --no-self-update
rustup default ${{ env.RUST_VERSION }}
- name: "Install Wasm Rust target"
run: rustup target add wasm32-wasip1 && rustup target add wasm32-wasi && rustup target add wasm32-unknown-unknown
- name: Install cargo-component
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-component
version: ${{ env.CARGO_COMPONENT_VERSION }}
- uses: Swatinem/rust-cache@v2
with:
shared-key: "${{ runner.os }}-full-${{ hashFiles('./Cargo.lock') }}"
- name: Install WASI-SDK
shell: bash
run: |
cd /tmp
curl -LO https://github.com/WebAssembly/wasi-sdk/releases/download/${WASI_SDK_RELEASE}/wasi-sdk-${WASI_SDK_VERSION}-${{ matrix.config.platform }}.tar.gz
tar xf wasi-sdk-${WASI_SDK_VERSION}-${{ matrix.config.platform }}.tar.gz
echo "WASI_SDK_PATH=`pwd`/wasi-sdk-${WASI_SDK_VERSION}" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: Cargo Build
run: cargo build --release
env:
CARGO_INCREMENTAL: 0
test-rust:
name: Plugin Unit Tests
runs-on: "ubuntu-latest"
steps:
- name: Install latest Rust stable toolchain
run: |
rustup toolchain install ${{ env.RUST_VERSION }} --component clippy --component rustfmt --no-self-update
rustup default ${{ env.RUST_VERSION }}
- name: "Install Wasm Rust target"
run: rustup target add wasm32-wasip1 && rustup target add wasm32-wasi && rustup target add wasm32-unknown-unknown
- name: Install cargo-component
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-component
version: ${{ env.CARGO_COMPONENT_VERSION }}
- uses: Swatinem/rust-cache@v2
with:
shared-key: "${{ runner.os }}-full-${{ hashFiles('./Cargo.lock') }}"
- name: Install WASI-SDK
shell: bash
run: |
cd /tmp
curl -LO https://github.com/WebAssembly/wasi-sdk/releases/download/${WASI_SDK_RELEASE}/wasi-sdk-${WASI_SDK_VERSION}-linux.tar.gz
tar xf wasi-sdk-${WASI_SDK_VERSION}-linux.tar.gz
echo "WASI_SDK_PATH=`pwd`/wasi-sdk-${WASI_SDK_VERSION}" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: Cargo Unit Tests
run: cargo test --all --no-fail-fast -- --nocapture
env:
CARGO_INCREMENTAL: 0
RUST_LOG: debug