wasm-rquickjs-cli 0.0.21

Tool for wrapping JavaScript modules as WebAssembly components using the QuickJS engine
name: CI

on:
  push:
    tags:
      - "v*.*.*"
    branches:
      - main
  pull_request:

permissions:
  checks: write
  pull-requests: write

env:
  CARGO_TERM_COLOR: always

jobs:
  build:
    runs-on: blacksmith-16vcpu-ubuntu-2404
    steps:
      - uses: actions/checkout@v3
      - uses: useblacksmith/rust-cache@v3
        with:
          prefix-key: v1-rust
          shared-key: debug
          cache-all-crates: true
      - name: Setup Rust
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          override: true
      - uses: cargo-bins/cargo-binstall@main
      - name: Install cargo-component
        run: cargo binstall --force --locked cargo-component@0.21.1
      - name: Check formatting
        run: cargo fmt -- --check
      - name: Clippy
        run: cargo clippy -- -Dwarnings
      - name: Build
        run: cargo build --all-features --all-targets
  test:
    needs: [ build ]
    runs-on: blacksmith-16vcpu-ubuntu-2404
    steps:
      - uses: actions/checkout@v3
      - uses: useblacksmith/rust-cache@v3
        with:
          prefix-key: v1-rust
          shared-key: debug
          cache-all-crates: true
      - name: Setup Rust
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          override: true
      - uses: cargo-bins/cargo-binstall@main
      - name: Install cargo-component
        run: cargo binstall --force --locked cargo-component@0.21.1
      - name: Tests
        run: cargo test -- --nocapture --test-threads=1 --report-time
      - name: Publish Test Report
        uses: mikepenz/action-junit-report@v5
        if: success() || failure() # always run even if the previous step fails
        with:
          report_paths: '**/target/report-*.xml'
          detailed_summary: true
          include_passed: true
  publish:
    needs: [ test ]
    if: "startsWith(github.ref, 'refs/tags/v')"
    runs-on: blacksmith-16vcpu-ubuntu-2404
    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          submodules: true
      - name: Setup Rust
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          override: true
      - name: Install Protoc
        uses: arduino/setup-protoc@v3
        with:
          repo-token: ${{ secrets.GITHUB_TOKEN }}
      - id: get_version
        uses: battila7/get-version-action@v2
      - name: Publish crates
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
        run: |
          export VERSION="${{ steps.get_version.outputs.version-without-v }}"
          sed -i "s/0.0.0/$VERSION/g" Cargo.toml        
          cargo publish -p wasm-rquickjs --all-features --allow-dirty
          cargo publish -p wasm-rquickjs-cli --all-features --allow-dirty