-
Notifications
You must be signed in to change notification settings - Fork 239
129 lines (113 loc) · 3.42 KB
/
rubyonrails.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
name: Ruby on Rails CI
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
test:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}-test
cancel-in-progress: true
timeout-minutes: 2
services:
postgres:
image: postgres:16.1
ports:
- "5432:5432"
env:
POSTGRES_DB: hostedgpt_test
POSTGRES_USER: rails
POSTGRES_PASSWORD: password
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
RAILS_ENV: test
DATABASE_URL: "postgres://rails:password@localhost:5432/hostedgpt_test"
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Set up database schema
run: bin/rails db:prepare
- name: Build CSS
run: bin/rails tailwindcss:build
- name: Run tests
run: bin/rails test
system_tests:
if: github.repository == 'AllYourBot/hostedgpt'
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}-system
cancel-in-progress: true
services:
postgres:
image: postgres:16.1
ports:
- "5432:5432"
env:
POSTGRES_DB: hostedgpt_test
POSTGRES_USER: rails
POSTGRES_PASSWORD: password
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
RAILS_ENV: test
DATABASE_URL: "postgres://rails:password@localhost:5432/hostedgpt_test"
DISPLAY: "=:99"
CHROME_VERSION: "127.0.6533.119"
steps:
- name: Install Chrome
run: |
# Download specific Chrome version
wget https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}-1_amd64.deb
# Install Chrome
sudo apt-get install -y --allow-downgrades ./google-chrome-stable_${CHROME_VERSION}-1_amd64.deb
- uses: nanasess/setup-chromedriver@v2
- name: Start chromedriver
run: |
set -x
chromedriver --url-base=/wd/hub &
# sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # optional
- name: Checkout code
uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Set up database schema
run: bin/rails db:prepare
- name: Build CSS
run: bin/rails tailwindcss:build
- name: Run system tests
run: |
sed -i 's/hoverOnlyWhenSupported: true/hoverOnlyWhenSupported: false/' config/tailwind.config.js
PARALLEL_WORKERS=2 bin/rails test:system
- name: Upload screenshots
uses: actions/upload-artifact@v4
if: failure()
with:
name: System Test Screenshots
path: tmp/screenshots/
if-no-files-found: ignore
lint:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}-lint
cancel-in-progress: true
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Lint Ruby files
run: bin/rubocop