diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 4e23a45..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,67 +0,0 @@ -version: 2.1 - -references: - bundle_install: &bundle_install - run: - name: Bundle - command: | - gem install bundler --no-document && \ - bundle config set no-cache 'true' && \ - bundle config set jobs '4' && \ - bundle config set retry '3' && \ - bundle install - - cache_bundle: &cache_bundle - save_cache: - key: bundle-<< parameters.ruby_version >>-{{ checksum "que.gemspec" }}-{{ checksum "Gemfile" }} - paths: - - vendor/bundle - - restore_bundle: &restore_bundle - restore_cache: - key: bundle-<< parameters.ruby_version >>-{{ checksum "que.gemspec" }}-{{ checksum "Gemfile" }} - -jobs: - rspec: - working_directory: ~/que - parameters: - ruby_version: - type: string - docker: - - image: cimg/ruby:<< parameters.ruby_version >> - environment: - PGDATABASE: que-test - PGUSER: ubuntu - PGPASSWORD: password - PGHOST: localhost - LOCK_PGDATABASE: lock-test - LOCK_PGUSER: ubuntu - LOCK_PGPASSWORD: password - - image: postgres:11.2 - environment: - POSTGRES_DB: que-test - POSTGRES_USER: ubuntu - POSTGRES_PASSWORD: password - - image: postgres:11.2 - environment: - POSTGRES_DB: lock-test - POSTGRES_USER: ubuntu - POSTGRES_PASSWORD: password - steps: - - add_ssh_keys - - checkout - - *restore_bundle - - *bundle_install - - *cache_bundle - - run: - name: Run specs - command: bundle exec rspec - -workflows: - version: 2 - tests: - jobs: - - rspec: - matrix: - parameters: - ruby_version: ["2.6", "2.7", "3.0"] diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..09948b4 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,61 @@ +name: tests + +on: + push: + +jobs: + rspec: + strategy: + fail-fast: false + matrix: + ruby_version: ["2.6", "2.7", "3.0"] + postgres-version: ["12", "13", "14", "15", "16"] + + runs-on: ubuntu-latest + services: + postgres: + image: postgres:${{ matrix.postgres-version }} + env: + POSTGRES_DB: que-test + POSTGRES_USER: ubuntu + POSTGRES_PASSWORD: password + ports: + - 5432:5432 + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 10 + lock_database: + image: postgres:${{ matrix.postgres-version }} + env: + POSTGRES_DB: lock-test + POSTGRES_USER: ubuntu + POSTGRES_PASSWORD: password + ports: + - 5434:5434 + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 10 + + env: + PGDATABASE: que-test + PGUSER: ubuntu + PGPASSWORD: password + PGHOST: localhost + LOCK_PGDATABASE: lock-test + LOCK_PGUSER: ubuntu + LOCK_PGPASSWORD: password + LOCK_PGHOST: localhost + steps: + - uses: actions/checkout@v3 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + ruby-version: "${{ matrix.ruby-version }}" + - name: Run specs + run: | + bundle exec rspec \ No newline at end of file diff --git a/Gemfile b/Gemfile index 883fa4d..7d1049b 100644 --- a/Gemfile +++ b/Gemfile @@ -22,6 +22,6 @@ group :test do end gem 'prometheus-client', '~> 1.0' -gem 'prometheus_gcstat', git: 'git@github.com:gocardless/prometheus_gcstat_ruby' +# gem 'prometheus_gcstat', git: 'git@github.com:gocardless/prometheus_gcstat_ruby' gemspec diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 03fd661..39a85c5 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -43,6 +43,7 @@ def self.establish_lock_database_connection user: ENV.fetch("LOCK_PGUSER", "postgres"), password: ENV.fetch("LOCK_PGPASSWORD", ""), database: ENV.fetch("LOCK_PGDATABASE", "lock-test"), + port: ENV.fetch("LOCK_PGPORT", 5434), ) end def self.connection