update ruby client ci to complile + test on push #1
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: ci | |
| on: [push] | |
| jobs: | |
| compile: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.2' # Set to your Ruby version | |
| - name: Install dependencies | |
| run: bundle install --jobs 4 --retry 3 | |
| - name: Build gem | |
| run: bundle exec rake build | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.2' # Set to your Ruby version | |
| - name: Install dependencies | |
| run: bundle install --jobs 4 --retry 3 | |
| - name: Run tests | |
| run: bundle exec rake test # or 'bundle exec rspec' if using RSpec | |
| publish: | |
| needs: [ compile, test ] | |
| if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v3 | |
| - uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: 2.7 | |
| bundler-cache: true | |
| - name: Test gem | |
| run: bundle install && bundle exec rake test | |
| - name: Build and Push Gem | |
| env: | |
| GEM_HOST_API_KEY: ${{ secrets.RUBY_GEMS_API_KEY }} | |
| run: | | |
| gem build merge_ruby_client.gemspec | |
| gem push merge_ruby_client-*.gem --host https://rubygems.org/ |