Skip to content

Commit

Permalink
build: add ci workflow which replicates circleci config
Browse files Browse the repository at this point in the history
This is close to a 1-1 replica of functionality.

Changes:
- Removed code climate coverage reports as we don't have the
integration setup
  • Loading branch information
jmpage committed Dec 7, 2023
1 parent f4babfe commit 417de61
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 98 deletions.
92 changes: 0 additions & 92 deletions .circleci/config.yml

This file was deleted.

84 changes: 84 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: CI
on:
pull_request:
push:
branches: [ main ]

env:
branch: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref_name }}

jobs:
lint:
name: Lint (Ruby ${{ matrix.ruby }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby: [ '2.7' ] # FU: Build against common ruby 3.x minor versions

steps:
- name: Checkout the code
uses: actions/checkout@v4

- name: Install Ruby ${{ matrix.ruby }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}

- name: Install dependencies
run: bundle install

- name: Run Rubocop
run: bundle exec rubocop

test:
name: Test (Ruby ${{ matrix.ruby }}, activerecord ${{ matrix.activerecord }}, pg ${{ matrix.pg }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
activerecord: [ '6.1', '7.0' ]
pg: [ '1.1', '1.2' ] # FU: Build against common pg 1.x minor versions
ruby: [ '2.7' ] # FU: Build against common ruby 3.x minor versions
timeout-minutes: 10
needs:
- lint

env:
PGUSER: postgres

services:
postgres:
image: postgres:11.3 # FU: Test against newer postgres image
env:
POSTGRES_USER: postgres
POSTGRES_DB: postgres_pub_sub_test
POSTGRES_HOST_AUTH_METHOD: trust
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

steps:
- name: Checkout the code
uses: actions/checkout@v4

- name: Install Ruby ${{ matrix.ruby }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}

- name: Install postgresql-client
run: sudo apt update && sudo apt install postgresql-client

- name: Install dependencies
run: bundle install

- name: Install appraisal
run: bundle exec appraisal install

- name: Appraise rails-${{ matrix.activerecord }}_pg-${{ matrix.pg }}
run: bundle exec appraisal rails-${{ matrix.activerecord }}_pg-${{ matrix.pg }} rspec
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# activerecord-postgres_pub_sub

[![CircleCI](https://circleci.com/gh/ezcater/activerecord-postgres_pub_sub.svg?style=svg)](https://circleci.com/gh/ezcater/activerecord-postgres_pub_sub)

This gem contains support for PostgreSQL LISTEN and NOTIFY functionality:
[doc](https://www.postgresql.org/docs/9.6/static/libpq-notify.html).

Expand Down
2 changes: 1 addition & 1 deletion activerecord-postgres_pub_sub.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
end

excluded_files = %w(.circleci/config.yml
excluded_files = %w(.github/workflows/ci.yml
.github/PULL_REQUEST_TEMPLATE.md
.gitignore
.rspec
Expand Down
7 changes: 4 additions & 3 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@
puts "Testing with Postgres version: #{pg_version}"
puts "Testing with ActiveRecord #{ActiveRecord::VERSION::STRING}"

`dropdb --if-exists #{DATABASE_NAME} 2> /dev/null`
`createdb #{DATABASE_NAME}`

host = ENV.fetch("PGHOST", "localhost")
port = ENV.fetch("PGPORT", 5432)

`dropdb -h #{host} -p #{port} --if-exists #{DATABASE_NAME} 2> /dev/null`
`createdb -h #{host} -p #{port} #{DATABASE_NAME}`

database_url = "postgres://#{host}:#{port}/#{DATABASE_NAME}"
puts "Using database #{database_url}"
ActiveRecord::Base.establish_connection(database_url)
Expand Down

0 comments on commit 417de61

Please sign in to comment.