fix(rust): decimal validation now accepts strings per spec #24
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Ruby SDK | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| paths: | |
| - 'ruby/**' | |
| - 'c/**' | |
| - '.github/workflows/ruby.yml' | |
| tags: | |
| - 'v[0-9]+.[0-9]+.[0-9]+' | |
| pull_request: | |
| branches: [ main, master ] | |
| paths: | |
| - 'ruby/**' | |
| - 'c/**' | |
| - '.github/workflows/ruby.yml' | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| name: Test Ruby ${{ matrix.ruby }} on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| permissions: | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| ruby: ['3.2', '3.3', '3.4'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: ${{ matrix.ruby }} | |
| bundler-cache: false | |
| working-directory: ruby | |
| - name: Install CMake (Ubuntu) | |
| if: runner.os == 'Linux' | |
| run: sudo apt-get update && sudo apt-get install -y cmake | |
| - name: Install CMake (macOS) | |
| if: runner.os == 'macOS' | |
| run: brew install cmake | |
| - name: Build C library (for CI testing only - production uses pre-built binaries) | |
| working-directory: c | |
| run: | | |
| mkdir -p build | |
| cd build | |
| cmake .. -DCMAKE_BUILD_TYPE=Release -DJS_BUILD_SHARED=ON -DJS_BUILD_TESTS=OFF -DJS_BUILD_EXAMPLES=OFF | |
| cmake --build . | |
| - name: Copy C library to ext directory | |
| run: | | |
| mkdir -p ruby/ext | |
| if [ "$RUNNER_OS" == "macOS" ]; then | |
| cp c/build/libjson_structure.dylib ruby/ext/ | |
| else | |
| cp c/build/libjson_structure.so ruby/ext/ | |
| fi | |
| - name: Install Ruby dependencies | |
| working-directory: ruby | |
| run: | | |
| gem install bundler | |
| bundle install | |
| - name: Run tests | |
| working-directory: ruby | |
| run: bundle exec rspec | |
| lint: | |
| name: Lint Ruby code | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.2' | |
| bundler-cache: false | |
| working-directory: ruby | |
| - name: Install dependencies | |
| working-directory: ruby | |
| run: | | |
| gem install bundler | |
| bundle install | |
| - name: Run RuboCop | |
| working-directory: ruby | |
| run: bundle exec rubocop --parallel | |
| continue-on-error: true | |
| publish: | |
| name: Publish to RubyGems | |
| runs-on: ubuntu-latest | |
| needs: [test, lint] | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| permissions: | |
| contents: read | |
| id-token: write # Required for RubyGems trusted publishing (OIDC) | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.2' | |
| bundler-cache: false | |
| working-directory: ruby | |
| - name: Extract version from tag | |
| id: version | |
| run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
| - name: Update version.rb from tag | |
| working-directory: ruby | |
| run: | | |
| VERSION="${{ steps.version.outputs.VERSION }}" | |
| sed -i "s/VERSION = '.*'/VERSION = '$VERSION'/" lib/jsonstructure/version.rb | |
| cat lib/jsonstructure/version.rb | |
| - name: Verify version matches gemspec | |
| working-directory: ruby | |
| run: | | |
| GEMSPEC_VERSION=$(ruby -e "puts Gem::Specification.load('jsonstructure.gemspec').version") | |
| TAG_VERSION="${{ steps.version.outputs.VERSION }}" | |
| if [ "$GEMSPEC_VERSION" != "$TAG_VERSION" ]; then | |
| echo "Version mismatch: gemspec=$GEMSPEC_VERSION, tag=$TAG_VERSION" | |
| exit 1 | |
| fi | |
| echo "Version verified: $GEMSPEC_VERSION" | |
| - name: Build gem | |
| working-directory: ruby | |
| run: gem build jsonstructure.gemspec | |
| - name: Configure RubyGems trusted publishing | |
| uses: rubygems/configure-rubygems-credentials@main | |
| - name: Publish to RubyGems | |
| working-directory: ruby | |
| run: | | |
| gem push jsonstructure-${{ steps.version.outputs.VERSION }}.gem |