-
Notifications
You must be signed in to change notification settings - Fork 34
81 lines (69 loc) · 2.25 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
name: CI
on:
push:
branches:
- main
pull_request:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
bundler: default
bundler-cache: true
rubygems: latest
- name: Lint code
run: bin/rubocop -f github
test:
runs-on: ubuntu-latest
steps:
- name: SQLite3 version
run: sqlite3 --version
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
bundler: default
bundler-cache: true
rubygems: latest
- name: Setup database
run: |
bundle exec rake db:create
bundle exec rake db:schema:load
- name: Load fixtures
run: bundle exec rake db:fixtures:load
- name: Cache Chromedriver
uses: actions/cache@v4
with:
path: ~/chromedriver
key: chromedriver-${{ hashFiles('**/.github/workflows/ci_tests.yml') }}
restore-keys: |
chromedriver-
- name: Setup Chrome and Chromedriver
run: |
mkdir -p ~/chromedriver
CACHED_VERSION=$(cat ~/chromedriver/version.txt || echo "")
LATEST_VERSION=$(curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE)
if [ "$LATEST_VERSION" != "$CACHED_VERSION" ]; then
echo "Downloading Chromedriver $LATEST_VERSION..."
wget -N http://chromedriver.storage.googleapis.com/$LATEST_VERSION/chromedriver_linux64.zip -P ~/chromedriver/
unzip -o ~/chromedriver/chromedriver_linux64.zip -d ~/chromedriver/
echo $LATEST_VERSION > ~/chromedriver/version.txt
else
echo "Using cached Chromedriver version: $CACHED_VERSION"
fi
sudo cp ~/chromedriver/chromedriver /usr/local/bin/chromedriver
sudo chmod 0755 /usr/local/bin/chromedriver
- name: Run tests
run: bundle exec rake app:test
- name: Run system tests
env:
RAILS_ENV: test
DATABASE_URL: sqlite3:db/test.sqlite3
HEADLESS_CHROME: true
run: bundle exec rake app:test:system