-
Notifications
You must be signed in to change notification settings - Fork 0
146 lines (143 loc) · 4.99 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
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
134
135
136
137
138
139
140
141
142
143
144
145
146
name: Continuous Integration
on:
pull_request: { branches: [ "main", "csh", "lap" ] }
push:
branches: [ "main", "csh", "lap" ]
tags: [ "*" ]
jobs:
tests:
name: Tests
runs-on: ubuntu-20.04
env:
RAILS_ENV: test
TERM: dumb-color
services:
postgres:
image: postgres:11
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 update && sudo apt install -y graphicsmagick libcurl4-gnutls-dev libreoffice poppler-utils
# build-essential git imagemagick libgmp-dev \
# libmagick++-dev libmysqlclient-dev libpq-dev libreadline-dev libreoffice libssl-dev \
# libxml++2.6-dev libxslt1-dev nodejs openjdk-8-jdk openssh-server poppler-utils zip
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Java
uses: actions/setup-java@v1
with:
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: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.6'
- name: Cache pip
uses: actions/cache@v2
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: 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 }}
build:
needs: [ "tests" ]
name: "Build Image"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- id: generate-image-tag
name: Generate Image Tag
env:
ref_name: "${{ github.ref_name }}"
head_ref: "${{ github.head_ref }}"
run: |
ref_name="${head_ref:-${ref_name/main/latest}}"
echo "::set-output name=imageTag::${ref_name#v}"
- name: Login to Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ghcr.io/${{ github.repository }}:${{ steps.generate-image-tag.outputs.imageTag }}