From e0c8ba889782a9e3b17c9ad140b7216b3d889189 Mon Sep 17 00:00:00 2001 From: Patrick Oscity Date: Thu, 19 Sep 2024 23:25:18 +0200 Subject: [PATCH] Use matrix to reduce duplication in CI workflow --- .github/workflows/ci.yml | 200 +++++++-------------------------------- 1 file changed, 35 insertions(+), 165 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5ca24a53..e68f6dae 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,182 +22,52 @@ jobs: bundler-cache: true - name: Run rubocop run: bundle exec rubocop --parallel --format progress - - grape-17: - runs-on: ubuntu-latest - needs: ['rubocop'] - env: - GRAPE_VERSION: '1.7.1' + test: strategy: matrix: - ruby-version: ['3.0', '3.1', '3.2', '3.3', 'head'] - steps: - - name: Check out branch - uses: actions/checkout@v4 - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby-version }} - - name: Run rspec wo model parser - run: | - bundle update - bundle exec rspec - - name: Run rspec w entity parser - env: - MODEL_PARSER: grape-swagger-entity - run: | - bundle update - bundle exec rspec - - name: Run rspec w representable parser - env: - MODEL_PARSER: grape-swagger-representable - run: | - bundle update - bundle exec rspec - - grape-18: + entry: + - { ruby: '3.0', grape: '1.7.1' } + - { ruby: '3.1', grape: '1.7.1' } + - { ruby: '3.2', grape: '1.7.1' } + - { ruby: '3.3', grape: '1.7.1' } + - { ruby: 'head', grape: '1.7.1' } + - { ruby: '3.0', grape: '1.8.0' } + - { ruby: '3.1', grape: '1.8.0' } + - { ruby: '3.2', grape: '1.8.0' } + - { ruby: '3.3', grape: '1.8.0' } + - { ruby: 'head', grape: '1.8.0' } + - { ruby: '3.0', grape: '2.0.0' } + - { ruby: '3.1', grape: '2.0.0' } + - { ruby: '3.2', grape: '2.0.0' } + - { ruby: '3.3', grape: '2.0.0' } + - { ruby: 'head', grape: '2.0.0' } + - { ruby: '3.0', grape: '2.1.3' } + - { ruby: '3.1', grape: '2.1.3' } + - { ruby: '3.2', grape: '2.1.3' } + - { ruby: '3.3', grape: '2.1.3' } + - { ruby: 'head', grape: '2.1.3' } + - { ruby: '3.0', grape: '2.2.0' } + - { ruby: '3.1', grape: '2.2.0' } + - { ruby: '3.2', grape: '2.2.0' } + - { ruby: '3.3', grape: '2.2.0' } + - { ruby: 'head', grape: '2.2.0' } + - { ruby: '3.0', grape: 'HEAD' } + - { ruby: '3.1', grape: 'HEAD' } + - { ruby: '3.2', grape: 'HEAD' } + - { ruby: '3.3', grape: 'HEAD' } + - { ruby: 'head', grape: 'HEAD' } + name: test (ruby=${{ matrix.entry.ruby }}, grape=${{ matrix.entry.grape }}) runs-on: ubuntu-latest needs: ['rubocop'] env: - GRAPE_VERSION: '1.8.0' - strategy: - matrix: - ruby-version: ['3.0', '3.1', '3.2', '3.3', 'head'] - steps: - - name: Check out branch - uses: actions/checkout@v4 - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby-version }} - - name: Run rspec wo model parser - run: | - bundle update - bundle exec rspec - - name: Run rspec w entity parser - env: - MODEL_PARSER: grape-swagger-entity - run: | - bundle update - bundle exec rspec - - name: Run rspec w representable parser - env: - MODEL_PARSER: grape-swagger-representable - run: | - bundle update - bundle exec rspec - - grape-20: - runs-on: ubuntu-latest - needs: ['rubocop'] - env: - GRAPE_VERSION: '2.0.0' - strategy: - matrix: - ruby-version: ['3.0', '3.1', '3.2', '3.3', 'head'] - steps: - - name: Check out branch - uses: actions/checkout@v4 - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby-version }} - - name: Run rspec wo model parser - run: | - bundle update - bundle exec rspec - - name: Run rspec w entity parser - env: - MODEL_PARSER: grape-swagger-entity - run: | - bundle update - bundle exec rspec - - name: Run rspec w representable parser - env: - MODEL_PARSER: grape-swagger-representable - run: | - bundle update - bundle exec rspec - - grape-21: - runs-on: ubuntu-latest - needs: ['rubocop'] - env: - GRAPE_VERSION: '2.1.3' - strategy: - matrix: - ruby-version: ['3.0', '3.1', '3.2', '3.3', 'head'] - steps: - - name: Check out branch - uses: actions/checkout@v4 - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby-version }} - - name: Run rspec wo model parser - run: | - bundle update - bundle exec rspec - - name: Run rspec w entity parser - env: - MODEL_PARSER: grape-swagger-entity - run: | - bundle update - bundle exec rspec - - name: Run rspec w representable parser - env: - MODEL_PARSER: grape-swagger-representable - run: | - bundle update - bundle exec rspec - - grape-22: - runs-on: ubuntu-latest - needs: ['rubocop'] - env: - GRAPE_VERSION: '2.2.0' - strategy: - matrix: - ruby-version: ['3.0', '3.1', '3.2', '3.3', 'head'] - steps: - - name: Check out branch - uses: actions/checkout@v4 - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby-version }} - - name: Run rspec wo model parser - run: | - bundle update - bundle exec rspec - - name: Run rspec w entity parser - env: - MODEL_PARSER: grape-swagger-entity - run: | - bundle update - bundle exec rspec - - name: Run rspec w representable parser - env: - MODEL_PARSER: grape-swagger-representable - run: | - bundle update - bundle exec rspec - - grape-HEAD: - runs-on: ubuntu-latest - needs: ['rubocop'] - env: - GRAPE_VERSION: 'HEAD' - strategy: - matrix: - ruby-version: ['3.0', '3.1', '3.2', '3.3', 'head'] + GRAPE_VERSION: ${{ matrix.entry.grape }} steps: - name: Check out branch uses: actions/checkout@v4 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: ${{ matrix.ruby-version }} + ruby-version: ${{ matrix.entry.ruby }} - name: Run rspec wo model parser run: | bundle update