From 802d156efce63118245d75552da5d39735a997db Mon Sep 17 00:00:00 2001 From: Mike Moore Date: Mon, 30 Oct 2023 22:50:23 -0600 Subject: [PATCH] Add Github Actions CI --- .github/workflows/ci.yml | 65 ++++++++++++++++++++++++++++++++++++++++ .rubocop.yml | 2 ++ 2 files changed, 67 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..a1eb5fc --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,65 @@ +--- +name: Ruby CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + test: + name: test + + runs-on: ubuntu-latest + if: | + !( contains(github.event.pull_request.title, '[ci skip]') + || contains(github.event.pull_request.title, '[skip ci]')) + + strategy: + matrix: + ruby-version: ['3.2', '3.1', '3.0', '2.7'] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Ruby ${{ matrix.ruby-version }} + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + bundler-cache: true + + - name: Install dependencies + run: bundle install + + - name: Run tests + run: | + ruby -v + bundle -v + bundle exec rake test + + rubocop: + name: rubocop + + runs-on: ubuntu-latest + if: | + !( contains(github.event.pull_request.title, '[ci skip]') + || contains(github.event.pull_request.title, '[skip ci]')) + + steps: + - uses: actions/checkout@v4 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: '2.7' + bundler-cache: true + + - name: Install dependencies + run: bundle install + + - name: Run Rubocop + run: | + ruby -v + bundle -v + bundle exec rubocop -v + bundle exec rubocop diff --git a/.rubocop.yml b/.rubocop.yml index 67f0b44..d9fc4e1 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,9 +1,11 @@ AllCops: NewCops: enable SuggestExtensions: false + TargetRubyVersion: 2.7 Exclude: - "doc/**/*" - "pkg/**/*" + - "vendor/**/*" - "minitest-rg.gemspec" - "Rakefile" - "Gemfile"