diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index cc463b1..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,97 +0,0 @@ ---- -version: 2.1 -orbs: - browser-tools: circleci/browser-tools@1.2.5 -jobs: - build: - working_directory: ~/webhooks-demo - docker: - # specify the version you desire here - - image: cimg/ruby:3.1.2-browsers - # Specify service dependencies here if necessary - # CircleCI maintains a library of pre-built images - # documented at https://circleci.com/developer/images/image/cimg/ruby - environment: - POSTGRES_HOST: localhost - POSTGRES_USER: webhooks-demo - POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} - - image: cimg/postgres:11.15 - environment: - POSTGRES_USER: webhooks-demo - POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} - - steps: - - checkout - - browser-tools/install-chrome - - browser-tools/install-chromedriver - - run: - command: | - google-chrome --version - chromedriver --version - name: Check browser install - - # Update to Bundler 2 https://discuss.circleci.com/t/using-bundler-2-0-during-ci-fails/27411 - - run: - name: install dependencies - command: | - gem update --system - gem install bundler - - # Download and cache dependencies - - restore_cache: - keys: - - v1-dependencies-{{ checksum "Gemfile.lock" }} - # fallback to using the latest cache if no exact match is found - - v1-dependencies- - - - run: dockerize -wait tcp://localhost:5432 -timeout 1m - - - run: &install-dependencies - name: install dependencies - command: | - bin/setup - - - save_cache: - paths: - - ./vendor/bundle - key: v1-dependencies-{{ checksum "Gemfile.lock" }} - - # run tests! - - run: &run-tests - name: run tests - command: | - mkdir --parents /tmp/test-results - TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | \ - circleci tests split --split-by=timings)" - - bundle exec rspec \ - --format progress \ - --format RspecJunitFormatter \ - --out /tmp/test-results/rspec.xml \ - --format progress \ - $TEST_FILES - - run: - name: Checkout merge commit - command: | - set -ex - if [[ -n "${CIRCLE_PULL_REQUEST}" ]] - then - git pull --ff-only origin "refs/pull/${CIRCLE_PULL_REQUEST//*pull\//}/merge" - fi - - run: *install-dependencies - - run: - <<: *run-tests - name: run tests after merge - - # collect reports - - store_test_results: - path: /tmp/test-results - - store_artifacts: - path: /tmp/test-results - destination: test-results - -workflows: - version: 2 - workflow: - jobs: - - build diff --git a/.github/workflows/webhooks-demo.yml b/.github/workflows/webhooks-demo.yml new file mode 100644 index 0000000..a08f6b6 --- /dev/null +++ b/.github/workflows/webhooks-demo.yml @@ -0,0 +1,41 @@ +name: Webhooks Demo +on: + push: +jobs: + test: + runs-on: ubuntu-latest + env: + PGHOST: localhost + RAILS_ENV: test + services: + postgres: + image: postgres:11 + env: + POSTGRES_USER: webhooks-demo + POSTGRES_HOST_AUTH_METHOD: trust + POSTGRES_DB: webhooks-consumer-demo-test + ports: + - 5432:5432 + # Set health checks to wait until postgres has started + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + name: Setup env & run tests + steps: + + - name: Checkout repo + uses: actions/checkout@v3 + + - uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + + - name: Setup + run: bin/setup + + - name: Run Rspec test + run: bundle exec rspec --format doc + diff --git a/app.json b/app.json index 5b87f4b..59f0e58 100644 --- a/app.json +++ b/app.json @@ -2,7 +2,7 @@ "name": "Heroku Webhooks Demo", "logo": "https://raw.githubusercontent.com/heroku/webhooks-demo/master/app/assets/images/heroku_webhooks.png", "repository": "https://github.com/heroku/webhooks-demo", - "addons": ["heroku-postgresql:hobby-dev"], + "addons": ["heroku-postgresql:mini"], "env": { "WEBHOOK_SECRET": { "description": "secret used to check webhook signing", diff --git a/config/database.yml b/config/database.yml index c1ff946..3619a2b 100644 --- a/config/database.yml +++ b/config/database.yml @@ -20,7 +20,7 @@ default: &default # For details on connection pooling, see Rails configuration guide # http://guides.rubyonrails.org/configuring.html#database-pooling pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> - <% if ENV["CIRCLECI"] %> + <% if ENV["CI"] %> username: webhooks-demo host: localhost <% end %>