diaspora_federation/.github/workflows/ci.yml
Benjamin Neff 3dbf0488dd
Allow to test for multiple rails versions in CI
Before we only tested with the latest rails version and without rails,
that made it possible to accidentally break with older rails versions
without noticing it.

The old way of keeping separate Gemfiles (and lockfiles) was too
complicated to keep up to date, especially with many supported rails
versions. This allows now to run with different rails version with just
the same Gemfile using an env-var.

For CI the Gemfile.lock is only used for the latest rails version (7.0
at the moment), as it obviously doesn't fit for other versions. I think
that's fine, as if we are not compatible with a too new version of
something, we need to add a maximum version there anyway.

The `ruby/setup-ruby@v1` step automatically uses the deployment mode
when a Gemfile.lock is present, so the `BUNDLE_FROZEN` env-var is not
required, even if a Gemfile.lock is used.
2023-06-11 18:41:20 +02:00

47 lines
1.1 KiB
YAML

name: CI
on:
push:
branches:
- develop
- main
- master
pull_request:
jobs:
test:
name: 'Ruby: ${{ matrix.ruby }}, Rails: ${{ matrix.rails }}'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby:
- "3.1"
- "3.0"
- "2.7"
rails:
- "7.0"
- "6.1"
- "6.0"
- "5.2"
- "none"
exclude:
- ruby: "3.1"
rails: "5.2"
- ruby: "3.0"
rails: "5.2"
env:
RAILS_VERSION: ${{ matrix.rails }}
BUNDLE_WITHOUT: development
BUNDLE_DISABLE_SHARED_GEMS: true
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
steps:
- uses: actions/checkout@v2
- name: Delete Gemfile.lock
run: rm Gemfile.lock
if: matrix.rails != '7.0' # Gemfile.lock is only generated for latest rails version
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run tests
run: test/scripts/ci.sh