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
59 changes: 59 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: CI

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

env:
CARGO_TERM_COLOR: always

jobs:
lint:
name: Format + Clippy
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy

# Caching to increase performance as dependency tree grows
- uses: Swatinem/rust-cache@v2

- name: Check formatting
run: cargo fmt --all -- --check

- name: Run clippy
run: cargo clippy --all-features --all-targets -- -D warnings

# Run CLI across OS targets
build_and_test:
name: Build + Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest, macos-latest]

steps:
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@stable

# Caching per OS
- uses: Swatinem/rust-cache@v2

# TODO: Remove the dependency on wasm-tools when have time.
- name: Install wasm-tools
run: |
cargo install wasm-tools --version 1.235.0 --locked

- name: Build
run: cargo build --locked --verbose

- name: Run tests
run: cargo test --locked --all-features --verbose
49 changes: 32 additions & 17 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,45 @@
name: Deploy

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

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: write # To push a branch
pages: write # To push to a GitHub Pages site
id-token: write # To update the deployment status
contents: write # To push a branch
pages: write # To push to GitHub Pages
id-token: write # To update the deployment status

steps:
# Checkout repo
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build Doc
run: |
rustup toolchain install nightly
RUSTDOCFLAGS="--enable-index-page -Z unstable-options" cargo +nightly doc --no-deps
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3

# Cache Rust crates to speed up builds
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
key: cargo-${{ hashFiles('**/Cargo.lock') }}

# Setup Rust nightly (or use rust-toolchain.toml)
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
profile: minimal
override: true

# Build documentation
- name: Build docs
env:
RUSTDOCFLAGS: "--enable-index-page -Z unstable-options"
run: cargo +nightly doc --no-deps

# Deploy to GitHub Pages
- uses: actions/deploy-pages@v4
with:
# Upload entire repository
path: 'target/doc'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
artifact-path: target/doc
37 changes: 26 additions & 11 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,41 @@
name: Publish

on:
pull_request:
types:
- closed
branches:
- main
push:
tags:
- "v*"

env:
CARGO_TERM_COLOR: always

jobs:
publish:
name: Publish to crates.io
runs-on: ubuntu-latest
if: startsWith(github.event.pull_request.head.ref, 'release-v')

steps:
- name: cargo login
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@stable

- name: Login to crates.io
run: cargo login ${{ secrets.WIRM_API_TOKEN }}

- name: Validate publish
run: cargo publish --locked --dry-run

- name: Publish
run: cargo publish --locked

release:
name: Create GitHub Release
needs: publish
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Publish Update
run: cargo publish
- name: Create Release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65 changes: 65 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Release

on:
workflow_dispatch:
inputs:
bump:
description: "Version bump type"
required: true
type: choice
options:
- major
- minor
- patch

env:
CARGO_TERM_COLOR: always

jobs:
release:
name: Bump and Create Release PR
runs-on: ubuntu-latest

# Gives write permission to commit toml changes
permissions:
contents: write
pull-requests: write

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: dtolnay/rust-toolchain@stable

# Install cargo-edit (provides cargo set-version)
- name: Install cargo-edit
run: cargo install cargo-edit

# Bump version using official cargo-edit tool
- name: Bump Version
run: cargo set-version --bump ${{ github.event.inputs.bump }}

# Extract version cleanly using cargo metadata (more robust than grep)
- name: Extract Version
id: version
run: |
version=$(cargo metadata --no-deps --format-version 1 \
| jq -r '.packages[] | select(.name=="wirm") | .version')
echo "version=$version" >> $GITHUB_OUTPUT

- name: Create branch, commit, and PR
run: |
git config --global user.email "action@github.com"
git config --global user.name "GitHub Action"

git checkout -b release-v${{ steps.version.outputs.version }}
git add Cargo.toml Cargo.lock
git commit -m "Release v${{ steps.version.outputs.version }}"
git push --set-upstream origin release-v${{ steps.version.outputs.version }}

gh pr create \
--title "Release v${{ steps.version.outputs.version }}" \
--body "Creating release for wirm v${{ steps.version.outputs.version }}"
env:
GH_TOKEN: ${{ github.token }}
43 changes: 0 additions & 43 deletions .github/workflows/release_major.yml

This file was deleted.

43 changes: 0 additions & 43 deletions .github/workflows/release_minor.yml

This file was deleted.

43 changes: 0 additions & 43 deletions .github/workflows/release_patch.yml

This file was deleted.

Loading