Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: 'Setup'
inputs:
rust-version:
description: 'The version of Rust to use in cache keys'
required: true
protoc-version:
description: 'The version of protoc to use in cache keys'
default: '28.2'
required: false
runs:
using: 'composite'
steps:
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}-${{ inputs.rust-version }}
- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}-${{ inputs.rust-version }}
- name: Cache cargo target
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-cargo-target-${{ hashFiles('**/Cargo.lock') }}-${{ inputs.rust-version }}
- name: Create protoc directory
run: mkdir -p ~/protoc
shell: bash
- name: Cache protoc
id: cache-protoc
uses: actions/cache@v4
with:
path: ~/protoc
key: ${{ runner.os }}-protoc-${{ inputs.protoc-version }}
- name: Install protoc
if: steps.cache-protoc.outputs.cache-hit != 'true'
run: |
curl -L -o protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v${{ inputs.protoc-version }}/protoc-${{ inputs.protoc-version }}-linux-x86_64.zip
unzip protoc.zip -d ~/protoc
rm protoc.zip
shell: bash
- name: Add protoc to PATH
run: echo "$HOME/protoc/bin" >> $GITHUB_PATH
shell: bash
33 changes: 33 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Coverage

on:
push:
branches: [ "main" ]
pull_request:

env:
CARGO_TERM_COLOR: always

jobs:
All:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get Rust version
id: rust-version
run: echo "rust_version=$(rustc --version)" >> "$GITHUB_OUTPUT"
- name: Run setup
uses: ./.github/actions/setup
with:
rust-version: ${{ steps.rust-version.outputs.rust_version}}
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate coverage report
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: lcov.info
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
24 changes: 24 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Publish

on:
push:
branches: [ "main" ]

jobs:
All:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get Rust version
id: rust-version
run: echo "rust_version=$(rustc --version)" >> "$GITHUB_OUTPUT"
- name: Run setup
uses: ./.github/actions/setup
with:
rust-version: ${{ steps.rust-version.outputs.rust_version}}
- name: Publish types
run: cargo publish --manifest-path types/Cargo.toml
continue-on-error: true
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
77 changes: 77 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Tests

on:
push:
branches: [ "main" ]
pull_request:

env:
CARGO_TERM_COLOR: always
UDEPS_VERSION: 0.1.50

jobs:
All:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get Rust version
id: rust-version
run: echo "rust_version=$(rustc --version)" >> "$GITHUB_OUTPUT"
- name: Run setup
uses: ./.github/actions/setup
with:
rust-version: ${{ steps.rust-version.outputs.rust_version}}
- name: Lint
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Fmt
run: cargo fmt --all -- --check
- name: Check docs
run: cargo doc --no-deps --document-private-items
env:
RUSTDOCFLAGS: "-D warnings"
- name: Run tests
run: cargo test --verbose

Dependencies:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install nightly Rust toolchain
run: rustup toolchain install nightly
- name: Get Rust version
id: rust-version
run: echo "rust_version=$(rustc +nightly --version)" >> "$GITHUB_OUTPUT"
- name: Run setup
uses: ./.github/actions/setup
with:
rust-version: ${{ steps.rust-version.outputs.rust_version}}
- name: Cache cargo-udeps
id: cargo-udeps-cache
uses: actions/cache@v4
with:
path: ~/.cargo/bin/cargo-udeps
key: ${{ runner.os }}-${{ env.UDEPS_VERSION }}-cargo-udeps-${{ steps.rust-version.outputs.rust_version }}
- name: Install cargo-udeps
if: steps.cargo-udeps-cache.outputs.cache-hit != 'true'
run: cargo +nightly install cargo-udeps --version ${{ env.UDEPS_VERSION }}
- name: Check for unused dependencies
run: cargo +nightly udeps --all-targets

WASM:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get Rust version
id: rust-version
run: echo "rust_version=$(rustc --version)" >> "$GITHUB_OUTPUT"
- name: Run setup
uses: ./.github/actions/setup
with:
rust-version: ${{ steps.rust-version.outputs.rust_version}}
- name: Add WASM target
run: rustup target add wasm32-unknown-unknown
- name: Build types
run: cargo build --target wasm32-unknown-unknown --release --manifest-path types/Cargo.toml && du -h target/wasm32-unknown-unknown/release/alto_types.wasm
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.swp
*.DS_Store
/target
*.vscode
Loading