Merge pull request #8 from qonto/github-actions

Switch to github actions
This commit is contained in:
Maxime Demolin 2023-06-06 10:56:07 +02:00 committed by GitHub
commit 78fc19b10d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 73 additions and 25 deletions

35
.github/workflows/rubygems.yml vendored Normal file
View File

@ -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}}"

27
.github/workflows/tests.yml vendored Normal file
View File

@ -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

View File

@ -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

View File

@ -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 projects 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.

View File

@ -1,3 +1,3 @@
module IdempotentRequest
VERSION = "0.1.7"
VERSION = "0.2.0"
end