From ebe15a29d20b008c45c1b5d2b43c44e1c4183684 Mon Sep 17 00:00:00 2001 From: Maxime Demolin Date: Mon, 5 Jun 2023 14:42:32 +0200 Subject: [PATCH] Switch to github actions --- .github/workflows/rubygems.yml | 35 ++++++++++++++++++++++++++++++++++ .github/workflows/tests.yml | 27 ++++++++++++++++++++++++++ .travis.yml | 21 -------------------- README.md | 13 ++++++++++--- lib/version.rb | 2 +- 5 files changed, 73 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/rubygems.yml create mode 100644 .github/workflows/tests.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/rubygems.yml b/.github/workflows/rubygems.yml new file mode 100644 index 0000000..9d29a17 --- /dev/null +++ b/.github/workflows/rubygems.yml @@ -0,0 +1,35 @@ +name: Ruby Gem + +on: + push: + branches: + - master + paths: + - lib/version.rb + +jobs: + build: + name: Build and publish + runs-on: ubuntu-latest + environment: master + permissions: + contents: read + packages: write + + steps: + - uses: actions/checkout@v3 + - name: Set up Ruby 3.2 + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.2.2 + + - name: Publish to RubyGems + run: | + mkdir -p $HOME/.gem + touch $HOME/.gem/credentials + chmod 0600 $HOME/.gem/credentials + printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials + gem build *.gemspec + gem push *.gem + env: + GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..0eda563 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,27 @@ +name: Tests + +on: + push: + branches: ["master"] + pull_request: + branches: ["master"] + +permissions: + contents: read + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + ruby-version: ['3.0', '3.1', '3.2'] + + steps: + - uses: actions/checkout@v3 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + - name: Run tests + run: bundle exec rake diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 926d0ab..0000000 --- a/.travis.yml +++ /dev/null @@ -1,21 +0,0 @@ -sudo: false -language: ruby -rvm: - - 2.4.10 - - 2.5.8 - - 2.6.6 - - 2.7.1 - -jobs: - include: - - stage: gem release - rvm: 2.7.1 - deploy: - skip_cleanup: true - provider: rubygems - api_key: - secure: JOZUQM6qAYJN/N0k4UmV3jBSKMaW3oMYiZ4boPrGm7MsUY8ETHXSYR+dDhrWOvDR4Wdr6DVbTmMtXkWJHaQaM/LkrjN2FM6mTuDfmhkcvi9VBOMstptwXeHMS9fWeogtQwHyd+pKac9vUlaMhRYyoeYyJ1i6/LHua4NftZZ8oPu/9kMuKDD3Rj8zPJNui+fGcZxq90XdxjafCfRJu7EnzSZXzVi5msaEBKcUVxsHxprBjyjmp/yh/Wn0GLyBkYYXkKEUNx9DhxVtWaNG2FfOzznj3HLXQgBdz1or1tDxG8iIegC5jEj4G+gLtldLhMYWfHDaEr4iqKLF1LkjO9TK0RjcVzGNHNxCTQaDDcjgimcVNozWg707IzT5Ap6jG4Y9JWk5KY4ysOaVFqhemafoDwQcXkPb+39N/tpeBPCByCVNrZ+5lgWaHvs+iDv0X9PyAFs5nTz6/u6bz7GDZ91oJOGs9OW6szzHwkQn5TN4omdGiOFca7lviz6OyjXeSn+a6whU2DsRXxp+omrPT/gELLGl21Wd3GGTpiGAdnu/vwvoKOZqGfkr8HS/Bozc0S/vafFJ5KoPAkNQ9iwxPgL1xcEbSF5uK67T2EYVKg7z4psXDeWGBWzk8657SBCB1VCgujkmhg+lWt0TGgrckupKSyUXL4/nnAECgizSLJSbgRE= - gem: idempotent-request - on: - tags: true - repo: qonto/idempotent-request diff --git a/README.md b/README.md index c5c3b3c..bc8a095 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ -# Idempotent Request [![Build Status](https://travis-ci.org/qonto/idempotent-request.svg?branch=master)](https://travis-ci.org/qonto/idempotent-request) +![Gem Version](https://badge.fury.io/rb/idempotent-request.svg) ![CI Status](https://github.com/qonto/idempotent-request/actions/workflows/tests.yml/badge.svg) + +# Idempotent Requestidempotent-request Rack middleware ensuring at most once requests for mutating endpoints. @@ -140,11 +142,11 @@ Get notified when a client sends a request with the same idempotency key: ```ruby class RailsCallback attr_reader :request - + def initialize(request) @request = request end - + def detected(key:) Rails.logger.warn "IdempotentRequest request detected, key: #{key}" end @@ -166,3 +168,8 @@ The gem is available as open source under the terms of the [MIT License](http:// ## Code of Conduct Everyone interacting in the Idempotent::Request project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/idempotent-request/blob/master/CODE_OF_CONDUCT.md). + + +## Releasing + +To publish a new version to rubygems, update the version in `lib/version.rb`, and merge. diff --git a/lib/version.rb b/lib/version.rb index 66a5fad..975d120 100644 --- a/lib/version.rb +++ b/lib/version.rb @@ -1,3 +1,3 @@ module IdempotentRequest - VERSION = "0.1.7" + VERSION = "0.2.0" end