Skip to content

Commit

Permalink
Merge pull request #131 from FundingCircle/migrate-to-gh-actions
Browse files Browse the repository at this point in the history
Fix rails 7.1 support and migrate to github actions
  • Loading branch information
bliof-fc authored Feb 13, 2024
2 parents 0c3bbdd + a3b204f commit 0a39c78
Show file tree
Hide file tree
Showing 63 changed files with 1,123 additions and 452 deletions.
112 changes: 0 additions & 112 deletions .circleci/config.yml

This file was deleted.

72 changes: 72 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Build & Test
run-name: Build & Test - ${{ github.ref_name }}

on:
push:
branches:
- '**'

jobs:
version-check:
runs-on: ubuntu-latest
if: "!contains(github.ref, 'master')"
steps:
- name: Checkout commit
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Gem versioned correctly
shell: sh
run: |
CHANGED=$(git diff origin/master HEAD --name-only | grep 'lib/loga') || exit 0
[[ -z "$CHANGED" ]] || (echo "$CHANGED" | grep 'version.rb') || exit 1
rubocop:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true

- name: Run RuboCop
run: bundle exec rubocop

build-and-test:
runs-on: ubuntu-latest
services:
redis:
image: redis:7
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
strategy:
matrix:
ruby-version: ['2.7', '3.0', '3.1', '3.2', '3.3', 'head']
steps:
- name: Check out repository code
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 appraisal gems
run: bundle exec appraisal install

- name: Test with RACK_ENV=development
run: RACK_ENV=development bundle exec appraisal rspec

- name: Test with RACK_ENV=production
run: RACK_ENV=production bundle exec appraisal rspec
28 changes: 28 additions & 0 deletions .github/workflows/publish-gem.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Deploy to RubyGems
run-name: ${{ github.actor }} is publishing a new version

on:
release:
types: [published]

jobs:
publish-gem:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true

- name: Build gem
run: gem build loga.gemspec

- name: Publish gem
env:
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
run: |
gem push loga-*.gem
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
inherit_from: .rubocop_todo.yml

AllCops:
TargetRubyVersion: 2.7
NewCops: enable
Exclude:
- '*.gemspec'
- 'gemfiles/*'
Expand Down
Loading

0 comments on commit 0a39c78

Please sign in to comment.