Skip to content

Commit

Permalink
Merge pull request #225 from sue445/feature/ci_docker
Browse files Browse the repository at this point in the history
Use docker ruby instead of rbenv
  • Loading branch information
sue445 committed Jan 19, 2020
2 parents 4795eab + 24acddf commit b71e872
Showing 1 changed file with 21 additions and 67 deletions.
88 changes: 21 additions & 67 deletions .github/workflows/test.yml
Expand Up @@ -7,71 +7,33 @@ on:

env:
CI: "true"
RUBYOPT: -EUTF-8

jobs:
test:
runs-on: ${{ matrix.runner }}
runs-on: ubuntu-latest

container: ${{ matrix.ruby }}

strategy:
fail-fast: false

matrix:
ruby:
- 2.2.2
- 2.3.0
- 2.4.0
- 2.5.0
- 2.6.0
- 2.7.0
- 2.8.0-dev
- ruby:2.2
- ruby:2.3
- ruby:2.4
- ruby:2.5
- ruby:2.6
- ruby:2.7
- rubylang/ruby:master-nightly-bionic
include:
- ruby: 2.2.2
runner: ubuntu-16.04
- ruby: 2.3.0
runner: ubuntu-16.04
- ruby: 2.4.0
runner: ubuntu-latest
- ruby: 2.5.0
runner: ubuntu-latest
- ruby: 2.6.0
runner: ubuntu-latest
- ruby: 2.7.0
runner: ubuntu-latest
- ruby: 2.8.0-dev
runner: ubuntu-latest
- ruby: rubylang/ruby:master-nightly-bionic
allow_failures: "true"

steps:
- uses: actions/checkout@v2

- name: Set up rbenv
uses: masa-iwasaki/setup-rbenv@1.1.0

- name: Cache RBENV_ROOT
uses: actions/cache@v1
id: cache_rbenv
with:
path: ~/.rbenv/versions
key: v1-rbenv-${{ runner.os }}-${{ matrix.ruby }}
if: "!endsWith(matrix.ruby, '-dev')"

- name: Reinstall libssl-dev
run: |
set -xe
sudo apt-get remove -y libssl-dev
sudo apt-get install -y libssl-dev=1.0.2g-1ubuntu4.15
if: matrix.runner == 'ubuntu-16.04'

- name: Install Ruby
run: |
set -xe
eval "$(rbenv init -)"
rbenv install -s $RBENV_VERSION
gem install bundler --no-document -v 1.17.3 || true
env:
RBENV_VERSION: ${{ matrix.ruby }}
continue-on-error: ${{ endsWith(matrix.ruby, '-dev') }}

- name: Cache vendor/bundle
uses: actions/cache@v1
id: cache_gem
Expand All @@ -80,52 +42,44 @@ jobs:
key: v1-gem-${{ runner.os }}-${{ matrix.ruby }}-${{ github.sha }}
restore-keys: |
v1-gem-${{ runner.os }}-${{ matrix.ruby }}-
continue-on-error: ${{ endsWith(matrix.ruby, '-dev') }}
continue-on-error: ${{ matrix.allow_failures == 'true' }}

- name: bundle update
run: |
set -xe
eval "$(rbenv init -)"
bundle config path vendor/bundle
bundle update --jobs $(nproc) --retry 3
env:
RBENV_VERSION: ${{ matrix.ruby }}
continue-on-error: ${{ endsWith(matrix.ruby, '-dev') }}
continue-on-error: ${{ matrix.allow_failures == 'true' }}

- name: Setup Code Climate Test Reporter
uses: aktions/codeclimate-test-reporter@v1
with:
codeclimate-test-reporter-id: ${{ secrets.CC_TEST_REPORTER_ID }}
command: before-build
continue-on-error: ${{ endsWith(matrix.ruby, '-dev') }}
if: matrix.ruby >= 'ruby:2.4'
continue-on-error: ${{ matrix.allow_failures == 'true' }}

- name: Run test
run: |
set -xe
eval "$(rbenv init -)"
bundle exec rspec
bundle exec ruby examples/all.rb
env:
RBENV_VERSION: ${{ matrix.ruby }}
continue-on-error: ${{ endsWith(matrix.ruby, '-dev') }}
continue-on-error: ${{ matrix.allow_failures == 'true' }}

- name: Teardown Code Climate Test Reporter
uses: aktions/codeclimate-test-reporter@v1
with:
codeclimate-test-reporter-id: ${{ secrets.CC_TEST_REPORTER_ID }}
command: after-build
if: always()
continue-on-error: ${{ endsWith(matrix.ruby, '-dev') }}
if: matrix.ruby >= 'ruby:2.4' && always()
continue-on-error: ${{ matrix.allow_failures == 'true' }}

- name: Run lint
run: |
set -xe
eval "$(rbenv init -)"
bundle exec rubocop
bundle exec rubydoctest README.md
env:
RBENV_VERSION: ${{ matrix.ruby }}
continue-on-error: ${{ endsWith(matrix.ruby, '-dev') }}
continue-on-error: ${{ matrix.allow_failures == 'true' }}

- name: Slack Notification (not success)
uses: homoluctus/slatify@v2.0.0
Expand Down

0 comments on commit b71e872

Please sign in to comment.