Skip to content

Commit 594195b

Browse files
committed
Configure tests to run inside a Docker container
1 parent 20cdb9b commit 594195b

File tree

5 files changed

+39
-23
lines changed

5 files changed

+39
-23
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ Gemfile.lock
99
test/profile/output/*
1010
.rvmrc
1111
.rbenv-version
12+
.tool-versions
1213
.idea
1314
coverage/*
1415
.flooignore
15-
.floo
16+
.floo
17+
.byebug_history

.travis.yml

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,17 @@ sudo: required
22
cache: bundler
33
services:
44
- docker
5-
env:
6-
global:
7-
- TINYTDS_VERSION=2.1.0
8-
- ACTIVERECORD_UNITTEST_HOST=localhost
9-
- ACTIVERECORD_UNITTEST_DATASERVER=localhost
10-
rvm:
11-
- 2.2.10
12-
- 2.3.7
13-
- 2.4.4
14-
- 2.5.1
155
before_install:
16-
- export PATH=/opt/local/bin:$PATH
17-
- docker info
18-
- sudo ./test/bin/setup.sh
19-
- sudo ./test/bin/install-openssl.sh
20-
- openssl version
21-
- sudo ./test/bin/install-freetds.sh
22-
- tsql -C
6+
- sudo rm /usr/local/bin/docker-compose
7+
- sudo curl -L "https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
8+
- sudo chmod +x /usr/local/bin/docker-compose
239
install:
24-
- export PATH=/opt/local/bin:$PATH
25-
- gem install bundler
26-
- bundle --version
27-
- bundle install
10+
- docker-compose build --build-arg TARGET_VERSION=$TARGET_VERSION
2811
script:
29-
- bundle exec rake
12+
- docker-compose run tests
13+
matrix:
14+
include:
15+
- env: TARGET_VERSION=2.3.8
16+
- env: TARGET_VERSION=2.4.5
17+
- env: TARGET_VERSION=2.5.3
18+
- env: TARGET_VERSION=2.6.0

Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
ARG TARGET_VERSION=2.5.3
2+
3+
FROM wpolicarpo/activerecord-sqlserver-adapter:${TARGET_VERSION}
4+
5+
ENV WORKDIR /activerecord-sqlserver-adapter
6+
7+
RUN mkdir -p $WORKDIR
8+
WORKDIR $WORKDIR
9+
10+
COPY . $WORKDIR
11+
12+
RUN bundle install --jobs `expr $(cat /proc/cpuinfo | grep -c "cpu cores") - 1` --retry 3
13+
14+
CMD ["sh"]

docker-compose.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: "2.2"
2+
services:
3+
database:
4+
image: metaskills/mssql-server-linux-rails
5+
tests:
6+
environment:
7+
- ACTIVERECORD_UNITTEST_HOST=database
8+
build: .
9+
command: wait-for database:1433 -- bundle exec rake test
10+
depends_on:
11+
- "database"

test/bin/.keep

Whitespace-only changes.

0 commit comments

Comments
 (0)