name: CI on: push: branches: [ master ] pull_request: branches: [ master ] release: types: [created] jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: ruby-version: 2.6 - name: Install dependencies run: bundle install - name: Run tests run: bundle exec rake test spec audit - name: Upload results for coverage uses: actions/upload-artifact@v1 with: name: coverage path: coverage/ coverage: needs: [ test ] name: coverage runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Download tests result from test uses: actions/download-artifact@v1 with: name: coverage - name: Install Code Climate test-reporter run: | curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter chmod +x ./cc-test-reporter - name: Format code coverage env: GIT_BRANCH: ${{ github.ref }} GIT_COMMIT_SHA: ${{ github.sha }} run: | export GIT_COMMITTED_AT="$(date +%s)" ./cc-test-reporter format-coverage -d -t simplecov -o coverage/codeclimate.json coverage/.resultset.json - name: Publish code coverage env: GIT_BRANCH: ${{ github.ref }} GIT_COMMIT_SHA: ${{ github.sha }} run: | export GIT_COMMITTED_AT="$(date +%s)" ./cc-test-reporter upload-coverage -d -r ${{secrets.CC_TEST_REPORTER_ID}} publish: needs: [ test ] name: publish runs-on: ubuntu-latest if: contains(github.ref, '/tags/v') steps: - uses: actions/checkout@v2 - name: Set up Ruby 2.6 uses: actions/setup-ruby@v1 with: version: 2.6.x - name: Publish to RubyGems env: GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}} run: | mkdir -p $HOME/.gem touch $HOME/.gem/credentials chmod 0600 $HOME/.gem/credentials printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials gem build *.gemspec gem push *.gem