From a4d5bed2a95696a3a25dd39300aff334454da286 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Tue, 7 Dec 2021 23:51:44 +0100 Subject: [PATCH] Run integration tests on GitHub Actions --- .github/workflows/integrations.yml | 47 ++++++++++++++++++++++++++++++ Rakefile | 4 +-- 2 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/integrations.yml diff --git a/.github/workflows/integrations.yml b/.github/workflows/integrations.yml new file mode 100644 index 00000000..9d99e07a --- /dev/null +++ b/.github/workflows/integrations.yml @@ -0,0 +1,47 @@ +name: Integration tests + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + test: + name: Integration tests + runs-on: ubuntu-latest + + strategy: + matrix: + ruby-version: ['2.5', '2.6', '2.7', '3.0'] + fixture: [ '{rails6}', '{rails7}' ] + experimental: [false] + + include: + - ruby-version: 'head' + fixture: '{rails6}' + experimental: true + - ruby-version: 'head' + fixture: '{rails7}' + experimental: true + + exclude: + - ruby-version: '2.5' + fixture: '{rails7}' + - ruby-version: '2.6' + fixture: '{rails7}' + + env: + FIXTURE: ${{ matrix.fixture }} + + continue-on-error: ${{ matrix.experimental }} + + steps: + - uses: actions/checkout@v2 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + bundler-cache: true + - name: Run tests + run: bundle exec rake test:clean test:setup test:fixtures diff --git a/Rakefile b/Rakefile index d54eaaee..54c156e4 100644 --- a/Rakefile +++ b/Rakefile @@ -21,7 +21,7 @@ end # rake test:setup # rake test:full -fixture_list = "{padrino_test,sinatra_test,rails2,rails3,rails3_2,rails4,rails5,rails5_api,rails6,rails7}" +fixture_list = ENV['FIXTURE'] || "{padrino_test,sinatra_test,rails2,rails3,rails3_2,rails4,rails5,rails5_api,rails6,rails7}" desc "Clean up the fixtures being tested by cleaning and installing dependencies" task "test:clean" do @@ -52,7 +52,7 @@ task "test:fixtures" do Dir[File.dirname(__FILE__) + "/fixtures/#{fixture_list}"].each do |fixture| puts "\n*** Running tests for #{File.basename(fixture)}... ***\n" Bundler.with_clean_env { - Dir.chdir(fixture) { puts `bundle check; bundle exec rake test:rabl` } + Dir.chdir(fixture) { sh 'bundle check; bundle exec rake test:rabl' } } end end