bio-miga/miga

View on GitHub
.github/workflows/build.yml

Summary

Maintainability
Test Coverage
name: build
on: [push, pull_request]
jobs:
  test:
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu, macos]
        ruby: ['2.7', '3.0', '3.3']
    runs-on: ${{ matrix.os }}-latest
    name: Ruby ${{ matrix.ruby }} on ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4
      - uses: ruby/setup-ruby@v1
        with:
          ruby-version: ${{ matrix.ruby }}
      - run: bundle install
      - run: bundle exec rake test
  remote-test:
    runs-on: ubuntu-latest
    name: Remote tests
    steps:
      - uses: actions/checkout@v4
      - uses: ruby/setup-ruby@v1
        with:
           ruby-version: 2.7
      - run: bundle install
      - run: bundle exec rake test
        env:
          REMOTE_TESTS: true
      - uses: paambaati/codeclimate-action@v3.2.0
        env:
          CC_TEST_REPORTER_ID: "${{ secrets.CC_MIGA_REPORTER_ID }}"
        with:
          coverageCommand: bundle exec codeclimate-test-reporter
  publish:
    if: github.event_name == 'push' && github.ref == 'refs/heads/main'
    needs: [test, remote-test]
    runs-on: ubuntu-latest
    name: Release new version
    steps:
      - uses: actions/checkout@v4
        with:
          submodules: 'recursive'
      - name: Check release candidates
        id: release
        run: |
          gem_version="$(ruby -r rubygems -e "puts Gem::Specification::load('$(ls *.gemspec)').version")"
          unset STABLE
          [[ "$gem_version" == *.rc* ]] || STABLE='true'
          echo "STABLE=${STABLE}" >> $GITHUB_OUTPUT
      - name: Tag and deploy
        id: publish
        uses: discourse/publish-rubygems-action@v2
        if: steps.release.outputs.STABLE
        env:
          RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
          GIT_EMAIL: bot@microbial-genomes.org
          GIT_NAME: Automated Release