diff --git a/.mrubycconfig b/.mrubycconfig index 6449614..c833751 100644 --- a/.mrubycconfig +++ b/.mrubycconfig @@ -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 diff --git a/.ruby-version b/.ruby-version deleted file mode 100644 index 60dd455..0000000 --- a/.ruby-version +++ /dev/null @@ -1 +0,0 @@ -mruby-2.1.0 diff --git a/.travis.yml b/.travis.yml index deb4c5d..bc262d5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..26f8bd4 --- /dev/null +++ b/Dockerfile @@ -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"] diff --git a/Gemfile b/Gemfile index 95989b2..13224ee 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,3 @@ source "https://rubygems.org" -gem "mrubyc-test", "~> 0.5.3" +gem "mrubyc-test", "~> 0.6" diff --git a/Gemfile.lock b/Gemfile.lock index 008edfa..77e347b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) @@ -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 diff --git a/Makefile b/Makefile index dd5f872..8b3efb1 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -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) . diff --git a/mrblib/global.rb b/mrblib/global.rb index 13d38e2..f7ba4f2 100644 --- a/mrblib/global.rb +++ b/mrblib/global.rb @@ -8,4 +8,5 @@ # RUBY_VERSION = "1.9" +MRUBY_VERSION = "2.1.1" MRUBYC_VERSION = "2.1" diff --git a/test/tmp/.ruby-version b/test/tmp/.ruby-version deleted file mode 100644 index ec1cf33..0000000 --- a/test/tmp/.ruby-version +++ /dev/null @@ -1 +0,0 @@ -2.6.3