test: add rails 7.1, remove ruby 2.6 #78
This file contains 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: | |
release-please: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
outputs: | |
release_created: ${{ steps.release-please.outputs.release_created }} | |
tag_name: ${{ steps.release-please.outputs.tag_name }} # e.g. v1.0.0 | |
version: ${{ steps.release-please.outputs.version }} # e.g. 1.0.0 | |
all: ${{ toJSON(steps.release-please.outputs) }} | |
steps: | |
- uses: google-github-actions/release-please-action@v3 | |
id: release-please | |
with: | |
command: manifest | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 2.7 | |
- name: Install dependencies | |
run: bundle install | |
- name: Run linter | |
run: bundle exec rubocop | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
ruby_version: | |
- 2.7 | |
- "3.0" | |
- 3.1 | |
- 3.2 | |
gemfile: | |
- rails_6.1 | |
- rails_7.0 | |
- rails_7.1 | |
env: | |
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby_version }} | |
- name: Install dependencies | |
run: bundle install | |
- name: Run tests | |
run: bundle exec rspec | |
coverage: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.1 | |
- name: Install dependencies | |
run: bundle install | |
- name: Generate and publish coverage | |
uses: paambaati/[email protected] | |
env: | |
COVERAGE: "1" | |
CC_TEST_REPORTER_ID: "${{ secrets.CC_TEST_REPORTER_ID }}" | |
with: | |
coverageCommand: bundle exec rspec | |
prefix: "${{ github.workspace }}" | |
coverageLocations: | | |
${{ github.workspace }}/coverage/coverage.json:simplecov | |
release: | |
runs-on: ubuntu-latest | |
needs: [test, release-please] | |
if: needs.release-please.outputs.release_created | |
steps: | |
- uses: actions/checkout@master | |
- name: Set up Ruby | |
uses: actions/setup-ruby@v1 | |
with: | |
ruby-version: 3.1 | |
- name: Export version from tag name | |
run: echo ${{ needs.release-please.outputs.version }} > VERSION | |
- name: Build Gem | |
run: gem build *.gemspec | |
- name: Setup credentials | |
run: | | |
mkdir -p $HOME/.gem | |
touch $HOME/.gem/credentials | |
chmod 0600 $HOME/.gem/credentials | |
printf -- "---\n:rubygems_api_key: ${RUBYGEMS_API_KEY}\n" > $HOME/.gem/credentials | |
printf -- ":github: Bearer ${GITHUB_API_KEY}\n" >> $HOME/.gem/credentials | |
env: | |
RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}} | |
GITHUB_API_KEY: ${{secrets.GITHUB_TOKEN}} | |
- name: Publish to RubyGems | |
run: | | |
gem push *.gem | |
- name: Publish to GPR | |
run: | | |
gem push --key github --host https://rubygems.pkg.github.com/adamcooke *.gem |