-
Notifications
You must be signed in to change notification settings - Fork 2
162 lines (142 loc) · 4.19 KB
/
ci.yml
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: CI
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
jobs:
test:
strategy:
fail-fast: false
matrix:
rails-version:
- "7.1"
- "6.1"
- "main"
ruby-version:
- "3.1"
- "3.2"
env:
RAILS_ENV: test
RAILS_VERSION: ${{ matrix.rails-version }}
name: ${{ format('Test rails@{0} ruby@{1}', matrix.rails-version, matrix.ruby-version) }}
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true
- name: Run tests
run: bundle exec rake test
standard:
runs-on: ubuntu-latest
name: "Standard"
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.1"
bundler-cache: true
- name: Run Standard
run: bundle exec rake standard
starter_repo:
runs-on: ubuntu-latest
name: Bullet Train Starter Repo Minitest
strategy:
fail-fast: false
matrix:
# Set identifiers for parallel jobs. These can be anything.
# For instance if you want a Three Amigos themed pipeline you could use:
# ci_node_index: [Dusty, Ned, Lucky]
ci_node_index: [1,2,3,4]
services:
postgres:
image: postgres:11-alpine
ports:
- "5432:5432"
env:
POSTGRES_DB: rails_test
POSTGRES_USER: rails
POSTGRES_PASSWORD: password
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis
ports:
- "6379:6379"
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
RAILS_ENV: test
DATABASE_URL: "postgres://rails:password@localhost:5432/rails_test"
BUNDLE_JOBS: 2
BUNDLE_RETRY: 3
steps:
- name: Checkout This Repo
uses: actions/checkout@v4
- name: Checkout Starter Repo
uses: bullet-train-co/checkout-repo-with-matching-branch@v1
with:
target_dir: tmp/starter
repository: bullet-train-co/bullet_train
- name: Checkout Core Repo
uses: bullet-train-co/checkout-repo-with-matching-branch@v1
with:
target_dir: tmp/core
repository: bullet-train-co/bullet_train-core
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
working-directory: tmp/starter
bundler-cache: true
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version-file: tmp/starter/.nvmrc
cache: 'yarn'
cache-dependency-path: tmp/starter/yarn.lock
- name: Allow adding of this gem
run: bundle config unset deployment
working-directory: tmp/starter
- name: Link This Repo
uses: bullet-train-co/link-local-gem@v1
with:
application_dir: tmp/starter
local_gem_dir: .
- name: Link Core Repo
uses: bullet-train-co/link-core-gems@v1
with:
application_dir: tmp/starter
core_dir: tmp/core
- name: Set up database schema
run: bin/rails db:schema:load
working-directory: ./tmp/starter
- name: Run Tests
id: run-tests
env:
# Specifies how many jobs you would like to run in parallel,
# used for partitioning
CI_NODE_TOTAL: ${{ strategy.job-total }}
# Use the index from matrix as an environment variable
CI_NODE_INDEX: ${{ strategy.job-index }}
continue-on-error: false
run : bin/parallel-ci
working-directory: ./tmp/starter
- name: Test Summary
uses: test-summary/action@v2
with:
paths: "tmp/starter/test/reports/**/TEST-*.xml"
#output: test-summary.md
if: always()