-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (76 loc) · 2.07 KB
/
ci.yml
File metadata and controls
77 lines (76 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: CI
on:
workflow_call:
inputs:
test-command:
description: 'The command to run tests'
required: false
type: string
default: 'bundle exec rspec'
linter-command:
description: 'The command to run the linter'
required: false
type: string
default: 'bundle exec rubocop'
jobs:
run_tests:
runs-on: ubuntu-latest
strategy:
matrix:
ruby:
- 3.2
- 3.3
- 3.4
- 4.0
env:
BUNDLE_GEMFILE: Gemfile
name: "Run tests: Ruby ${{ matrix.ruby }}"
steps:
- uses: actions/checkout@v4
- name: Install ripgrep
run: sudo apt-get install -y ripgrep
- name: Set up Ruby ${{ matrix.ruby }}
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: ${{ matrix.ruby }}
- name: Run tests
run: ${{ inputs.test-command }}
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: 3.4
- name: Run static type checks
run: bundle exec srb tc
run_linter:
runs-on: ubuntu-latest
name: "Linter"
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: 3.4
- name: Run linter
run: ${{ inputs.linter-command }}
notify_on_failure:
runs-on: ubuntu-latest
needs: [run_tests, static_type_check, run_linter]
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 }}"
}