-
Notifications
You must be signed in to change notification settings - Fork 242
133 lines (131 loc) · 4.23 KB
/
test_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
name: MarkUs Tests
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
push:
branches:
- master
jobs:
test:
if: github.event.pull_request.draft == false
runs-on: ubuntu-22.04
services:
postgres:
image: postgres:14
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: markus_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
--entrypoint redis-server
env:
BUNDLE_WITHOUT: development:production:console:unicorn
RAILS_ENV: test
NODE_ENV: test
RSPEC_RENDER_VIEWS: true
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get -yqq install libpq-dev cmake ghostscript pandoc imagemagick libmagickwand-dev git libgl1 tesseract-ocr pandoc
- name: Set up ruby and cache gems
uses: ruby/setup-ruby@v1
with:
ruby-version: ruby-3.3
bundler-cache: true
- name: Set up node and cache packages
uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
- name: Install npm packages
run: npm ci
- name: Install python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Get pip cache dir
id: pip-cache
run: |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: Cache pip
uses: actions/cache@v4
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('requirements-jupyter.txt') }}-${{ hashFiles('requirements-scanner.txt') }}-${{ hashFiles('requirements-qr.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install python packages and playwright dependencies
run: |
python3.10 -m venv venv
./venv/bin/pip install -r requirements-jupyter.txt -r requirements-scanner.txt -r requirements-qr.txt
./venv/bin/playwright install chromium
./venv/bin/playwright install-deps chromium
- name: Configure server
run: |
sudo rm -f /etc/localtime
sudo ln -s /usr/share/zoneinfo/US/Eastern /etc/localtime
sudo sed -ri 's/(rights=")none("\s+pattern="PDF")/\1read\2/' /etc/ImageMagick-6/policy.xml
cp config/database.yml.ci config/database.yml
- name: Build assets
run: |
bundle exec rake javascript:build
bundle exec rake css:build
- name: Set up database
run: bundle exec rails db:migrate
- name: Install chromedriver
uses: nanasess/setup-chromedriver@v2
- name: Run chromedriver
run: chromedriver --port=9515 --whitelisted-ips &
- name: Run rspec tests
run: bundle exec rspec
env:
MARKUS__PYTHON: ./venv/bin/python3
- name: Run rspec system tests
run: bundle exec rspec spec/system
env:
MARKUS__PYTHON: ./venv/bin/python3
- name: Coveralls Parallel (rspec)
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: rspec
parallel: true
file: coverage/lcov.info
- name: Run jest tests
run: npm run test-cov
- name: Coveralls Parallel (jest)
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: jest
parallel: true
file: coverage/lcov.info
finish:
needs: test
if: github.event.pull_request.draft == false
runs-on: ubuntu-22.04
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
carryforward: "rspec,jest"