meta-ast 0.4.0

Polyglot static-analysis engine: extract symbols and cross-language dependency graphs from 8 supported source languages, with optional MetaCall deployment manifest generation.
Documentation
name: Release Ruby Gem

on:
  workflow_dispatch:
  pull_request:
    branches:
      - master
      - develop
    paths:
      - '.github/workflows/release-ruby.yml'
      - 'source/ports/rb_port/**'
  push:
    tags:
      - 'v*'

concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: true

jobs:
  test:
    name: Ruby Port Tests
    runs-on: ${{ matrix.os }}
    strategy:
        fail-fast: false
        matrix:
          os: [ubuntu-latest, windows-latest, macos-latest]
    steps:
      - name: Check out the repo
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Install MetaCall (Unix)
        if: matrix.os != 'windows-latest'
        shell: bash
        run: |
          set +o pipefail
          curl -sL https://raw.githubusercontent.com/metacall/install/master/install.sh | sh -s -- --debug
          
          # We use the standard install path for Unix
          echo "/usr/local/lib" >> $GITHUB_PATH
          [ "${{ matrix.os }}" == "ubuntu-latest" ] && sudo ldconfig /usr/local/lib || true

      - name: Install MetaCall (Windows)
        if: matrix.os == 'windows-latest'
        shell: powershell
        run: |
          [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
          &([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://raw.githubusercontent.com/metacall/install/master/install.ps1')))
          
          # Add standard MetaCall installation directory to PATH
          $METACALL_INSTALL_PATH = "$HOME\AppData\Local\MetaCall\metacall"
          Add-Content -Path $env:GITHUB_PATH -Value "$METACALL_INSTALL_PATH" -Encoding Ascii

      - name: Set up Ruby Environment (Unix)
        if: matrix.os != 'windows-latest'
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: '3.2'
          bundler-cache: true

      - name: Run Integration Tests (Unix)
        if: matrix.os != 'windows-latest'
        working-directory: source/ports/rb_port/test
        shell: bash
        run: |
          cp ../../../scripts/python/example/source/example.py . || true
          cp ../../../scripts/ruby/hello/source/hello.rb . || true
          ruby -I../package/lib run.rb

      - name: Run Integration Tests (Windows)
        if: matrix.os == 'windows-latest'
        working-directory: source/ports/rb_port/test
        shell: pwsh
        run: |
          $PyFile = Get-ChildItem -Path "../../../" -Filter "example.py" -Recurse | Select-Object -First 1
          $RbFile = Get-ChildItem -Path "../../../" -Filter "hello.rb" -Recurse | Select-Object -First 1
          if ($PyFile) { Copy-Item $PyFile.FullName . }
          if ($RbFile) { Copy-Item $RbFile.FullName . }
          
          ruby -I../package/lib run.rb

  release:
    name: Release Ruby Port
    runs-on: ubuntu-latest
    needs: test
    if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch'
    steps:
      - name: Check out the repo
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - name: Set up Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: '3.2'
      - name: Release the port
        working-directory: source/ports/rb_port
        env:
          RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
        run: |
          chmod +x upload.sh
          ./upload.sh