diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..6f3e3f5 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,55 @@ +name: CI + +on: + pull_request: + branches: ["master", "main"] + + push: + branches: ["master", "main"] + +jobs: + linters: + runs-on: ubuntu-latest + name: linter/ruby + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.7 + bundler-cache: true + + - name: Run linters + run: bundle exec rake code_analysis + test: + runs-on: ubuntu-latest + container: ${{ matrix.ruby }} + strategy: + fail-fast: false + matrix: + include: + - ruby: ruby:2.5 + - ruby: ruby:2.6 + - ruby: ruby:2.7 + - ruby: ruby:3.0 + coverage: true + name: test/ruby ${{ matrix.ruby }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Bundle install + run: bundle install -j$(nproc) --retry 3 + - name: Run tests + run: bundle exec rspec + timeout-minutes: 1 + - name: Test & publish code coverage + uses: paambaati/codeclimate-action@v5.0.0 + if: matrix.coverage && github.ref == 'refs/heads/master' + env: + CC_TEST_REPORTER_ID: cb01575b98b3b80848a3bc292ca6145860871470e5d0669453030d36578f9115 + with: + coverageCommand: bundle exec rspec + coverageLocations: ${{ github.workspace }}/coverage/coverage.json:simplecov + debug: true diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 272a430..0000000 --- a/.travis.yml +++ /dev/null @@ -1,28 +0,0 @@ -language: ruby - -rvm: - - 2.5.0 - - 2.6.0 - - ruby-head - -dist: bionic - -jobs: - allow_failures: - - rvm: ruby-head - -env: - global: - - CC_TEST_REPORTER_ID=cb01575b98b3b80848a3bc292ca6145860871470e5d0669453030d36578f9115 - -before_script: - - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter - - chmod +x ./cc-test-reporter - - ./cc-test-reporter before-build - -script: - - bundle exec rake code_analysis - - bundle exec rspec - -after_script: - - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT diff --git a/README.md b/README.md index 6d70c55..3c8f9bb 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # AppleAuth -[![CI](https://api.travis-ci.com/rootstrap/apple_auth.svg?branch=master)](https://travis-ci.com/github/rootstrap/apple_auth) +[![Gem Version](https://badge.fury.io/rb/apple_auth.svg)](https://badge.fury.io/rb/apple_auth) +![CI](https://github.com/rootstrap/apple_auth/actions/workflows/ci.yml/badge.svg?branch=master) [![Maintainability](https://api.codeclimate.com/v1/badges/78453501221a76e3806e/maintainability)](https://codeclimate.com/github/rootstrap/apple_sign_in/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/78453501221a76e3806e/test_coverage)](https://codeclimate.com/github/rootstrap/apple_sign_in/test_coverage) @@ -20,13 +21,14 @@ Or install it yourself: $ gem install apple_auth ------------------- +--- After installing the gem, you need to run this generator. $ rails g apple_auth:config This will generate a new initializer: `apple_auth.rb` with the following default configuration: + ```ruby AppleAuth.configure do |config| # config.apple_client_id = @@ -36,9 +38,10 @@ AppleAuth.configure do |config| # config.redirect_uri = end ``` + Set your different credentials in the file by uncommenting the lines and adding your keys. ------------------- +--- ## Usage @@ -143,6 +146,7 @@ An example `$ rails g apple_auth:apple_auth_controller api/v1/` This will generate a new controller: `controllers/api/v1/apple_auth_controller.rb`. You should configure the route, you can wrap it in the devise_scope block like: + ``` devise_scope :user do resource :user, only: %i[update show] do @@ -167,7 +171,6 @@ To install this gem onto your local machine, run `bundle exec rake install`. To Bug reports and pull requests are welcome on GitHub at https://github.com/rootstrap/apple_auth/issues. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/rootstrap/apple_auth/blob/master/CODE_OF_CONDUCT.md). - ## License The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).