Skip to content

run CI on a nightly schedule and notify on failure #207

run CI on a nightly schedule and notify on failure

run CI on a nightly schedule and notify on failure #207

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
schedule:
- cron: "0 0 * * *"
jobs:
rspec:
runs-on: ubuntu-latest
strategy:
matrix:
ruby:
# See comment comes from https://github.com/ruby/setup-ruby#matrix-of-ruby-versions
# Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
- "3.0.6"
- 3.1
- 3.2
- 3.3
- head
rails:
- "7.0"
- 6.1
env:
BUNDLE_GEMFILE: Gemfile
RAILS_VERSION: ${{ matrix.rails }}
name: "RSpec tests: Ruby ${{ matrix.ruby }}; Rails ${{ matrix.rails }}"
steps:
- uses: actions/checkout@v4
- name: Set up Ruby ${{ matrix.ruby }}
uses: ruby/setup-ruby@v1
with:
bundler-cache: false
ruby-version: ${{ matrix.ruby }}
- name: Update bundler
run: gem install bundler && bundle install
- name: Run tests
run: bundle exec rspec
static_type_check:
name: "Type Check"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: head
- name: Run static type checks
run: bundle exec srb tc
notify_on_failure:
runs-on: ubuntu-latest
needs: [rspec, static_type_check]
if: ${{ failure() && github.ref == 'refs/heads/main' }}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
steps:
- uses: slackapi/slack-github-action@v1.25.0
with:
payload: |
{
"text": "${{ github.repository }}/${{ github.ref }}: FAILED\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}