From 125a3efad0d97e51e462ff5528f4f5b5b517fefa Mon Sep 17 00:00:00 2001 From: Samir Tapiero Date: Tue, 13 Feb 2024 12:21:24 -0500 Subject: [PATCH 1/8] Replace TravisCI to Actions' --- .github/workflows/linter.yml | 25 ++++++++++++++++++++ .github/workflows/test.yml | 44 ++++++++++++++++++++++++++++++++++++ .travis.yml | 28 ----------------------- 3 files changed, 69 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/linter.yml create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml new file mode 100644 index 0000000..db0211e --- /dev/null +++ b/.github/workflows/linter.yml @@ -0,0 +1,25 @@ +name: Linter + +on: + pull_request: + branches: ["master", "main"] + + push: + branches: ["master", "main"] + +jobs: + linter: + 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.6 + bundler-cache: true + + - name: Run linter + run: bundle exec rake code_analysis diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..3f9a8e9 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,44 @@ +name: Test + +on: + pull_request: + branches: ["master", "main"] + + push: + branches: ["master", "main"] + +jobs: + test: + runs-on: ubuntu-latest + container: ${{ matrix.ruby }} + env: + CC_TEST_REPORTER_ID: cb01575b98b3b80848a3bc292ca6145860871470e5d0669453030d36578f9115 + 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: Setup Code Climate test-reporter + run: | + 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 + if: matrix.coverage + - name: Bundle install + run: bundle install -j$(nproc) --retry 3 + - name: Run tests + run: bundle exec rspec + timeout-minutes: 1 + - name: Publish code coverage + run: | + export GIT_BRANCH="${GITHUB_REF/refs\/heads\//}" + ./cc-test-reporter after-build -r ${{env.CC_TEST_REPORTER_ID}} + if: matrix.coverage 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 From 59c23d5a116ea3cfdcdfa6fa6a5565ce63252dea Mon Sep 17 00:00:00 2001 From: Samir Tapiero Date: Tue, 13 Feb 2024 12:45:55 -0500 Subject: [PATCH 2/8] Replace codeclimate report way --- .github/workflows/test.yml | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3f9a8e9..0d4c592 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,19 +26,18 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - - name: Setup Code Climate test-reporter - run: | - 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 - if: matrix.coverage - name: Bundle install run: bundle install -j$(nproc) --retry 3 - name: Run tests run: bundle exec rspec timeout-minutes: 1 - - name: Publish code coverage - run: | - export GIT_BRANCH="${GITHUB_REF/refs\/heads\//}" - ./cc-test-reporter after-build -r ${{env.CC_TEST_REPORTER_ID}} - if: matrix.coverage + if: !matrix.coverage + - name: Test & publish code coverage + uses: paambaati/codeclimate-action@v3.0.0 + env: + CC_TEST_REPORTER_ID: ${{ env.CC_TEST_REPORTER_ID }} + with: + coverageCommand: bundle exec rspec + coverageLocations: ${{ github.workspace }}/coverage/coverage.json:simplecov + debug: true + if: matrix.coverage From beaddb6b6c3b84d4dbcef46828de6c5415ef5efb Mon Sep 17 00:00:00 2001 From: Samir Tapiero Date: Tue, 13 Feb 2024 12:48:50 -0500 Subject: [PATCH 3/8] Re enable test runner --- .github/workflows/test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0d4c592..4b98a5c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,7 +31,6 @@ jobs: - name: Run tests run: bundle exec rspec timeout-minutes: 1 - if: !matrix.coverage - name: Test & publish code coverage uses: paambaati/codeclimate-action@v3.0.0 env: From ace189d7929a18dfa35da03910da20df0afe16d9 Mon Sep 17 00:00:00 2001 From: Samir Tapiero Date: Tue, 13 Feb 2024 12:56:32 -0500 Subject: [PATCH 4/8] Fix CI, update README.md --- .github/workflows/test.yml | 2 +- README.md | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4b98a5c..108ff37 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,10 +33,10 @@ jobs: timeout-minutes: 1 - name: Test & publish code coverage uses: paambaati/codeclimate-action@v3.0.0 + if: matrix.coverage env: CC_TEST_REPORTER_ID: ${{ env.CC_TEST_REPORTER_ID }} with: coverageCommand: bundle exec rspec coverageLocations: ${{ github.workspace }}/coverage/coverage.json:simplecov debug: true - if: matrix.coverage diff --git a/README.md b/README.md index 6d70c55..a749610 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # 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) [![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 +20,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 +37,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 +145,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 +170,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). From 0ad5b90d67982af64b4d5e435e668d70d98645db Mon Sep 17 00:00:00 2001 From: Samir Tapiero Date: Tue, 13 Feb 2024 13:07:56 -0500 Subject: [PATCH 5/8] Add validation to push coverage only on master --- .github/workflows/test.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 108ff37..ad14310 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,8 +11,6 @@ jobs: test: runs-on: ubuntu-latest container: ${{ matrix.ruby }} - env: - CC_TEST_REPORTER_ID: cb01575b98b3b80848a3bc292ca6145860871470e5d0669453030d36578f9115 strategy: fail-fast: false matrix: @@ -33,9 +31,9 @@ jobs: timeout-minutes: 1 - name: Test & publish code coverage uses: paambaati/codeclimate-action@v3.0.0 - if: matrix.coverage + if: matrix.coverage && github.ref == 'refs/heads/master' env: - CC_TEST_REPORTER_ID: ${{ env.CC_TEST_REPORTER_ID }} + CC_TEST_REPORTER_ID: cb01575b98b3b80848a3bc292ca6145860871470e5d0669453030d36578f9115 with: coverageCommand: bundle exec rspec coverageLocations: ${{ github.workspace }}/coverage/coverage.json:simplecov From 3e4dd3a6d5a043fc44e4def9a557d243370f6924 Mon Sep 17 00:00:00 2001 From: Samir Tapiero Date: Thu, 15 Feb 2024 11:36:56 -0500 Subject: [PATCH 6/8] Move use only one workflow ci, add CI badge in README --- .github/workflows/{test.yml => ci.yml} | 17 ++++++++++++++++- .github/workflows/linter.yml | 25 ------------------------- README.md | 1 + 3 files changed, 17 insertions(+), 26 deletions(-) rename .github/workflows/{test.yml => ci.yml} (75%) delete mode 100644 .github/workflows/linter.yml diff --git a/.github/workflows/test.yml b/.github/workflows/ci.yml similarity index 75% rename from .github/workflows/test.yml rename to .github/workflows/ci.yml index ad14310..1f62740 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: Test +name: CI on: pull_request: @@ -8,6 +8,21 @@ on: branches: ["master", "main"] jobs: + linter: + 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.6 + bundler-cache: true + + - name: Run linter + run: bundle exec rake code_analysis test: runs-on: ubuntu-latest container: ${{ matrix.ruby }} diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml deleted file mode 100644 index db0211e..0000000 --- a/.github/workflows/linter.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Linter - -on: - pull_request: - branches: ["master", "main"] - - push: - branches: ["master", "main"] - -jobs: - linter: - 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.6 - bundler-cache: true - - - name: Run linter - run: bundle exec rake code_analysis diff --git a/README.md b/README.md index a749610..3c8f9bb 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # AppleAuth [![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) From a9281d757436c2e1515cf013c66dac381dfb56e9 Mon Sep 17 00:00:00 2001 From: Samir Tapiero Date: Mon, 19 Feb 2024 09:10:57 -0500 Subject: [PATCH 7/8] Rename job process --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1f62740..74d7238 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ on: branches: ["master", "main"] jobs: - linter: + linters: runs-on: ubuntu-latest name: linter/ruby steps: @@ -21,7 +21,7 @@ jobs: ruby-version: 2.6 bundler-cache: true - - name: Run linter + - name: Run linters run: bundle exec rake code_analysis test: runs-on: ubuntu-latest From dee7aa94efbabc7aaeba6bc06a0fa8ec8580448e Mon Sep 17 00:00:00 2001 From: Samir Tapiero <50454914+blacksam07@users.noreply.github.com> Date: Fri, 1 Mar 2024 12:31:51 -0500 Subject: [PATCH 8/8] Update ci.yml --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 74d7238..6f3e3f5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: 2.6 + ruby-version: 2.7 bundler-cache: true - name: Run linters @@ -45,7 +45,7 @@ jobs: run: bundle exec rspec timeout-minutes: 1 - name: Test & publish code coverage - uses: paambaati/codeclimate-action@v3.0.0 + uses: paambaati/codeclimate-action@v5.0.0 if: matrix.coverage && github.ref == 'refs/heads/master' env: CC_TEST_REPORTER_ID: cb01575b98b3b80848a3bc292ca6145860871470e5d0669453030d36578f9115