Skip to content

Commit

Permalink
Merge pull request #154 from dxw/chore/get-latest-rails-versions
Browse files Browse the repository at this point in the history
(Chore) Get latest Rails versions
  • Loading branch information
pezholio authored May 21, 2024
2 parents f6fd42a + 8b08e8f commit 8524dcf
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 7 deletions.
31 changes: 25 additions & 6 deletions .github/workflows/rails-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,24 @@ on:
branches:
- main

env:
RAILS_VERSIONS: '["5.2.8.1", "6.1.7.6", "7.1.3.2"]'

jobs:
set-matrix:
runs-on: ubuntu-latest
name: Set Rails versions
outputs:
RAILS_VERSIONS: ${{ env.RAILS_VERSIONS }}
RAILS_VERSIONS: ${{ steps.compute-outputs.outputs.RAILS_VERSIONS }}
steps:
- name: Compute outputs
# Get latest Rails versions for 5.x.x, 6.x.x and 7.x.x
- id: compute-outputs
name: Compute outputs
run: |
echo "RAILS_VERSIONS=${{ env.RAILS_VERSIONS }}" >> $GITHUB_OUTPUT
rails_versions=$(curl https://rubygems.org/api/v1/versions/rails.json | jq 'group_by(.number[:1])[] | (.[0].number) | select(.[:1]|tonumber > 4)' | jq -s -c)
echo "RAILS_VERSIONS=$rails_versions" >> $GITHUB_OUTPUT
build-rails:
strategy:
fail-fast: false
matrix:
# Build containers with the latest 5.x.x, 6.x.x and 7.x.x Rails versions
rails: ${{ fromJSON(needs.set-matrix.outputs.RAILS_VERSIONS) }}
runs-on: ubuntu-latest
name: Build and cache Docker containers
Expand Down Expand Up @@ -53,6 +54,7 @@ jobs:
mailer-previews:
strategy:
fail-fast: false
# Run against the latest 5.x.x, 6.x.x and 7.x.x Rails versions
matrix:
rails: ${{ fromJSON(needs.set-matrix.outputs.RAILS_VERSIONS) }}
runs-on: ubuntu-latest
Expand All @@ -76,6 +78,7 @@ jobs:
sending:
strategy:
fail-fast: false
# Run against the latest 5.x.x, 6.x.x and 7.x.x Rails versions
matrix:
rails: ${{ fromJSON(needs.set-matrix.outputs.RAILS_VERSIONS) }}
runs-on: ubuntu-latest
Expand All @@ -96,3 +99,19 @@ jobs:
run: |
docker run --rm -e "NOTIFY_API_KEY=$NOTIFY_API_KEY" \
mail-notify-integration-rails-${{ matrix.rails }}:latest bin/rails test
results:
if: ${{ always() }}
runs-on: ubuntu-latest
name: All integration tests
needs:
- mailer-previews
- sending
steps:
# If any of the previous actions failed, we return a non-zero exit code
- run: exit 1
if: >-
${{
contains(needs.*.result, 'failure')
|| contains(needs.*.result, 'cancelled')
|| contains(needs.*.result, 'skipped')
}}
14 changes: 14 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,17 @@ jobs:
uses: coverallsapp/github-action@v2
with:
fail-on-error: false
results:
if: ${{ always() }}
runs-on: ubuntu-latest
name: All unit tests
needs: [ unit-tests ]
steps:
# If any of the previous actions failed, we return a non-zero exit code
- run: exit 1
if: >-
${{
contains(needs.*.result, 'failure')
|| contains(needs.*.result, 'cancelled')
|| contains(needs.*.result, 'skipped')
}}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build status](https://github.com/dxw/mail-notify/actions/workflows/ci.yml/badge.svg)](https://github.com/dxw/mail-notify/actions/workflows/ci.yml)
[![Build status](https://github.com/dxw/mail-notify/actions/workflows/unit-tests.yml/badge.svg)](https://github.com/dxw/mail-notify/actions/workflows/unit-tests.yml)
[![Coverage status](https://coveralls.io/repos/github/dxw/mail-notify/badge.svg?branch=fix-coveralls)](https://coveralls.io/github/dxw/mail-notify?branch=fix-coveralls)
[![Gem Version](http://img.shields.io/gem/v/mail-notify.svg?style=flat-square)](https://rubygems.org/gems/mail-notify)
[![Rails integration tests](https://github.com/dxw/mail-notify/actions/workflows/rails-integration-tests.yml/badge.svg)](https://github.com/dxw/mail-notify/actions/workflows/rails-integration-tests.yml)
Expand Down

0 comments on commit 8524dcf

Please sign in to comment.