Skip to content

Rewrite your app in Rust, piece by piece, checked against the original at every step. Works with TypeScript, JavaScript, Python, Go, Ruby, Java, C, PHP, C#, Kotlin, PowerShell and Swift.

1.3 KB
Raw Blame
name: Rust Anything gate
description: Check on every push that your Rust port still behaves like the original it replaces.
author: Erkam Yaman
branding:
  icon: check-circle
  color: gray-dark

inputs:
  crates:
    description: Crate folders made by `rust-anything bridge`, one per line or separated by spaces.
    required: false
    default: .
  version:
    description: The rust-anything version to install from npm.
    required: false
    default: latest

runs:
  using: composite
  steps:
    - name: Install rust-anything
      shell: bash
      env:
        VERSION: ${{ inputs.version }}
      run: npm install --global "rust-anything@$VERSION"
    - name: Gate every crate
      shell: bash
      env:
        CRATES: ${{ inputs.crates }}
      run: |
        if [ -z "$(printf '%s' "$CRATES" | tr -d '[:space:]')" ]; then
          echo "::error::the crates input is empty, so nothing would be gated and the step would pass. Give it the crate folders made by rust-anything bridge, e.g. crates: rust/my-port-rs"
          exit 1
        fi
        status=0
        set -f
        for crate in $CRATES; do
          echo "::group::rust-anything gate $crate"
          rust-anything gate "$crate" || status=1
          echo "::endgroup::"
        done
        exit $status