mirror of
https://github.com/lostisland/faraday.git
synced 2025-10-04 00:02:03 -04:00
Use GitHub Actions for CI (#1051)
This commit is contained in:
parent
cccc145e2f
commit
708ca5b9ab
@ -1,164 +0,0 @@
|
||||
version: 2.1
|
||||
|
||||
# Share Steps: glued in using the YAML alias
|
||||
# See https://circleci.com/blog/circleci-hacks-reuse-yaml-in-your-circleci-config-with-yaml/
|
||||
shared_ruby_steps: &shared_ruby_steps
|
||||
parameters:
|
||||
run-cc-reporter:
|
||||
type: boolean
|
||||
default: false
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- restore_cache:
|
||||
keys:
|
||||
- "{{ .Environment.CACHE_KEY_PREFIX }}-v1-bundler-deps-{{ .Branch }}"
|
||||
- run:
|
||||
name: Bundle Install
|
||||
command: bundle install --path vendor/bundle --jobs 7 --retry 15
|
||||
- when:
|
||||
condition: << parameters.run-cc-reporter >>
|
||||
steps:
|
||||
- run:
|
||||
name: Setup Code Climate test-reporter
|
||||
command: |
|
||||
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
|
||||
- run: mkdir -p ~/test-results/rspec
|
||||
- run:
|
||||
name: Run tests
|
||||
command: bundle exec rspec --require rspec_junit_formatter --format progress --format RspecJunitFormatter --out ~/test-results/rspec/results.xml
|
||||
- when:
|
||||
condition: << parameters.run-cc-reporter >>
|
||||
steps:
|
||||
- run:
|
||||
name: Run Code Climate test-reporter
|
||||
command: ./cc-test-reporter after-build --coverage-input-type simplecov --exit-code $?
|
||||
- save_cache:
|
||||
key: "{{ .Environment.CACHE_KEY_PREFIX }}-v1-bundler-deps-{{ .Branch }}"
|
||||
paths:
|
||||
- ./vendor/bundle
|
||||
- store_test_results:
|
||||
path: ~/test-results/rspec
|
||||
- store_artifacts:
|
||||
path: ./Gemfile.lock
|
||||
- persist_to_workspace:
|
||||
root: .
|
||||
paths:
|
||||
- ./vendor/bundle
|
||||
|
||||
jobs:
|
||||
checkout_code:
|
||||
docker:
|
||||
- image: circleci/ruby:2.6
|
||||
steps:
|
||||
- checkout
|
||||
- persist_to_workspace:
|
||||
root: .
|
||||
paths:
|
||||
- .
|
||||
|
||||
linting:
|
||||
docker:
|
||||
- image: circleci/ruby:2.6
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- run: mkdir -p ~/test-results/linting
|
||||
- run:
|
||||
name: RuboCop
|
||||
command: |
|
||||
gem install rubocop rubocop-junit_formatter rubocop-performance --no-document
|
||||
rubocop --require rubocop/formatter/junit_formatter \
|
||||
--require rubocop-performance \
|
||||
--format progress \
|
||||
--format RuboCop::Formatter::JUnitFormatter \
|
||||
--out ~/test-results/linting/rubocop.xml
|
||||
when: always
|
||||
- run:
|
||||
name: Yard-Junk
|
||||
command: |
|
||||
gem install yard-junk --no-document
|
||||
yard-junk --path lib
|
||||
when: always
|
||||
- store_test_results:
|
||||
path: ~/test-results/linting
|
||||
- store_artifacts:
|
||||
path: ~/test-results/linting
|
||||
|
||||
ruby26:
|
||||
docker:
|
||||
- image: circleci/ruby:2.6
|
||||
<<: *shared_ruby_steps
|
||||
|
||||
ruby25:
|
||||
docker:
|
||||
- image: circleci/ruby:2.5
|
||||
<<: *shared_ruby_steps
|
||||
|
||||
ruby24:
|
||||
docker:
|
||||
- image: circleci/ruby:2.4
|
||||
<<: *shared_ruby_steps
|
||||
|
||||
ruby23:
|
||||
docker:
|
||||
- image: circleci/ruby:2.3
|
||||
<<: *shared_ruby_steps
|
||||
|
||||
# Currently not in use
|
||||
jruby92:
|
||||
docker:
|
||||
- image: circleci/jruby:9.2
|
||||
environment:
|
||||
JRUBY_OPTS: "--debug"
|
||||
<<: *shared_ruby_steps
|
||||
|
||||
deploy:
|
||||
docker:
|
||||
- image: circleci/ruby:2.6
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Setup Rubygems
|
||||
command: bash .circleci/setup-rubygems.sh
|
||||
|
||||
- run:
|
||||
name: Publish to Rubygems
|
||||
command: |
|
||||
gem build faraday.gemspec
|
||||
gem push "faraday-$(git describe --tags).gem"
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
test:
|
||||
jobs:
|
||||
- checkout_code
|
||||
- linting:
|
||||
requires:
|
||||
- checkout_code
|
||||
- ruby26:
|
||||
requires:
|
||||
- linting
|
||||
run-cc-reporter: true
|
||||
- ruby25:
|
||||
requires:
|
||||
- linting
|
||||
- ruby24:
|
||||
requires:
|
||||
- linting
|
||||
- ruby23:
|
||||
requires:
|
||||
- linting
|
||||
- deploy:
|
||||
requires:
|
||||
- ruby23
|
||||
- ruby24
|
||||
- ruby25
|
||||
- ruby26
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
branches:
|
||||
ignore: /.*/
|
@ -1,15 +0,0 @@
|
||||
|
||||
#
|
||||
# "Publishing RubyGems using Circle CI 2.0" explains how this works:
|
||||
#
|
||||
# https://medium.com/@pezholio/publishing-rubygems-using-circle-ci-2-0-1dbf06ae9942
|
||||
#
|
||||
# - Get an API key from your profile page at RubyGems.org
|
||||
# - Add the API key as an Environment variable in your repo’s CircleCI
|
||||
# Project Settings/Build Settings/Environment Variables
|
||||
# - Have this script execute in the deploy stage of the CI build
|
||||
# - Now you can "gem push"
|
||||
|
||||
mkdir ~/.gem
|
||||
echo -e "---\r\n:rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials
|
||||
chmod 0600 /home/circleci/.gem/credentials
|
2
.github/CONTRIBUTING.md
vendored
2
.github/CONTRIBUTING.md
vendored
@ -13,7 +13,7 @@ note that so we can add it to the [Changelog][].
|
||||
### Required Checks
|
||||
|
||||
Before pushing your code and opening a PR, we recommend you run the following checks to avoid
|
||||
our CircleCI Workflow to block your contribution.
|
||||
our GitHub Actions Workflow to block your contribution.
|
||||
|
||||
```bash
|
||||
# Run unit tests and check code coverage
|
||||
|
68
.github/workflows/ci.yml
vendored
Normal file
68
.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
name: CI
|
||||
|
||||
on: [push]
|
||||
|
||||
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 $?
|
29
.github/workflows/publish.yml
vendored
Normal file
29
.github/workflows/publish.yml
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
name: Publish
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Publish to Rubygems
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
|
||||
- name: Set up Ruby 2.6
|
||||
uses: actions/setup-ruby@v1
|
||||
with:
|
||||
version: 2.6.x
|
||||
|
||||
- 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 faraday.gemspec
|
||||
gem push faraday-*.gem
|
||||
env:
|
||||
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_AUTH_TOKEN }}
|
@ -1,7 +1,7 @@
|
||||
# 
|
||||
|
||||
[](https://rubygems.org/gems/faraday)
|
||||
[](https://circleci.com/gh/lostisland/faraday/tree/master)
|
||||

|
||||
[](https://codeclimate.com/github/lostisland/faraday/test_coverage)
|
||||
[](https://codeclimate.com/github/lostisland/faraday/maintainability)
|
||||
[](https://gitter.im/lostisland/faraday?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||
@ -18,7 +18,7 @@ Need more details? See the [Faraday API Documentation][apidoc] to see how it wor
|
||||
|
||||
## Supported Ruby versions
|
||||
|
||||
This library aims to support and is [tested against][circle_ci] the following Ruby
|
||||
This library aims to support and is [tested against][actions] the following Ruby
|
||||
implementations:
|
||||
|
||||
* Ruby 2.3+
|
||||
@ -49,7 +49,7 @@ But before you start coding, please read our [Contributing Guide][contributing]
|
||||
[faraday_team]: https://lostisland.github.io/faraday/team
|
||||
[contributing]: https://github.com/lostisland/faraday/blob/master/.github/CONTRIBUTING.md
|
||||
[apidoc]: http://www.rubydoc.info/gems/faraday
|
||||
[circle_ci]: https://circleci.com/gh/lostisland/faraday
|
||||
[actions]: https://github.com/lostisland/faraday/actions
|
||||
[jruby]: http://jruby.org/
|
||||
[rubinius]: http://rubini.us/
|
||||
[license]: LICENSE.md
|
||||
|
Loading…
x
Reference in New Issue
Block a user