Skip to content

Commit

Permalink
test on docker
Browse files Browse the repository at this point in the history
  • Loading branch information
hasumikin committed Oct 17, 2020
1 parent 2593479 commit bfbbb72
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 50 deletions.
2 changes: 0 additions & 2 deletions .mrubycconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,3 @@ test_tmp_dir: test/tmp
mrubyc_src_dir: src
mrubyc_mrblib_dir: mrblib
mruby_lib_dir: test
mruby_version: mruby-2.1.0
cruby_version: 2.7.0
1 change: 0 additions & 1 deletion .ruby-version

This file was deleted.

35 changes: 9 additions & 26 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,16 @@
language: c
language: ruby

arch:
- amd64
- arm64
- ppc64le
addons:
apt:
packages:
- docker-ce

cache:
directories:
- /home/travis/.rbenv/
services:
- docker

before_install:
- sudo apt update
- sudo apt install -y autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev

before_script:
- "export CRUBY_VERSION=$(ruby -e'puts `grep cruby_version .mrubycconfig`.sub(\"cruby_version: \", \"\")')"
- export MRUBY_VERSION=$(grep mruby .ruby-version)
- if [ ! -e ~/.rbenv/bin/rbenv ]; then git clone https://github.com/rbenv/rbenv.git ~/.rbenv; fi
- if [ ! -e ~/.rbenv/plugins/ruby-build/bin/ruby-build ]; then git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build; fi
- cd ~/.rbenv/plugins/ruby-build && git pull && cd -
- echo 'export PATH="$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
- source ~/.bash_profile
- echo $PATH
- rbenv init -
- rbenv install --skip-existing $MRUBY_VERSION
- rbenv install --skip-existing $CRUBY_VERSION
- RBENV_VERSION=$CRUBY_VERSION gem install bundler
- RBENV_VERSION=$CRUBY_VERSION bundle install
- docker build -t mrubyc/mrubyc-test .

script:
- RBENV_VERSION=$CRUBY_VERSION CFLAGS="-DMRBC_USE_MATH=1 -DMAX_SYMBOLS_COUNT=500" bundle exec mrubyc-test --every=100
- docker run --mount type=bind,src=${PWD}/,dst=/mrubyc mrubyc/mrubyc-test

18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from ruby:2.7.2-slim

RUN apt update && apt -y upgrade
RUN apt install -y bison make git gcc gcc-arm-linux-gnueabi qemu qemu-kvm qemu-system-arm

RUN gem update --system

RUN git clone https://github.com/mruby/mruby /root/mruby
ARG MRUBY_TAG
RUN cd /root/mruby; git checkout $MRUBY_TAG; make

VOLUME /root/mrubyc
COPY Gemfile /root/mrubyc/
COPY Gemfile.lock /root/mrubyc/
WORKDIR /root/mrubyc
RUN bundle install
ENV CFLAGS="-DMRBC_USE_MATH=1 -DMAX_SYMBOLS_COUNT=500"
CMD ["bundle", "exec", "mrubyc-test", "-e", "100", "-p", "/root/mruby/build/host/bin/mrbc"]
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
source "https://rubygems.org"

gem "mrubyc-test", "~> 0.5.3"
gem "mrubyc-test", "~> 0.6"
14 changes: 7 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (6.0.3.1)
activesupport (6.0.3.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
concurrent-ruby (1.1.6)
i18n (1.8.2)
concurrent-ruby (1.1.7)
i18n (1.8.5)
concurrent-ruby (~> 1.0)
minitest (5.14.1)
mrubyc-test (0.5.3)
minitest (5.14.2)
mrubyc-test (0.6.0)
activesupport (~> 6.0)
rufo (~> 0.12)
thor (~> 1.0)
Expand All @@ -20,13 +20,13 @@ GEM
thread_safe (0.3.6)
tzinfo (1.2.7)
thread_safe (~> 0.1)
zeitwerk (2.3.0)
zeitwerk (2.4.0)

PLATFORMS
ruby

DEPENDENCIES
mrubyc-test (~> 0.5.3)
mrubyc-test (~> 0.6)

BUNDLED WITH
2.1.4
17 changes: 5 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
# This file is distributed under BSD 3-Clause License.
#

MRUBY_VERSION = `grep mruby_version .mrubycconfig | sed 's/mruby_version: *//'`
CRUBY_VERSION = `grep cruby_version .mrubycconfig | sed 's/cruby_version: *//'`
# tag or branch name of mruby/mruby
MRUBY_TAG = `grep MRUBY_VERSION mrblib/global.rb | sed 's/MRUBY_VERSION *= *"\(.\+\)"/\1/'`

all: mrubyc_lib mrubyc_bin

Expand Down Expand Up @@ -42,15 +42,8 @@ package: clean

.PHONY: test setup_test
test:
RBENV_VERSION=$(CRUBY_VERSION) \
CFLAGS="-DMRBC_USE_MATH=1 -DMAX_SYMBOLS_COUNT=500 $(CFLAGS)" \
bundle exec mrubyc-test test --every=100 $(file)
docker run --mount type=bind,src=${PWD}/,dst=/root/mrubyc mrubyc/mrubyc-test

setup_test:
@echo MRUBY_VERSION=$(MRUBY_VERSION)
@echo CRUBY_VERSION=$(CRUBY_VERSION)
rbenv install --skip-existing $(MRUBY_VERSION) ;\
rbenv local $(MRUBY_VERSION) ;\
rbenv install --skip-existing $(CRUBY_VERSION) ;\
RBENV_VERSION=$(CRUBY_VERSION) gem install bundler ;\
RBENV_VERSION=$(CRUBY_VERSION) bundle install
@echo MRUBY_TAG=$(MRUBY_TAG)
docker build -t mrubyc/mrubyc-test --build-arg MRUBY_TAG=$(MRUBY_TAG) .
1 change: 1 addition & 0 deletions mrblib/global.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
#

RUBY_VERSION = "1.9"
MRUBY_VERSION = "2.1.1"
MRUBYC_VERSION = "2.1"
1 change: 0 additions & 1 deletion test/tmp/.ruby-version

This file was deleted.

0 comments on commit bfbbb72

Please sign in to comment.