Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
deploy:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event != 'schedule' }}
steps:
- uses: actions/checkout@v3
- name: Tag and Push Gem
Expand Down
26 changes: 23 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: CI

on: [push, pull_request]
on:
push:
branches:
- main
pull_request:
schedule:
- cron: "0 0 * * *"

jobs:
rspec:
Expand All @@ -10,7 +16,7 @@ jobs:
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.0.6"
- 3.1
- 3.2
- 3.3
Expand All @@ -27,7 +33,7 @@ jobs:
- name: Set up Ruby ${{ matrix.ruby }}
uses: ruby/setup-ruby@v1
with:
bundler-cache: false
bundler-cache: false
ruby-version: ${{ matrix.ruby }}
- name: Update bundler
run: gem install bundler && bundle install
Expand All @@ -45,3 +51,17 @@ jobs:
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/[email protected]
with:
payload: |
{
"text": "${{ github.repository }}/${{ github.ref }}: FAILED\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}