Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup github actions #52

Merged
merged 3 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
69 changes: 69 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: RSpec CI
on:
push:
branches:
- 'main'
- '*-maintenance'
- '*-dev'
- 'pr-*'
pull_request:
branches:
- '*'
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
test:
name: 'Ruby: ${{ matrix.ruby }}, Rails: ${{ matrix.env.RAILS_VERSION }}'
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
include:
- ruby: '3.2'
- ruby: '3.1'
- ruby: '3.0'
- ruby: 2.7
- ruby: 2.6
- ruby: 2.5
- ruby: 2.3
- ruby: 2.2
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- run: script/update_rubygems_and_install_bundler
- run: bundle install --binstubs
- run: script/run_build

legacy:
name: Legacy Ruby Builds (${{ matrix.container.version }})
runs-on: ubuntu-20.04
container:
image: ${{ matrix.container.tag }}
options: ${{ matrix.container.options || '--add-host github-complains-if-this-is-empty.com:127.0.0.1' }}
strategy:
fail-fast: false
matrix:
include:
- container:
version: "2.1.9"
tag: ghcr.io/rspec/docker-ci:2.1.9
post: git config --global --add safe.directory `pwd`
- container:
version: "2.0"
tag: ghcr.io/rspec/docker-ci:2.0.0
- container:
version: "1.9.3"
tag: ghcr.io/rspec/docker-ci:1.9.3
env:
LEGACY_CI: true
steps:
- uses: actions/checkout@v3
- run: script/legacy_setup.sh
- run: ${{ matrix.container.post }}
- run: script/run_build
28 changes: 0 additions & 28 deletions .travis.yml

This file was deleted.

3 changes: 1 addition & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ gemspec
if File.exist?(library_path) && !ENV['USE_GIT_REPOS']
gem lib, :path => library_path
else
gem lib, :git => "git://github.com/rspec/#{lib}.git",
:branch => ENV.fetch('BRANCH',"main")
gem lib, :git => "https://github.com/rspec/#{lib}.git", :branch => ENV.fetch('BRANCH', 'main')
end
end

Expand Down
4 changes: 4 additions & 0 deletions lib/rspec/collection_matchers/have.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ def relativities
}
end

def supports_value_expectations?
true
end

if RUBY_VERSION == '1.9.2'
# On Ruby 1.9.2 items that don't return an array for `to_ary`
# can't be flattened in arrays, we need to be able to do this
Expand Down
19 changes: 19 additions & 0 deletions script/legacy_setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
# This file was generated on 2023-06-26T13:27:27+01:00 from the rspec-dev repo.
# DO NOT modify it by hand as your changes will get lost the next time it is generated.

set -e

bundle install --standalone --binstubs --without coverage documentation

if [ -x ./bin/rspec ]; then
echo "RSpec bin detected"
else
if [ -x ./exe/rspec ]; then
cp ./exe/rspec ./bin/rspec
echo "RSpec restored from exe"
else
echo "No RSpec bin available"
exit 1
fi
fi
1 change: 0 additions & 1 deletion script/test_all → script/run_build
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@ echo "Running cucumber specs"
# shells out (via aruba) and executes `rspec`--which can pick up the wrong
# rspec version if we're not running with bundler.
bundle exec cucumber

33 changes: 33 additions & 0 deletions script/update_rubygems_and_install_bundler
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

set -e

function is_ruby_31_plus {
if ruby -e "exit(RUBY_VERSION.to_f >= 3.1)"; then
return 0
else
return 1
fi
}

function is_ruby_23_plus {
if ruby -e "exit(RUBY_VERSION.to_f >= 2.3)"; then
return 0
else
return 1
fi
}

if is_ruby_31_plus; then
echo "Installing rubygems 3.3.6 / bundler 2.3.6"
yes | gem update --system '3.3.6'
yes | gem install bundler -v '2.3.6'
elif is_ruby_23_plus; then
echo "Installing rubygems 3.2.22 / bundler 2.2.22"
yes | gem update --system '3.2.22'
yes | gem install bundler -v '2.2.22'
else
echo "Warning installing older versions of Rubygems / Bundler"
gem update --system '2.7.8'
gem install bundler -v '1.17.3'
fi