From 2206f48b7c98e7bee5c9cdd14c2a357279f2f793 Mon Sep 17 00:00:00 2001 From: rick olson Date: Thu, 17 Oct 2019 10:45:21 -0600 Subject: [PATCH] replace travis config with gh actions --- .github/CONTRIBUTING.md | 69 ++++++++++++++++++++++++------------- .github/workflows/ci.yml | 73 ++++++++++++++++++++++++++++++++++++++++ .travis.yml | 53 ----------------------------- 3 files changed, 119 insertions(+), 76 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index f41a89f5..006401ba 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,37 +1,44 @@ ## Contributing -You can run the test suite against a live server by running `script/test`. It -automatically starts a test server in background. Only tests in -`test/adapters/*_test.rb` require a server, though. +In Faraday we always welcome new ideas and features, however we also have to ensure +that the overall code quality stays on reasonable levels. +For this reason, before adding any contribution to Faraday, we highly recommend reading this +quick guide to ensure your PR can be reviewed and approved as quickly as possible. + +We are pushing towards a 1.0 release, when we will have to follow [Semantic +Versioning][semver]. If your patch includes changes to break compatibility, +note that so we can add it to the [Changelog][]. -``` sh -# setup development dependencies -$ script/bootstrap -# run the whole suite -$ script/test +### Required Checks -# run only specific files -$ script/test excon patron +Before pushing your code and opening a PR, we recommend you run the following checks to avoid +our GitHub Actions Workflow to block your contribution. -# run tests using SSL -$ SSL=yes script/test +```bash +# Run unit tests and check code coverage +$ bundle exec rspec + +# Run Rubocop and check code style +$ bundle exec rubocop ``` + ### New Features -When adding a feature Faraday: +When adding a feature in Faraday: 1. also add tests to cover your new feature. 2. if the feature is for an adapter, the **attempt** must be made to add the same feature to all other adapters as well. -3. start opening an issue describing how the new feature will work, and only after receiving the green light by the core team start working on the PR. +3. start opening an issue describing how the new feature will work, and only after receiving +the green light by the core team start working on the PR. -### New Middlewares + +### New Middleware We will accept middleware that: -1. is useful to a broader audience, but can be implemented relatively - simple; and +1. is useful to a broader audience, but can be implemented relatively simple; and 2. which isn't already present in [faraday_middleware][] project. @@ -43,10 +50,26 @@ We will accept adapters that: 1. are proven and may have better performance than existing ones; or 2. if they have features not present in included adapters. -We are pushing towards a 1.0 release, when we will have to follow [Semantic -Versioning][semver]. If your patch includes changes to break compatibility, -note that so we can add it to the [Changelog][]. -[semver]: http://semver.org/ -[changelog]: https://github.com/lostisland/faraday/releases -[faraday_middleware]: https://github.com/lostisland/faraday_middleware/wiki +### Changes to Faraday Website + +The [Faraday Website][website] is included in the Faraday repository, under the `/docs` folder. +If you want to apply changes to it, please test it locally using `Jekyll`. + +```bash +# Navigate into the /docs folder +$ cd docs + +# Install Jekyll dependencies, this bundle is different from Faraday's one. +$ bundle install + +# Run the Jekyll server with the Faraday website +$ bundle exec jekyll serve + +# The site will now be reachable at http://127.0.0.1:4000/faraday/ +``` + +[semver]: http://semver.org/ +[changelog]: https://github.com/lostisland/faraday/releases +[faraday_middleware]: https://github.com/lostisland/faraday_middleware +[website]: https://lostisland.github.io/faraday diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..328446be --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,73 @@ +name: CI + +on: + pull_request: + + push: + branches: [master] + +env: + GIT_COMMIT_SHA: ${{ github.sha }} + GIT_BRANCH: ${{ github.ref }} + CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} + +jobs: + linting: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + + - name: Set up Ruby 2.6 + uses: actions/setup-ruby@v1 + with: + ruby-version: 2.6.x + + - name: Rubocop + run: | + gem install rubocop rubocop-performance --no-document + rubocop --require rubocop-performance --format progress + + - name: Yard-Junk + run: | + gem install yard-junk --no-document + yard-junk --path lib + + build: + needs: [linting] + runs-on: ubuntu-latest + strategy: + matrix: + ruby: [2.3.x, 2.4.x, 2.5.x, 2.6.x] + + steps: + - uses: actions/checkout@v1 + + - name: Install dependencies + run: | + sudo apt-get install libcurl4-openssl-dev + + - name: Set up Ruby + uses: actions/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + + - name: Build + run: | + gem install bundler + bundle install --jobs 4 --retry 3 + + - name: Setup Code Climate + if: matrix.ruby == '2.6.x' + 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 + + - name: Test + run: bundle exec rake + + - name: Run Code Climate Test Reporter + if: success() && matrix.ruby == '2.6.x' + run: ./cc-test-reporter after-build --coverage-input-type simplecov --exit-code $? + continue-on-error: true diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 2d6535f5..00000000 --- a/.travis.yml +++ /dev/null @@ -1,53 +0,0 @@ -language: ruby -script: bundle exec script/test - -rvm: - - 1.9.3 - - 2.0.0 - - 2.1.10 - - 2.2.10 - - 2.3.8 - - 2.4.5 - - 2.5.3 - - 2.6.0 - - ruby-head - - jruby-19mode - - jruby-20mode - - jruby-21mode - - jruby-head - -before_install: - - | - export RVM_CURRENT=`rvm current|cut -c6-8` - if [ "${RVM_CURRENT}" == "2.2" ]; then - gem install bundler -v '< 2' - fi - -matrix: - allow_failures: - # "A fatal error has been detected by the Java Runtime Environment: - # Internal Error (sharedRuntime.cpp:843)" - - rvm: jruby-19mode - - rvm: jruby-20mode - - rvm: jruby-21mode - - rvm: jruby-head - - rvm: ruby-head - fast_finish: true - -env: - matrix: - - SSL=no - - SSL=yes - global: - - JRUBY_OPTS="$JRUBY_OPTS --debug" -deploy: - provider: rubygems - api_key: - secure: EqbOu9BQp5jkivJ8qvTo89f3J49KOByBueU3XulrJ2Kqm/ov4RDFsmp9/uHAnSLdmKSkzZaeq79t1AUNfKGX1ZqkKgq/Nw2BKGFnh5ZOjrkrRZR1Vm09OHxqiViEbtg+jZ8VOLY/iDFEkNIzuj9/H3iHGXC0XiKH2LTHOFH63Bs= - gem: faraday - on: - tags: true - repo: lostisland/faraday - rvm: 2.4.5 - condition: '"$SSL" = "yes"' -