name: Ruby Install Tests on: push: branches: - main - '[0-9]+.x' pull_request: branches: - main - '[0-9]+.x' workflow_dispatch: jobs: test_ruby_gems: name: Test ruby gems runs-on: ubuntu-20.04 strategy: fail-fast: false matrix: include: - { ruby: 2.6, bazel: 6.0.0} - { ruby: 2.7, bazel: 6.0.0} - { ruby: 3.0, bazel: 6.0.0} - { ruby: 3.1, bazel: 6.0.0} - { ruby: 3.2, bazel: 6.0.0} - { ruby: jruby-9.2, bazel: 6.0.0} - { ruby: jruby-9.3, bazel: 6.0.0} - { ruby: 2.6, bazel: 5.1.1} - { ruby: jruby-9.2, bazel: 5.1.1} steps: - uses: actions/checkout@v2 - name: Install bazel run: | sudo apt-get install -qy wget mkdir $HOME/bin wget -O $HOME/bin/bazel https://github.com/bazelbuild/bazel/releases/download/${{ matrix.bazel }}/bazel-${{ matrix.bazel }}-linux-x86_64 chmod a+x $HOME/bin/bazel - name: Install git run: | sudo apt-get install -qy --no-install-recommends git - name: Install ruby uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} - name: Checkout uses: actions/checkout@v3 with: submodules: recursive - name: Build cruby gem run: $HOME/bin/bazel build ruby:release if: ${{ !contains(matrix.ruby, 'jruby') }} - name: Install cruby gem run: gem install bazel-bin/ruby/google-protobuf-* if: ${{ !contains(matrix.ruby, 'jruby') }} - name: Build jruby gem run: $HOME/bin/bazel build ruby:jruby_release if: ${{ contains(matrix.ruby, 'jruby') }} - name: Install jruby gem run: gem install bazel-bin/ruby/google-protobuf-* if: ${{ contains(matrix.ruby, 'jruby') }} - name: Test installation run: | bazel run //:protoc -- --proto_path=$GITHUB_WORKSPACE/src --proto_path=$GITHUB_WORKSPACE/ruby/tests --proto_path=$GITHUB_WORKSPACE/ruby --ruby_out=$GITHUB_WORKSPACE/ruby tests/test_import_proto2.proto bazel run //:protoc -- --proto_path=$GITHUB_WORKSPACE/src --proto_path=$GITHUB_WORKSPACE/ruby/tests --proto_path=$GITHUB_WORKSPACE/ruby --ruby_out=$GITHUB_WORKSPACE/ruby tests/basic_test.proto ruby ruby/tests/basic.rb