-
Notifications
You must be signed in to change notification settings - Fork 20
65 lines (54 loc) · 1.51 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
name: Continuous Integration
on:
push:
branches:
- main
pull_request:
jobs:
build:
name: Build and Test
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: ruby_au
POSTGRES_PASSWORD: ruby_au
POSTGRES_DB: ruby_au_test
ports:
- 5432:5432
options: "--health-cmd \"pg_isready --host=localhost --username=ruby_au\" --health-interval 10s --health-timeout 5s --health-retries 5"
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: .ruby-version
bundler-cache: true
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: yarn
- name: Install dependencies
run: |
yarn install
bundle install
- name: Prepare assets
run: |
bin/vite build
bundle exec rails assets:precompile
- name: Lint Ruby code
run: bundle exec rubocop
- name: Wait for Database
run: |
until pg_isready --host=127.0.0.1 --port=5432 --username=ruby_au; do
echo "Waiting for database..."
sleep 1
done
echo "Database is ready!"
- name: Run Tests
env:
DATABASE_URL: postgres://ruby_au:[email protected]:5432/ruby_au_test
run: bundle exec rspec