-
Notifications
You must be signed in to change notification settings - Fork 52
114 lines (113 loc) · 4 KB
/
tests.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
name: tests
on: [push, pull_request]
jobs:
tests:
name: Tests
runs-on: ubuntu-20.04
env:
RAILS_ENV: test
TERM: dumb-color
services:
postgres:
image: postgres:14
env:
POSTGRES_USER: seek
POSTGRES_DB: seek_test
POSTGRES_PASSWORD: test
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
mysql:
image: mysql:5.7
env:
MYSQL_USER: seek
MYSQL_PASSWORD: test
MYSQL_DATABASE: seek_test
MYSQL_ROOT_PASSWORD: test
ports:
- 33306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
virtuoso:
image: tenforce/virtuoso
env:
DBA_PASSWORD: tester
SPARQL_UPDATE: true
DEFAULT_GRAPH: http://www.example.com/my-graph
ports:
- 8890:8890
- 1111:1111
strategy:
fail-fast: false
matrix:
database:
- mysql
suite:
- rails test test/unit
- rails test test/functional
- rails test test/integration
- rspec spec
# - rake teaspoon
- rake assets:precompile
- rake db:setup
- rake db:migrate
- rake seek:upgrade
include:
- database: postgres
suite: rails test test/unit
- database: sqlite3
suite: rails test test/unit
steps:
- name: Install system dependencies
run: |
sudo apt install -y software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install -y graphicsmagick graphviz libcurl4-gnutls-dev libreoffice poppler-utils build-essential \
git imagemagick libgmp-dev python3.9-dev python3.9-distutils python3-pip
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11' # The JDK version to make available on the path.
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Cache pip
uses: actions/cache@v4
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install Python dependencies
run: |
python3.9 -m pip install setuptools==58
python3.9 -m pip install -r requirements.txt
- name: Create test database
run: |
cp test/config/database.github.${{ matrix.database }}.yml config/database.yml
bundle exec rake db:create
- name: Set MySQL char set and collation
if: matrix.database == 'mysql'
run: echo -e "ALTER DATABASE seek_test CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;\n" | bundle exec rails dbconsole -p
- name: Checkout previous schema
if: github.event_name == 'push' && matrix.suite == 'rake db:migrate' && github.event.before != '0000000000000000000000000000000000000000'
run: |
git fetch origin ${{ github.event.before }}
git checkout ${{ github.event.before }} -- db/schema.rb
- name: Load test database schema
run: bundle exec rake db:schema:load
- name: Seed database
if: matrix.suite == 'rake seek:upgrade'
run: bundle exec rake db:seed
- name: Virtuoso config
if: matrix.suite == 'rails test test/integration'
run: cp test/config/virtuoso_test_settings.yml config/virtuoso_settings.yml
- name: Run tests
run: bundle exec ${{ matrix.suite }}