Skip to content

Commit da6fa6e

Browse files
costajcouball
authored andcommitted
Conatinerised the test suite with Docker:
- the entry point (in a Docker-enabled env) is `bin/tests` - fixed the (rather invasive outside of a container) `bin/test` test runner
1 parent 2e23d47 commit da6fa6e

File tree

4 files changed

+32
-3
lines changed

4 files changed

+32
-3
lines changed

bin/test

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
require 'bundler/setup'
55

6-
`git config --global user.email "git@example.com"` if `git config user.email`.empty?
7-
`git config --global user.name "GitExample"` if `git config user.name`.empty?
8-
`git config --global init.defaultBranch master` if `git config init.defaultBranch`.empty?
6+
`git config --global user.email "git@example.com"` if `git config --global user.email`.empty?
7+
`git config --global user.name "GitExample"` if `git config --global user.name`.empty?
8+
`git config --global init.defaultBranch master` if `git config --global init.defaultBranch`.empty?
99

1010
project_root = File.expand_path(File.join(__dir__, '..'))
1111

bin/tests

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash -e
2+
test "$#" -ne 0 && echo "Unsupported args: $@" >&2 && exit 145
3+
cd "$( dirname "${BASH_SOURCE[0]}" )"/..
4+
5+
export COMPOSE_FILE=tests/docker-compose.yml
6+
export COMPOSE_PROJECT_NAME=ruby-git_dev
7+
8+
docker-compose rm -svf
9+
docker-compose build --force-rm
10+
11+
docker-compose run --rm tester && docker-compose rm -svf || ( docker-compose logs && exit 1 )

tests/Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM ruby
2+
3+
WORKDIR /ruby-git
4+
5+
6+
ADD Gemfile git.gemspec .git* ./
7+
ADD lib/git/version.rb ./lib/git/version.rb
8+
RUN bundle install
9+
10+
ADD . .
11+
12+
ENTRYPOINT ["bundle", "exec"]
13+
CMD ["bin/test"]

tests/docker-compose.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
services:
2+
tester:
3+
build:
4+
context: ..
5+
dockerfile: tests/Dockerfile

0 commit comments

Comments
 (0)